File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 < body style ="height: 100%; ">
3838 < section id ="matrixchat " style ="height: 100%; "> </ section >
3939 < noscript > Sorry, Riot requires JavaScript to be enabled.</ noscript >
40- < % for (var i=0; i < htmlWebpackPlugin .files.js.length; i++) {% >
41- < script src ="<%= htmlWebpackPlugin.files.js[i] %> "> </ script >
40+ < % for (var i=0; i < htmlWebpackPlugin .files.js.length; i++) {
41+ // Not a particularly graceful way of not putting the indexeddb worker script
42+ // into the main page
43+ if (htmlWebpackPlugin.files.js[i].endsWith('indexeddb-worker.js')) {
44+ %>
45+ < script >
46+ window . vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.js[i] %>' ;
47+ </ script >
48+ < %
49+ continue;
50+ }
51+ %>
52+ < script src ="<%= htmlWebpackPlugin.files.js[i] %> "> </ script >
4253 < % } %>
4354 < img src ="img/warning.svg " width ="24 " height ="23 " style ="visibility: hidden; position: absolute; top: 0px; left: 0px; "/>
4455 < audio id ="messageAudio ">
Original file line number Diff line number Diff line change @@ -68,11 +68,15 @@ import url from 'url';
6868import { parseQs , parseQsFromFragment } from './url_utils' ;
6969import Platform from './platform' ;
7070
71+ import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg' ;
72+
7173var lastLocationHashSet = null ;
7274
7375var CallHandler = require ( "matrix-react-sdk/lib/CallHandler" ) ;
7476CallHandler . setConferenceHandler ( VectorConferenceHandler ) ;
7577
78+ MatrixClientPeg . setIndexedDbWorkerScript ( window . vector_indexeddb_worker_script ) ;
79+
7680function checkBrowserFeatures ( featureList ) {
7781 if ( ! window . Modernizr ) {
7882 console . error ( "Cannot check features - Modernizr global is missing." ) ;
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2017 Vector Creations Ltd
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ // The prescribed way of doing this import would be:
18+ //import {IndexedDbStoreWorker} from 'matrix-js-sdk';
19+ // However, this still pulls in all of the js-sdk and we only use a tiny fraction
20+ // of it. It also causes an Olm error to appear because we don't have an Olm in scope.
21+ // Instead, we do this:
22+ import IndexedDbStoreWorker from 'matrix-js-sdk/lib/store/indexeddb-remote-worker' ;
23+
24+ const remoteWorker = new IndexedDbStoreWorker ( postMessage ) ;
25+
26+ onmessage = remoteWorker . onMessage ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
66module . exports = {
77 entry : {
88 "bundle" : "./src/vector/index.js" ,
9+ "indexeddb-worker" : "./src/vector/indexedbd-worker.js" ,
910
1011 // We ship olm.js as a separate lump of javascript. This makes it get
1112 // loaded via a separate <script/> tag in index.html (which loads it
You can’t perform that action at this time.
0 commit comments