diff --git a/lib/internal/url.js b/lib/internal/url.js index 9cb14654381e48..33d5437e29f3e6 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -626,7 +626,7 @@ function onParseHashComplete(flags, protocol, username, password, } function isURLThis(self) { - return self?.[context] !== undefined; + return (self !== undefined && self !== null && self[context] !== undefined); } class URL {