forked from matrix/element-web
Merge pull request #7920 from vector-im/dbkr/fix_indexeddb_worker
Fix the IndexedDB worker
This commit is contained in:
commit
baf3df5736
|
@ -36,28 +36,10 @@
|
||||||
<body style="height: 100%;">
|
<body style="height: 100%;">
|
||||||
<section id="matrixchat" style="height: 100%;"></section>
|
<section id="matrixchat" style="height: 100%;"></section>
|
||||||
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
|
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
|
||||||
<% 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')) {
|
|
||||||
%>
|
|
||||||
<script>
|
<script>
|
||||||
window.vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.js[i] %>';
|
window.vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.chunks['indexeddb-worker'].entry %>';
|
||||||
</script>
|
</script>
|
||||||
<%
|
<script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
|
||||||
continue;
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
<script src="<%= htmlWebpackPlugin.files.js[i] %>"></script>
|
|
||||||
<% } %>
|
|
||||||
<img src="img/warning.svg" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
<img src="img/warning.svg" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
||||||
<audio id="messageAudio">
|
<audio id="messageAudio">
|
||||||
<source src="media/message.ogg" type="audio/ogg" />
|
<source src="media/message.ogg" type="audio/ogg" />
|
||||||
|
|
|
@ -209,6 +209,13 @@ function onTokenLoginCompleted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadApp() {
|
async function loadApp() {
|
||||||
|
if (window.vector_indexeddb_worker_script === undefined) {
|
||||||
|
// If this is missing, something has probably gone wrong with
|
||||||
|
// the bundling. The js-sdk will just fall back to accessing
|
||||||
|
// indexeddb directly with no worker script, but we want to
|
||||||
|
// make sure the indexeddb script is present, so fail hard.
|
||||||
|
throw new Error("Missing indexeddb worker script!");
|
||||||
|
}
|
||||||
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
|
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
|
||||||
CallHandler.setConferenceHandler(VectorConferenceHandler);
|
CallHandler.setConferenceHandler(VectorConferenceHandler);
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,4 @@ import {IndexedDBStoreWorker} from 'matrix-js-sdk/lib/indexeddb-worker.js';
|
||||||
|
|
||||||
const remoteWorker = new IndexedDBStoreWorker(postMessage);
|
const remoteWorker = new IndexedDBStoreWorker(postMessage);
|
||||||
|
|
||||||
export const onmessage = remoteWorker.onMessage;
|
global.onmessage = remoteWorker.onMessage;
|
||||||
|
|
Loading…
Reference in New Issue