diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-02-08 15:36:11 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-02-15 15:51:10 -0600 |
commit | e5c8a47cbb39dddb0855c1ddfa505f083fff0c78 (patch) | |
tree | 47c19ab348814137b3a7dc23ed0edc4bbfbd5449 /app | |
parent | 4342e3915c9a3d374f3862b2cfc3ddb07ae56169 (diff) | |
download | gitlab-ce-e5c8a47cbb39dddb0855c1ddfa505f083fff0c78.tar.gz |
fix monaco editor config to ensure service workers are not loaded from cross-domain origins
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ide/monaco_loader.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/monaco_loader.js b/app/assets/javascripts/ide/monaco_loader.js index af83a1ec0b4..142a220097b 100644 --- a/app/assets/javascripts/ide/monaco_loader.js +++ b/app/assets/javascripts/ide/monaco_loader.js @@ -6,6 +6,11 @@ monacoContext.require.config({ }, }); +// ignore CDN config and use local assets path for service worker which cannot be cross-domain +const relativeRootPath = (gon && gon.relative_url_root) || ''; +const monacoPath = `${relativeRootPath}/assets/webpack/monaco-editor/vs`; +window.MonacoEnvironment = { getWorkerUrl: () => `${monacoPath}/base/worker/workerMain.js` }; + // eslint-disable-next-line no-underscore-dangle window.__monaco_context__ = monacoContext; export default monacoContext.require; |