Skip to content

Commit b10fe58

Browse files
anonrigtargos
authored andcommitted
url: improve isURLThis detection
PR-URL: #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>
1 parent 08bf015 commit b10fe58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/url.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const {
1616
ObjectGetOwnPropertySymbols,
1717
ObjectGetPrototypeOf,
1818
ObjectKeys,
19+
ObjectPrototypeHasOwnProperty,
1920
ReflectGetOwnPropertyDescriptor,
2021
ReflectOwnKeys,
2122
RegExpPrototypeSymbolReplace,
@@ -536,8 +537,7 @@ ObjectDefineProperties(URLSearchParams.prototype, {
536537
});
537538

538539
function isURLThis(self) {
539-
// TODO(@anonrig): Use ObjectPrototypeHasOwnProperty to avoid prototype look
540-
return (self !== undefined && self !== null && self[context] !== undefined);
540+
return self != null && ObjectPrototypeHasOwnProperty(self, context);
541541
}
542542

543543
class URL {

0 commit comments

Comments
 (0)