Skip to content

Commit

Permalink
Use an object url to fix cross-origin workers in Safari (see microsof…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Sep 21, 2020
1 parent 50cb4fe commit 08c92c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vs/base/worker/defaultWorkerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 08c92c9

Please sign in to comment.