diff --git a/src/vector/index.html b/src/vector/index.html
index e86f2996..331bf684 100644
--- a/src/vector/index.html
+++ b/src/vector/index.html
@@ -37,8 +37,19 @@
Sorry, Riot requires JavaScript to be enabled.
- <% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {%>
-
+ <% 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;
+ }
+ %>
+
<% } %>
diff --git a/src/vector/index.js b/src/vector/index.js
index 73c004d3..e08b7174 100644
--- a/src/vector/index.js
+++ b/src/vector/index.js
@@ -68,11 +68,15 @@ import url from 'url';
import {parseQs, parseQsFromFragment} from './url_utils';
import Platform from './platform';
+import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
+
var lastLocationHashSet = null;
var CallHandler = require("matrix-react-sdk/lib/CallHandler");
CallHandler.setConferenceHandler(VectorConferenceHandler);
+MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
+
function checkBrowserFeatures(featureList) {
if (!window.Modernizr) {
console.error("Cannot check features - Modernizr global is missing.");
diff --git a/src/vector/indexedbd-worker.js b/src/vector/indexedbd-worker.js
new file mode 100644
index 00000000..2e94509a
--- /dev/null
+++ b/src/vector/indexedbd-worker.js
@@ -0,0 +1,21 @@
+/*
+Copyright 2017 Vector Creations Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import {IndexedDBStoreWorker} from 'matrix-js-sdk/lib/indexeddb-worker.js';
+
+const remoteWorker = new IndexedDBStoreWorker(postMessage);
+
+onmessage = remoteWorker.onMessage;
diff --git a/webpack.config.js b/webpack.config.js
index f3cffa0e..e32f7177 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -6,6 +6,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
"bundle": "./src/vector/index.js",
+ "indexeddb-worker": "./src/vector/indexedbd-worker.js",
// We ship olm.js as a separate lump of javascript. This makes it get
// loaded via a separate tag in index.html (which loads it