url: improve isURLThis detection

PR-URL: https://github.com/nodejs/node/pull/46866
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Yagiz Nizipli authored and Danielle Adams committed 2023-04-10 20:55:05 -04:00
1 parent b344e74bc1
commit 4d0faf4ddc
1 file changed
+5
+5
View File
@@ -17,6 +17,7 @@ const {
ObjectGetOwnPropertySymbols,
ObjectGetPrototypeOf,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectApply,
ReflectGetOwnPropertyDescriptor,
ReflectOwnKeys,
@@ -568,6 +569,10 @@ function onParseComplete(flags, protocol, username, password,
initSearchParams(this[searchParams], query);
}
function isURLThis(self) {
return self != null && ObjectPrototypeHasOwnProperty(self, context);
}
function onParseError(input, flags) {
throw new ERR_INVALID_URL(input);
}