Bug 1420610 - Check if url loaded within newTabPromise to resolve timeouts. r=gijs
authorTanvi Vyas <tanvi@mozilla.com>
Wed, 13 Dec 2017 15:55:00 +0200
changeset 396739 e3d4a5930118af61fa56b720a190ede07d184462
parent 396738 67986543a6bf280f3c960756e9e9a573d3caf09c
child 396740 fb2acbf403de48072409030e72ad61edbed9f803
push id33110
push userrgurzau@mozilla.com
push dateMon, 18 Dec 2017 21:58:12 +0000
treeherdermozilla-central@7c4579e705c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1420610
milestone59.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 1420610 - Check if url loaded within newTabPromise to resolve timeouts. r=gijs
browser/components/contextualidentity/test/browser/browser_usercontextid_tabdrop.js
--- a/browser/components/contextualidentity/test/browser/browser_usercontextid_tabdrop.js
+++ b/browser/components/contextualidentity/test/browser/browser_usercontextid_tabdrop.js
@@ -6,17 +6,17 @@ Services.scriptloader.loadSubScript("chr
 /**
  * Dragging an URL to a tab without userContextId set.
  */
 add_task(async function() {
   let tab = BrowserTestUtils.addTab(gBrowser, "http://example.com/");
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   let awaitDrop = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "drop");
-  let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://test1.example.com/");
+  let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://test1.example.com/", true);
 
   // A drop type of "link" onto an existing tab would normally trigger a
   // load in that same tab, but tabbrowser code in _getDragTargetTab treats
   // drops on the outer edges of a tab differently (loading a new tab
   // instead). Make events created by synthesizeDrop have all of their
   // coordinates set to 0 (screenX/screenY), so they're treated as drops
   // on the outer edge of the tab, thus they open new tabs.
   let event = {
@@ -27,18 +27,16 @@ add_task(async function() {
   };
   EventUtils.synthesizeDrop(tab, tab, [[{type: "text/plain", data: "http://test1.example.com/"}]], "link", window, undefined, event);
 
   await awaitDrop;
 
   let tab2 = await newTabPromise;
   Assert.ok(!tab2.hasAttribute("usercontextid"), "Tab shouldn't have usercontextid attribute");
 
-  await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
-
   await ContentTask.spawn(tab2.linkedBrowser, {}, async function() {
     Assert.equal(content.document.documentURI, "http://test1.example.com/");
     Assert.equal(content.document.nodePrincipal.originAttributes.userContextId, 0);
 
     // referrer is empty when urls are dragged to new or existing tabs.
     // If this changes in the future, it would be okay to send the referrer
     // in this case because we are creating a new tab with the default
     // usercontextid as the original tab.
@@ -53,17 +51,17 @@ add_task(async function() {
  * When dragging an URL to a new tab, the new tab should have the same
  * userContextId as the original tab.
  */
 add_task(async function() {
   let tab = BrowserTestUtils.addTab(gBrowser, "http://example.com/", {userContextId: 1});
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   let awaitDrop = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "drop");
-  let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://test1.example.com/");
+  let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://test1.example.com/", true);
 
   // A drop type of "link" onto an existing tab would normally trigger a
   // load in that same tab, but tabbrowser code in _getDragTargetTab treats
   // drops on the outer edges of a tab differently (loading a new tab
   // instead). Make events created by synthesizeDrop have all of their
   // coordinates set to 0 (screenX/screenY), so they're treated as drops
   // on the outer edge of the tab, thus they open new tabs.
   let event = {
@@ -74,18 +72,16 @@ add_task(async function() {
   };
   EventUtils.synthesizeDrop(tab, tab, [[{type: "text/plain", data: "http://test1.example.com/"}]], "link", window, undefined, event);
 
   await awaitDrop;
 
   let tab2 = await newTabPromise;
   Assert.equal(tab2.getAttribute("usercontextid"), 1);
 
-  await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
-
   await ContentTask.spawn(tab2.linkedBrowser, {}, async function() {
     Assert.equal(content.document.documentURI, "http://test1.example.com/");
     Assert.equal(content.document.nodePrincipal.originAttributes.userContextId, 1);
 
     // referrer is empty when urls are dragged to new or existing tabs.
     // If this changes in the future, it would be okay to send the referrer
     // in this case because we are creating a new tab with the same
     // usercontextid as the original tab.