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
2023-03-01 08:26:03 -05:00
committed by GitHub
parent da0bc6db98
commit 37c736f780

View File

@@ -16,6 +16,7 @@ const {
ObjectGetOwnPropertySymbols,
ObjectGetPrototypeOf,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectGetOwnPropertyDescriptor,
ReflectOwnKeys,
RegExpPrototypeSymbolReplace,
@@ -536,8 +537,7 @@ ObjectDefineProperties(URLSearchParams.prototype, {
});
function isURLThis(self) {
// TODO(@anonrig): Use ObjectPrototypeHasOwnProperty to avoid prototype look
return (self !== undefined && self !== null && self[context] !== undefined);
return self != null && ObjectPrototypeHasOwnProperty(self, context);
}
class URL {