Bug 1371509 - fix issues with comparing window URIs in browser_auto_close_window.js, r=Felipe, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 09 Nov 2018 19:11:30 +0000
changeset 501156 0501846e98cbcdacfc662e50764401cb802fd8ba
parent 501155 a2ea2d92a10b09dedffb11e75a030fb5646936a6
child 501157 ffb714651e11e24e3c3e7f5ee5ecec48f29bf51a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, test-only
bugs1371509
milestone64.0
Bug 1371509 - fix issues with comparing window URIs in browser_auto_close_window.js, r=Felipe, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D11456
uriloader/exthandler/tests/mochitest/browser_auto_close_window.js
--- a/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js
+++ b/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js
@@ -47,36 +47,34 @@ add_task(async function setup() {
 add_task(async function simple_navigation() {
   // Tests that simple navigation gives us the right windowContext (that is,
   // the window that we're using).
   await BrowserTestUtils.withNewTab({ gBrowser, url: PAGE_URL }, async function(browser) {
     let dialogAppeared = promiseHelperAppDialog();
     await BrowserTestUtils.synthesizeMouseAtCenter("#regular_load", {}, browser);
     let windowContext = await dialogAppeared;
 
-    is(windowContext.gBrowser.selectedBrowser.currentURI.spec, PAGE_URL,
-       "got the right windowContext");
+    is(windowContext, browser.ownerGlobal, "got the right windowContext");
   });
 });
 
 // Given a browser pointing to download_page.html, clicks on the link that
 // opens with target="_blank" (i.e. a new tab) and ensures that we
 // automatically open and close that tab.
 async function testNewTab(browser) {
   let targetURL = browser.currentURI.spec;
   let dialogAppeared = promiseHelperAppDialog();
   let tabOpened = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen").then((event) => {
     return [ event.target, BrowserTestUtils.waitForTabClosing(event.target) ];
   });
 
   await BrowserTestUtils.synthesizeMouseAtCenter("#target_blank", {}, browser);
 
   let windowContext = await dialogAppeared;
-  is(windowContext.gBrowser.selectedBrowser.currentURI.spec, targetURL,
-     "got the right windowContext");
+  is(windowContext, browser.ownerGlobal, "got the right windowContext");
   let [ tab, closingPromise ] = await tabOpened;
   await closingPromise;
   is(tab.linkedBrowser, null, "tab was opened and closed");
 }
 
 add_task(async function target_blank() {
   // Tests that a link with target=_blank opens a new tab and closes it,
   // returning the window that we're using for navigation.
@@ -96,18 +94,17 @@ add_task(async function new_window() {
 
     await BrowserTestUtils.synthesizeMouseAtCenter("#new_window", {}, browser);
     let win = await windowOpened;
     // Now allow request to complete:
     fetch(SJS_URL + "?finish");
 
 
     let windowContext = await dialogAppeared;
-    is(windowContext.gBrowser.selectedBrowser.currentURI.spec, PAGE_URL,
-       "got the right windowContext");
+    is(windowContext, browser.ownerGlobal, "got the right windowContext");
 
     // The window should close on its own. If not, this test will time out.
     await BrowserTestUtils.domWindowClosed(win);
     ok(win.closed, "window was opened and closed");
   });
 });
 
 add_task(async function nested_window_opens() {