Bug 1264735 - Restore code to ignore about:blank loads for tab browser loaded. r=felipc
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 20 Apr 2016 16:02:00 +0200
changeset 331979 252417bdd33d5224a90a37043469592632e5cbc7
parent 331978 4ac3b4265ce2205bab28de9f09da31379e23b785
child 331980 baa84a5b4465238deaf0eb1ba28ec7fd38154ef6
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipc
bugs1264735
milestone48.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 1264735 - Restore code to ignore about:blank loads for tab browser loaded. r=felipc
browser/base/content/test/general/head.js
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -606,19 +606,29 @@ var FullZoomHelper = {
  * @resolves to the received event
  * @rejects if a valid load event is not received within a meaningful interval
  */
 function promiseTabLoadEvent(tab, url)
 {
   let deferred = Promise.defer();
   info("Wait tab event: load");
 
+  function handle(loadedUrl) {
+    if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
+      info(`Skipping spurious load event for ${loadedUrl}`);
+      return false;
+    }
+
+    info("Tab event received: load");
+    return true;
+  }
+
   // Create two promises: one resolved from the content process when the page
   // loads and one that is rejected if we take too long to load the url.
-  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url);
+  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
 
   let timeout = setTimeout(() => {
     deferred.reject(new Error("Timed out while waiting for a 'load' event"));
   }, 30000);
 
   loaded.then(() => {
     clearTimeout(timeout);
     deferred.resolve()