Skip to content

Commit 915d08e

Browse files
committed
Fix Worker script path undefined on Android
Due to a difference in execution order in Android & iOS cordova code the workerScriptPath was already deleted on Android when the script was supposed to load. Change-Id: I5c12cd7abd4c4dfb9645a01c9dd98e24b465e54f
1 parent 1368919 commit 915d08e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/boot/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ tabris._start = function(client) {
2727
const cordovaScript = document.createElement('script');
2828
cordovaScript.src = './cordova.js';
2929
document.head.appendChild(cordovaScript);
30-
const isWorker = global.workerScriptPath !== undefined;
30+
const workerScriptPath = global.workerScriptPath;
31+
delete global.workerScriptPath;
32+
const isWorker = workerScriptPath !== undefined;
3133
if (tabris._init) {
3234
tabris._init(client, {headless: isWorker});
3335
}
@@ -36,7 +38,7 @@ tabris._start = function(client) {
3638
if (global.debugClient && !isWorker) {
3739
global.debugClient.start(rootModule);
3840
}
39-
rootModule.require('./' + (isWorker ? global.workerScriptPath : ''));
41+
rootModule.require('./' + (isWorker ? workerScriptPath : ''));
4042
tabris.flush();
4143
} catch (error) {
4244
printError('Could not load ' + (isWorker ? 'worker' : 'main module') + ':', error);
@@ -48,7 +50,6 @@ tabris._start = function(client) {
4850
} else {
4951
loadModule();
5052
}
51-
delete global.workerScriptPath;
5253
tabris.flush();
5354
} catch (error) {
5455
printError('Could not start tabris:', error);

0 commit comments

Comments
 (0)