diff --git a/lib/internal/url.js b/lib/internal/url.js index c4640a68b28d23..3b61f432b91dad 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -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 {