Skip to content

Commit 4e111ce

Browse files
TimothyGuBethGriggs
authored andcommitted
Revert "url: make the context non-enumerable"
This reverts commit 5e1bf05, as it causes major performance regressions during object construction. Refs: #24218 PR-URL: #24495 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c57008e commit 4e111ce

2 files changed

Lines changed: 2 additions & 27 deletions

File tree

‎lib/internal/url.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,7 @@ function onParseError(flags, input) {
246246
// Reused by URL constructor and URL#href setter.
247247
functionparse(url,input,base){
248248
constbase_context=base ? base[context] : undefined;
249-
// In the URL#href setter
250-
if(!url[context]){
251-
Object.defineProperty(url,context,{
252-
enumerable: false,
253-
configurable: false,
254-
value: newURLContext()
255-
});
256-
}
249+
url[context]=newURLContext();
257250
_parse(input.trim(),-1,base_context,undefined,
258251
onParseComplete.bind(url),onParseError);
259252
}
@@ -1381,11 +1374,7 @@ function toPathIfFileURL(fileURLOrPath) {
13811374
}
13821375

13831376
functionNativeURL(ctx){
1384-
Object.defineProperty(this,context,{
1385-
enumerable: false,
1386-
configurable: false,
1387-
value: ctx
1388-
});
1377+
this[context]=ctx;
13891378
}
13901379
NativeURL.prototype=URL.prototype;
13911380

‎test/parallel/test-whatwg-url-custom-no-enumerable-context.js‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)