forward document.URL to worker

This commit is contained in:
Alon Zakai 2014-08-15 10:55:50 -07:00
Родитель 568d32ec75
Коммит cd0d4a00f6
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -82,7 +82,7 @@ var worker = new Worker('{{{ filename }}}.js');
WebGLClient.prefetch(); WebGLClient.prefetch();
setTimeout(function() { setTimeout(function() {
worker.postMessage({ target: 'worker-init', width: Module.canvas.width, height: Module.canvas.height, preMain: true }); worker.postMessage({ target: 'worker-init', width: Module.canvas.width, height: Module.canvas.height, URL: document.URL, preMain: true });
}, 0); // delay til next frame, to make sure html is ready }, 0); // delay til next frame, to make sure html is ready
var workerResponded = false; var workerResponded = false;

Просмотреть файл

@ -271,6 +271,8 @@ document.styleSheets = [{
} }
}]; }];
document.URL = 'http://worker.not.yet.ready.wait.for.window.onload?fake';
function Audio() { function Audio() {
Runtime.warnOnce('faking Audio elements, no actual sound will play'); Runtime.warnOnce('faking Audio elements, no actual sound will play');
} }
@ -393,6 +395,8 @@ onmessage = function onmessage(message) {
Module.canvas = document.createElement('canvas'); Module.canvas = document.createElement('canvas');
Module.canvas.width_ = message.data.width; Module.canvas.width_ = message.data.width;
Module.canvas.height_ = message.data.height; Module.canvas.height_ = message.data.height;
document.URL = message.data.URL;
window.fireEvent({ type: 'load' });
removeRunDependency('worker-init'); removeRunDependency('worker-init');
break; break;
} }