Bug 1270234 - Fix intermittent browser_bug664688_sandbox_update_after_navigation.js. r=bgrins

Page navigation triggers a chain of events that lead to the
console being cleared. If the stars are perfectly aligned,
the clear is triggered after |window.location.href| is executed
but before waitForMessages() looks at the existing messages
in the console. This causes the input line to be lost and
the test times out waiting for it.

These changes make the test to wait for the first clear to happen
before continuing the test.

MozReview-Commit-ID: LWuR8wxc5Lh

--HG--
extra : transplant_source : %9C%AE%A1b%FB%89%23o%CB%C6%3Ah%E1%27F%AD%FA%22%9A%EC
This commit is contained in:
Sami Jaktholm 2016-07-30 13:35:36 +03:00
parent 694cc3f78f
commit 53a89f1b4a

View File

@ -72,8 +72,14 @@ add_task(function* () {
is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
"no permission denied errors");
// Navigation clears messages. Wait for that clear to happen before
// continuing the test or it might destroy messages we wait later on (Bug
// 1270234).
let cleared = hud.jsterm.once("messages-cleared");
gBrowser.goBack();
info("Waiting for page to navigate");
yield waitForSuccess({
name: "go back",
validator: function () {
@ -81,10 +87,11 @@ add_task(function* () {
},
});
hud.jsterm.clearOutput();
executeSoon(() => {
hud.jsterm.execute("window.location.href");
});
info("Waiting for messages to be cleared due to navigation");
yield cleared;
info("Messages cleared after navigation; checking location");
hud.jsterm.execute("window.location.href");
info("wait for window.location.href after goBack()");
yield waitForMessages(msgForLocation1);