mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Merge pull request #160 from six-ponies/fix/import-script-protocol-error
fix: Failed to execute 'importScripts' on 'WorkerGlobalScope': The URL xxx is invalid.
This commit is contained in:
commit
6a882e9569
1 changed files with 3 additions and 0 deletions
|
|
@ -234,6 +234,9 @@ function createLoaderRules(languages: IFeatureDefinition[], features: IFeatureDe
|
|||
var currentUrl = String(window.location);
|
||||
var currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);
|
||||
if (result.substring(0, currentOrigin.length) !== currentOrigin) {
|
||||
if(/^(\\/\\/)/.test(result)) {
|
||||
result = window.location.protocol + result
|
||||
}
|
||||
var js = '/*' + label + '*/importScripts("' + result + '");';
|
||||
var blob = new Blob([js], { type: 'application/javascript' });
|
||||
return URL.createObjectURL(blob);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue