Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 689621: intermittent failure in test-content-worker::test:setTime…
Browse files Browse the repository at this point in the history
…out r=myk
  • Loading branch information
ochameau committed Oct 4, 2011
1 parent ece8f0b commit 27677ad
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/api-utils/tests/test-content-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,21 @@ exports['test:setTimeout are unregistered on content unload'] = function(test) {
// and all setTimeout/setInterval should be unregistered.
// Wait some cycles in order to execute some intervals.
timer.setTimeout(function () {
// Location change with data: URI are synchonous, so that unload is
// synchronous too and intervals should be removed immediatly
// Bug 689621: Wait for the new document load so that we are sure that
// previous document cancelled its intervals
iframe.addEventListener("load", function onload() {
iframe.removeEventListener("load", onload, true);
let titleAfterLoad = originalDocument.title;
// Wait additional cycles to verify that intervals are really cancelled
timer.setTimeout(function () {
test.assertEqual(iframe.contentDocument.title, "final",
"New document has not been modified");
test.assertEqual(originalDocument.title, titleAfterLoad,
"Nor previous one");
test.done();
}, 100);
}, true);
iframe.setAttribute("src", "data:text/html,<title>final</title>");
let titleAfterLoad = originalDocument.title;
// Wait additional cycles to verify that intervals are really cancelled
timer.setTimeout(function () {
test.assertEqual(iframe.contentDocument.title, "final",
"New document has not been modified");
test.assertEqual(originalDocument.title, titleAfterLoad,
"Nor previous one");
test.done();
}, 100);
}, 100);

}, true);
Expand Down

0 comments on commit 27677ad

Please sign in to comment.