summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/url.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 3ef8e272f9..440fc0315e 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1369,11 +1369,6 @@ function toPathIfFileURL(fileURLOrPath) {
return fileURLToPath(fileURLOrPath);
}
-function NativeURL(ctx) {
- this[context] = ctx;
-}
-NativeURL.prototype = URL.prototype;
-
function constructUrl(flags, protocol, username, password,
host, port, path, query, fragment) {
var ctx = new URLContext();
@@ -1386,10 +1381,13 @@ function constructUrl(flags, protocol, username, password,
ctx.query = query;
ctx.fragment = fragment;
ctx.host = host;
- const url = new NativeURL(ctx);
- url[searchParams] = new URLSearchParams();
- url[searchParams][context] = url;
- initSearchParams(url[searchParams], query);
+
+ const url = Object.create(URL.prototype);
+ url[context] = ctx;
+ const params = new URLSearchParams();
+ url[searchParams] = params;
+ params[context] = url;
+ initSearchParams(params, query);
return url;
}
setURLConstructor(constructUrl);