Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this.startWorkerImmediately(scriptUrl, timeout).catch(error => {
if (typeof window !== "undefined") {
const pageUrl = window.location.href;
const fullScriptUrl = new URL(scriptUrl, pageUrl).href;
if (getUrlOrigin(fullScriptUrl) === getUrlOrigin(pageUrl)) {
throw error;
}
logger.log(
"#startWorker: cross-origin worker construction failed, trying load with blob"
);
this.directlyFallbackToBlobBasedLoading = true;
return WorkerLoader.startWorkerBlob(scriptUrl, timeout);
} else {
throw error;
}
});
}