Skip to content

Commit 96e6873

Browse files
TimothyGuBridgeAR
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 <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d2e9b76 commit 96e6873

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

lib/internal/url.js

+2-13
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
function parse(url, input, base) {
248248
const base_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: new URLContext()
255-
});
256-
}
249+
url[context] = new URLContext();
257250
_parse(input.trim(), -1, base_context, undefined,
258251
onParseComplete.bind(url), onParseError);
259252
}
@@ -1381,11 +1374,7 @@ function toPathIfFileURL(fileURLOrPath) {
13811374
}
13821375

13831376
function NativeURL(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

-14
This file was deleted.

0 commit comments

Comments
 (0)