Skip to content

Commit

Permalink
Revert "url: make the context non-enumerable"
Browse files Browse the repository at this point in the history
This reverts commit 5e1bf05, as it
causes major performance regressions during object construction.

Refs: nodejs#24218

PR-URL: nodejs#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>
  • Loading branch information
TimothyGu authored and Trott committed Dec 1, 2018
1 parent e9de435 commit e143802
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
15 changes: 2 additions & 13 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;

Expand Down
14 changes: 0 additions & 14 deletions test/parallel/test-whatwg-url-custom-no-enumerable-context.js

This file was deleted.

0 comments on commit e143802

Please sign in to comment.