mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 07:17:30 +09:00
Bug 1288768 - Better error reporting for network errors in workers
This commit is contained in:
parent
12f3d0302c
commit
6509b677d3
8 changed files with 7 additions and 22 deletions
|
|
@ -23,11 +23,8 @@
|
|||
);
|
||||
|
||||
worker.onerror = function(error) {
|
||||
var msg = error.message;
|
||||
if (msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/)) {
|
||||
// this means CSP blocked it
|
||||
msg = "blocked";
|
||||
}
|
||||
// this means CSP blocked it
|
||||
var msg = !("message" in error) ? "blocked" : e.message;
|
||||
window.parent.postMessage({id:page_id, message:msg}, 'http://mochi.test:8888');
|
||||
error.preventDefault();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,9 +53,6 @@ function testWorker([mime, shouldLoad]) {
|
|||
};
|
||||
worker.onerror = (error) => {
|
||||
ok(!shouldLoad, `worker with wrong mime '${mime}' should be blocked`);
|
||||
let msg = error.message;
|
||||
ok(msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/),
|
||||
"should gets correct error message");
|
||||
error.preventDefault();
|
||||
resolve();
|
||||
}
|
||||
|
|
@ -74,9 +71,6 @@ function testWorkerImportScripts([mime, shouldLoad]) {
|
|||
};
|
||||
worker.onerror = (error) => {
|
||||
ok(!shouldLoad, `worker/importScripts with wrong mime '${mime}' should be blocked`);
|
||||
let msg = error.message;
|
||||
ok(msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/),
|
||||
"should gets correct error message");
|
||||
error.preventDefault();
|
||||
resolve();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue