mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
Revert "url: make the context non-enumerable"
This reverts commit 5e1bf058f4, as it
causes major performance regressions during object construction.
Refs: https://github.com/nodejs/node/pull/24218
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
d2e9b76c1d
commit
96e6873dd0
2 files changed
+2
-27
No files matched your search
+2
-13
@@ -246,14 +246,7 @@ function onParseError(flags, input) {
|
||||
// Reused by URL constructor and URL#href setter.
|
||||
function parse(url, input, base) {
|
||||
const base_context = base ? base[context] : undefined;
|
||||
// In the URL#href setter
|
||||
if (!url[context]) {
|
||||
Object.defineProperty(url, context, {
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
value: new URLContext()
|
||||
});
|
||||
}
|
||||
url[context] = new URLContext();
|
||||
_parse(input.trim(), -1, base_context, undefined,
|
||||
onParseComplete.bind(url), onParseError);
|
||||
}
|
||||
@@ -1381,11 +1374,7 @@ function toPathIfFileURL(fileURLOrPath) {
|
||||
}
|
||||
|
||||
function NativeURL(ctx) {
|
||||
Object.defineProperty(this, context, {
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
value: ctx
|
||||
});
|
||||
this[context] = ctx;
|
||||
}
|
||||
NativeURL.prototype = URL.prototype;
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
// This tests that the context of URL objects are not
|
||||
// enumerable and thus considered by assert libraries.
|
||||
// See https://github.com/nodejs/node/issues/24211
|
||||
|
||||
// Tests below are not from WPT.
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
assert.deepStrictEqual(
|
||||
new URL('./foo', 'https://example.com/'),
|
||||
new URL('https://example.com/foo')
|
||||
);
|
||||
Reference in new issue
Block a user