refactor: update runtime code for primordial checks for "instanceof" (#13497)

This commit is contained in:
Bartek Iwańczuk 2022-01-27 13:36:36 +01:00 committed by GitHub
parent dcf8f144ab
commit 884143218f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1030 additions and 660 deletions

View file

@ -3,14 +3,15 @@
((window) => {
const {
StringPrototypeReplace,
TypeError,
Promise,
decodeURIComponent,
Error,
ObjectPrototypeIsPrototypeOf,
Promise,
StringPrototypeReplace,
TypeError,
} = window.__bootstrap.primordials;
const { build } = window.__bootstrap.build;
const { URL } = window.__bootstrap.url;
const { URLPrototype } = window.__bootstrap.url;
let logDebug = false;
let logSource = "JS";
@ -93,7 +94,7 @@
}
function pathFromURL(pathOrUrl) {
if (pathOrUrl instanceof URL) {
if (ObjectPrototypeIsPrototypeOf(URLPrototype, pathOrUrl)) {
if (pathOrUrl.protocol != "file:") {
throw new TypeError("Must be a file URL.");
}