Bug 1330822 - Remove CPOWs from browser_favicon_change.js. r=Felipe draft
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 15 Nov 2016 15:11:13 -0800
changeset 463352 384a35d9435b05e43cdf52a838d1360091f2ac4e
parent 463351 62c690f5daf4fbe6cfbe925ae3e87d76a8ecdc63
child 463353 db4c23ee29428c105040e352d8788ed2cae57857
push id42038
push userbmo:mrbkap@mozilla.com
push dateWed, 18 Jan 2017 23:45:52 +0000
reviewersFelipe
bugs1330822
milestone53.0a1
Bug 1330822 - Remove CPOWs from browser_favicon_change.js. r=Felipe
browser/base/content/test/general/browser_favicon_change.js
--- a/browser/base/content/test/general/browser_favicon_change.js
+++ b/browser/base/content/test/general/browser_favicon_change.js
@@ -2,18 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_favicon_change.html"
 
 add_task(function*() {
   let extraTab = gBrowser.selectedTab = gBrowser.addTab();
-  let tabLoaded = promiseTabLoaded(extraTab);
   extraTab.linkedBrowser.loadURI(TEST_URL);
+  let tabLoaded = BrowserTestUtils.browserLoaded(extraTab.linkedBrowser);
   let expectedFavicon = "http://example.org/one-icon";
   let haveChanged = new Promise.defer();
   let observer = new MutationObserver(function(mutations) {
     for (let mut of mutations) {
       if (mut.attributeName != "image") {
         continue;
       }
       let imageVal = extraTab.getAttribute("image").replace(/#.*$/, "");
@@ -25,16 +25,17 @@ add_task(function*() {
       haveChanged.resolve();
     }
   });
   observer.observe(extraTab, {attributes: true});
   yield tabLoaded;
   yield haveChanged.promise;
   haveChanged = new Promise.defer();
   expectedFavicon = "http://example.org/other-icon";
-  let contentWin = extraTab.linkedBrowser.contentWindow;
-  let ev = new contentWin.CustomEvent("PleaseChangeFavicon", {});
-  contentWin.dispatchEvent(ev);
+  ContentTask.spawn(extraTab.linkedBrowser, null, function() {
+    let ev = new content.CustomEvent("PleaseChangeFavicon", {});
+    content.dispatchEvent(ev);
+  });
   yield haveChanged.promise;
   observer.disconnect();
   gBrowser.removeTab(extraTab);
 });