Backed out changeset 98f7e296affd (bug 1186139) for failing mochitest-bc7. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 14 Mar 2016 21:01:24 +0100
changeset 288627 03dd7a6987eaf216d98ab38083596c642d53f53b
parent 288626 f40c7931cc6b15d929a5df9dc8cecffeda268439
child 288628 66fdeb1acce5a5c9ae04cd7ad676dad321a0284c
push id18174
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:44:58 +0000
treeherderfx-team@dd0baa33759d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1186139
milestone48.0a1
backs out98f7e296affd4ee31bd44053cea97b040080d494
Backed out changeset 98f7e296affd (bug 1186139) for failing mochitest-bc7. r=backout
browser/base/content/browser.js
browser/base/content/test/general/browser_bug550565.js
browser/modules/ContentLinkHandler.jsm
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3357,17 +3357,17 @@ const DOMLinkHandler = {
   receiveMessage: function (aMsg) {
     switch (aMsg.name) {
       case "Link:AddFeed":
         let link = {type: aMsg.data.type, href: aMsg.data.href, title: aMsg.data.title};
         FeedHandler.addFeed(link, aMsg.target);
         break;
 
       case "Link:SetIcon":
-        this.setIcon(aMsg.target, aMsg.data.url, aMsg.data.loadingPrincipal);
+        return this.setIcon(aMsg.target, aMsg.data.url, aMsg.data.loadingPrincipal);
         break;
 
       case "Link:AddSearch":
         this.addSearch(aMsg.target, aMsg.data.engine, aMsg.data.url);
         break;
     }
   },
 
--- a/browser/base/content/test/general/browser_bug550565.js
+++ b/browser/base/content/test/general/browser_bug550565.js
@@ -1,44 +1,21 @@
-add_task(function* test() {
+function test() {
+  waitForExplicitFinish();
+
   let testPath = getRootDirectory(gTestPath);
 
-  yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" },
-    function* (tabBrowser) {
-      const URI = testPath + "file_with_favicon.html";
-      const expectedIcon = testPath + "file_generic_favicon.ico";
+  let tab = gBrowser.addTab(testPath + "file_with_favicon.html");
 
-      let got_favicon = Promise.defer();
-      let listener = {
-        onLinkIconAvailable(browser, iconURI) {
-          if (got_favicon && iconURI && browser === tabBrowser) {
-            got_favicon.resolve(iconURI);
-            got_favicon = null;
-          }
-        }
-      };
-      gBrowser.addTabsProgressListener(listener);
+  tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
+    tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
 
-      BrowserTestUtils.loadURI(tabBrowser, URI);
-
-      let iconURI = yield got_favicon.promise;
-      is(iconURI, expectedIcon, "Correct icon before pushState.");
+    let expectedIcon = testPath + "file_generic_favicon.ico";
 
-      got_favicon = Promise.defer();
-      got_favicon.promise.then(() => { ok(false, "shouldn't be called"); }, (e) => e);
-      yield ContentTask.spawn(tabBrowser, null, function() {
-        content.history.pushState("page2", "page2", "page2");
-      });
+    is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before pushState.");
+    tab.linkedBrowser.contentWindow.history.pushState("page2", "page2", "page2");
+    is(gBrowser.getIcon(tab), expectedIcon, "Correct icon after pushState.");
 
-      // We've navigated and shouldn't get a call to onLinkIconAvailable.
-      TestUtils.executeSoon(() => {
-        got_favicon.reject(gBrowser.getIcon(gBrowser.getTabForBrowser(tabBrowser)));
-      });
-      try {
-        yield got_favicon.promise;
-      } catch (e) {
-        iconURI = e;
-      }
-      is(iconURI, expectedIcon, "Correct icon after pushState.");
+    gBrowser.removeTab(tab);
 
-      gBrowser.removeTabsProgressListener(listener);
-    });
-});
+    finish();
+  }, true);
+}
--- a/browser/modules/ContentLinkHandler.jsm
+++ b/browser/modules/ContentLinkHandler.jsm
@@ -66,56 +66,57 @@ this.ContentLinkHandler = {
                                             {type: link.type,
                                              href: link.href,
                                              title: link.title});
               feedAdded = true;
             }
           }
           break;
         case "icon":
-          if (iconAdded || !Services.prefs.getBoolPref("browser.chrome.site_icons"))
-            break;
+          if (!iconAdded) {
+            if (!Services.prefs.getBoolPref("browser.chrome.site_icons"))
+              break;
 
-          var uri = this.getLinkIconURI(link);
-          if (!uri)
-            break;
+            var uri = this.getLinkIconURI(link);
+            if (!uri)
+              break;
 
-          // Telemetry probes for measuring the sizes attribute
-          // usage and available dimensions.
-          let sizeHistogramTypes = Services.telemetry.
-                                   getHistogramById("LINK_ICON_SIZES_ATTR_USAGE");
-          let sizeHistogramDimension = Services.telemetry.
-                                       getHistogramById("LINK_ICON_SIZES_ATTR_DIMENSION");
-          let sizesType;
-          if (link.sizes.length) {
-            for (let size of link.sizes) {
-              if (size.toLowerCase() == "any") {
-                sizesType = SIZES_TELEMETRY_ENUM.ANY;
-                break;
-              } else {
-                let re = /^([1-9][0-9]*)x[1-9][0-9]*$/i;
-                let values = re.exec(size);
-                if (values && values.length > 1) {
-                  sizesType = SIZES_TELEMETRY_ENUM.DIMENSION;
-                  sizeHistogramDimension.add(parseInt(values[1]));
+            // Telemetry probes for measuring the sizes attribute
+            // usage and available dimensions.
+            let sizeHistogramTypes = Services.telemetry.
+                                     getHistogramById("LINK_ICON_SIZES_ATTR_USAGE");
+            let sizeHistogramDimension = Services.telemetry.
+                                         getHistogramById("LINK_ICON_SIZES_ATTR_DIMENSION");
+            let sizesType;
+            if (link.sizes.length) {
+              for (let size of link.sizes) {
+                if (size.toLowerCase() == "any") {
+                  sizesType = SIZES_TELEMETRY_ENUM.ANY;
+                  break;
                 } else {
-                  sizesType = SIZES_TELEMETRY_ENUM.INVALID;
-                  break;
+                  let re = /^([1-9][0-9]*)x[1-9][0-9]*$/i;
+                  let values = re.exec(size);
+                  if (values && values.length > 1) {
+                    sizesType = SIZES_TELEMETRY_ENUM.DIMENSION;
+                    sizeHistogramDimension.add(parseInt(values[1]));
+                  } else {
+                    sizesType = SIZES_TELEMETRY_ENUM.INVALID;
+                    break;
+                  }
                 }
               }
+            } else {
+              sizesType = SIZES_TELEMETRY_ENUM.NO_SIZES;
             }
-          } else {
-            sizesType = SIZES_TELEMETRY_ENUM.NO_SIZES;
+            sizeHistogramTypes.add(sizesType);
+
+            [iconAdded] = chromeGlobal.sendSyncMessage(
+                            "Link:SetIcon",
+                            {url: uri.spec, loadingPrincipal: link.ownerDocument.nodePrincipal});
           }
-          sizeHistogramTypes.add(sizesType);
-
-          chromeGlobal.sendAsyncMessage(
-            "Link:SetIcon",
-            {url: uri.spec, loadingPrincipal: link.ownerDocument.nodePrincipal});
-          iconAdded = true;
           break;
         case "search":
           if (!searchAdded && event.type == "DOMLinkAdded") {
             var type = link.type && link.type.toLowerCase();
             type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
 
             let re = /^(?:https?|ftp):/i;
             if (type == "application/opensearchdescription+xml" && link.title &&