Closed rorticus closed 7 years ago
This test in dojo/shim will show the problem,
'queue from webworker': function (this: any) {
if (global.Worker === undefined) {
this.skip('does not support web workers');
return;
}
const baseUrl = location.origin;
const dfd = this.async(10000);
const blob = new Blob([ `(function() {
self.addEventListener('message', function (event) {
if(event.data.baseUrl) {
var baseUrl = event.data.baseUrl;
importScripts(baseUrl + '/node_modules/@dojo/loader/loader.js');
require.config({
baseUrl: baseUrl,
packages: [
{ name: '@dojo', location: 'node_modules/@dojo' }
]
});
require(['_build/src/support/queue'], function (queue) {
queue.queueTask(function() {
self.postMessage('success');
});
});
}
});
})()` ], { type: 'application/javascript' });
const worker = new Worker(URL.createObjectURL(blob));
worker.addEventListener('error', (error) => {
dfd.reject(new Error(error.message));
});
worker.addEventListener('message', ({ data: result }) => {
if (result === 'success') {
dfd.resolve();
}
});
worker.postMessage({
baseUrl
});
}
Issue moved to dojo/shim #107 via ZenHub
Bug
When writing the test for https://github.com/dojo/core/issues/320, I've run into another issue in IE11. It looks like XHR requests use queue, and that's causing some woe in IE 11 from a webworker.
^^ that code: https://github.com/dojo/shim/blob/master/src/support/queue.ts#L65