mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 22:37:41 +00:00
Use an object url to fix cross-origin workers in Safari (see microsoft/monaco-editor#2110)
This commit is contained in:
parent
50cb4feaf7
commit
08c92c9161
|
@ -38,8 +38,12 @@ export function getWorkerBootstrapUrl(scriptPath: string, label: string, forceDa
|
|||
const myPath = 'vs/base/worker/defaultWorkerFactory.js';
|
||||
const workerBaseUrl = require.toUrl(myPath).slice(0, -myPath.length);
|
||||
const js = `/*${label}*/self.MonacoEnvironment={baseUrl: '${workerBaseUrl}'};importScripts('${scriptPath}');/*${label}*/`;
|
||||
const url = `data:text/javascript;charset=utf-8,${encodeURIComponent(js)}`;
|
||||
return url;
|
||||
if (forceDataUri) {
|
||||
const url = `data:text/javascript;charset=utf-8,${encodeURIComponent(js)}`;
|
||||
return url;
|
||||
}
|
||||
const blob = new Blob([js], { type: 'application/javascript' });
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
}
|
||||
return scriptPath + '#' + label;
|
||||
|
|
Loading…
Reference in a new issue