Bug 1270234 - Fix intermittent browser_bug664688_sandbox_update_after_navigation.js. r=bgrins
authorSami Jaktholm <sjakthol@outlook.com>
Sat, 30 Jul 2016 13:35:36 +0300
changeset 307828 2c625c92b5fcb9969b45966e34b266d5cf64e1e1
parent 307827 457ebb2b73adfed9dc9ff8c1ccaa38723471b59e
child 307829 5e776b32b7c22e24fcd6b1e71f38a9f0530b562d
push id31034
push usercbook@mozilla.com
push dateWed, 03 Aug 2016 15:09:36 +0000
treeherderautoland@8ceb6981305f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1270234
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
--- a/devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
+++ b/devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
@@ -67,27 +67,34 @@ add_task(function* () {
         category: CATEGORY_OUTPUT,
       },
     ],
   });
 
   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 () {
       return content.location.href == TEST_URI1;
     },
   });
 
-  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);
   is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
      "no permission denied errors");
 });