From 7527bdd2c7d824fd061778917c5cfa0953e2d33c Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 19 Dec 2018 22:05:04 +0000 Subject: [PATCH] Fix the IndexedDB worker Looks like this was broken in the webpack 4 upgrade due to the worker script setter and the bundle being re-ordered in index.html. * Remove the loop: we only use two scripts now, so import them explicitly * Remove outdated olm import code. * Stop generating a script import for each theme: we were pulling in 3 js files that did absolutely nothing. * Fix worker 'onmessage' scope (set it as a global rather than trying to make it an ES6 module which it isn't). * Fail hard if the indexeddb worker script isn't set to avoid this happening again. --- src/vector/index.html | 26 ++++---------------------- src/vector/index.js | 7 +++++++ src/vector/indexeddb-worker.js | 2 +- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/vector/index.html b/src/vector/index.html index 4ba65c3e06..a5f3af9b81 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -36,28 +36,10 @@
- <% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) { - if (_.endsWith(htmlWebpackPlugin.files.js[i], 'olm.js')) { - var array = htmlWebpackPlugin.files.js; - htmlWebpackPlugin.files.js.unshift(htmlWebpackPlugin.files.js[i]); - htmlWebpackPlugin.files.js.splice(i, 1); - } - } - - for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) { - // Not a particularly graceful way of not putting the indexeddb worker script - // into the main page - if (_.endsWith(htmlWebpackPlugin.files.js[i], 'indexeddb-worker.js')) { - %> - - <% - continue; - } - %> - - <% } %> + +