Bug 663291 ride-along: reactivate the web worker error propagation tests (from bug 595394, disabled in bug 692605). r=ted

--HG--
extra : rebase_source : a01f9c3461f4af611e7fdeb442d001bb694a99ec
This commit is contained in:
Zack Weinberg 2012-11-16 15:29:21 -05:00
Родитель ff35201bdd
Коммит 0f08bc57ca
2 изменённых файлов: 21 добавлений и 7 удалений

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

@ -18,8 +18,8 @@
type: "window", type: "window",
data: { message: message, filename: filename, lineno: lineno } data: { message: message, filename: filename, lineno: lineno }
}); });
return true;
} }
return false;
}; };
worker = new Worker("errorPropagation_worker.js"); worker = new Worker("errorPropagation_worker.js");

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

@ -36,6 +36,10 @@
} }
else if (event.type == "window") { else if (event.type == "window") {
windowErrorCount++; windowErrorCount++;
workerFrame.stop();
// do this via executeSoon to give the workers a chance to
// be cleaned up
SimpleTest.executeSoon(SimpleTest.endMonitorConsole);
} }
else { else {
ok(false, "Bad event type: " + event.type); ok(false, "Bad event type: " + event.type);
@ -45,17 +49,27 @@
is(event.data.filename, errorFilename, is(event.data.filename, errorFilename,
"Correct message event.filename"); "Correct message event.filename");
is(event.data.lineno, errorLineno, "Correct message event.lineno"); is(event.data.lineno, errorLineno, "Correct message event.lineno");
}
if (windowErrorCount == 1) { function finish() {
is(scopeErrorCount, workerCount, "Good number of scope errors"); is(scopeErrorCount, workerCount, "Good number of scope errors");
is(workerErrorCount, workerCount, "Good number of worker errors"); is(workerErrorCount, workerCount, "Good number of worker errors");
workerFrame.stop(); is(windowErrorCount, 1, "Good number of window errors");
SimpleTest.finish(); SimpleTest.finish();
}
} }
function workerFrameLoaded() { function workerFrameLoaded() {
workerFrame = document.getElementById("workerFrame").contentWindow; workerFrame = document.getElementById("workerFrame").contentWindow;
SimpleTest.monitorConsole(finish, [
{ 'isScriptError': true,
'isWarning': false,
'isException': false,
'sourceName': errorFilename,
'lineNumber': errorLineno,
'errorMessage': errorMessage }
]);
workerFrame.start(workerCount, messageListener); workerFrame.start(workerCount, messageListener);
} }