Bug 1452762 - Avoid interrupting the wrong script in watchdog tests. r=arai

My best guess as to the failures here is that we're not actually
reaching the busyWait call by the time the interrupt callback fires,
and thus we're killing unrelated scripts.

MozReview-Commit-ID: GvCJzBcJlXm

Differential Revision: https://phabricator.services.mozilla.com/D2162

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bobby Holley 2018-07-17 03:16:12 +00:00
Родитель b945779700
Коммит 1387148cf0
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -70,6 +70,7 @@ function checkWatchdog(expectInterrupt) {
var lastWatchdogWakeup = Cu.getWatchdogTimestamp("WatchdogWakeup");
return new Promise(resolve => {
let inBusyWait = false;
setInterruptCallback(function() {
// If the watchdog didn't actually trigger the operation callback, ignore
// this call. This allows us to test the actual watchdog behavior without
@ -77,6 +78,11 @@ function checkWatchdog(expectInterrupt) {
if (lastWatchdogWakeup == Cu.getWatchdogTimestamp("WatchdogWakeup")) {
return true;
}
if (!inBusyWait) {
Assert.ok(true, "Not in busy wait, ignoring interrupt callback");
return true;
}
Assert.ok(expectInterrupt, "Interrupt callback fired");
setInterruptCallback(undefined);
setScriptTimeout(oldTimeout);
@ -86,7 +92,9 @@ function checkWatchdog(expectInterrupt) {
});
executeSoon(function() {
inBusyWait = true;
busyWait(3000);
inBusyWait = false;
Assert.ok(!expectInterrupt, "Interrupt callback didn't fire");
setInterruptCallback(undefined);
setScriptTimeout(oldTimeout);