Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-05-03 19:16:56 +0300
committerMike Greiling <mike@pixelcog.com>2018-05-03 19:56:34 +0300
commiteb548e6eb14907e1d362a2e47e81498195a74183 (patch)
tree3dffd86c9b842aaf8cd3a1c5fcf2068134736ab1 /app/assets/javascripts/ide/index.js
parentb2d90ea1fb16ec4db441c86262191a093401b962 (diff)
adjust IDE page loading config to ensure web workers are not loaded cross-origin
Diffstat (limited to 'app/assets/javascripts/ide/index.js')
-rw-r--r--app/assets/javascripts/ide/index.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js
index cbfb3dc54f2..1119b572a1f 100644
--- a/app/assets/javascripts/ide/index.js
+++ b/app/assets/javascripts/ide/index.js
@@ -4,7 +4,9 @@ import ide from './components/ide.vue';
import store from './stores';
import router from './ide_router';
-function initIde(el) {
+Vue.use(Translate);
+
+export function initIde(el) {
if (!el) return null;
return new Vue({
@@ -26,8 +28,9 @@ function initIde(el) {
});
}
-const ideElement = document.getElementById('ide');
-
-Vue.use(Translate);
-
-initIde(ideElement);
+export function resetServiceWorkersPublicPath() {
+ // tell webpack to load assets from origin so that web workers don't break
+ const relativeRootPath = (gon && gon.relative_url_root) || '';
+ const webpackAssetPath = `${relativeRootPath}/assets/webpack/`;
+ __webpack_public_path__ = webpackAssetPath; // eslint-disable-line camelcase
+}