Bug 1374741 - Within browser/ tests make openUILinkIn() provide the correct triggeringPrincipal. r?gijs draft
authorJonathan Kingston <jkt@mozilla.com>
Wed, 21 Feb 2018 14:49:24 +0000
changeset 779221 04af342abe042e18c8115c6f3b22010ad51a7eff
parent 779220 f0f54f8cbccc1d08672430c981705404877e14dd
child 779222 bfe313b328687c033deb1fde2721b9351cf0bd16
child 779228 ed9fa5e528b444941cddbffa871a07204db2a4bb
child 779238 e03ca048fac1927d60b1d4aeda6224a1bdd99624
child 779248 537dbcbc5c1cb1237c394809ed05d2503db83d7b
child 779251 46bd72f4df7e064502ee1f6f9c66442374bc76d9
child 779507 893d6f5e01652cefdecd07dc0f5aa5cbb68e81c5
push id105703
push userbmo:jkt@mozilla.com
push dateMon, 09 Apr 2018 14:09:22 +0000
reviewersgijs
bugs1374741
milestone61.0a1
Bug 1374741 - Within browser/ tests make openUILinkIn() provide the correct triggeringPrincipal. r?gijs MozReview-Commit-ID: 9tJ0b056yNE
browser/base/content/test/general/browser_bug579872.js
browser/base/content/test/general/browser_bug594131.js
browser/base/content/test/general/browser_contentSearchUI.js
browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
browser/base/content/test/tabs/browser_abandonment_telemetry.js
--- a/browser/base/content/test/general/browser_bug579872.js
+++ b/browser/base/content/test/general/browser_bug579872.js
@@ -6,23 +6,23 @@ function test() {
   let newTab = BrowserTestUtils.addTab(gBrowser);
   waitForExplicitFinish();
   BrowserTestUtils.browserLoaded(newTab.linkedBrowser).then(mainPart);
 
   function mainPart() {
     gBrowser.pinTab(newTab);
     gBrowser.selectedTab = newTab;
 
-    openUILinkIn("javascript:var x=0;", "current");
+    openTrustedLinkIn("javascript:var x=0;", "current");
     is(gBrowser.tabs.length, 2, "Should open in current tab");
 
-    openUILinkIn("http://example.com/1", "current");
+    openTrustedLinkIn("http://example.com/1", "current");
     is(gBrowser.tabs.length, 2, "Should open in current tab");
 
-    openUILinkIn("http://example.org/", "current");
+    openTrustedLinkIn("http://example.org/", "current");
     is(gBrowser.tabs.length, 3, "Should open in new tab");
 
     gBrowser.removeTab(newTab);
     gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
     finish();
   }
   newTab.linkedBrowser.loadURI("http://example.com");
 }
--- a/browser/base/content/test/general/browser_bug594131.js
+++ b/browser/base/content/test/general/browser_bug594131.js
@@ -6,16 +6,18 @@ function test() {
   let newTab = BrowserTestUtils.addTab(gBrowser, "http://example.com");
   waitForExplicitFinish();
   BrowserTestUtils.browserLoaded(newTab.linkedBrowser).then(mainPart);
 
   function mainPart() {
     gBrowser.pinTab(newTab);
     gBrowser.selectedTab = newTab;
 
-    openUILinkIn("http://example.org/", "current", { inBackground: true });
+    openTrustedLinkIn("http://example.org/", "current", {
+      inBackground: true,
+    });
     isnot(gBrowser.selectedTab, newTab, "shouldn't load in background");
 
     gBrowser.removeTab(newTab);
     gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
     finish();
   }
 }
--- a/browser/base/content/test/general/browser_contentSearchUI.js
+++ b/browser/base/content/test/general/browser_contentSearchUI.js
@@ -711,17 +711,17 @@ async function promiseTab() {
       data: [pageURL],
     });
     promiseMsg("ContentSearch", "AddToWhitelistAck", gMsgMan).then(() => {
       let jsURL = getRootDirectory(gTestPath) + TEST_CONTENT_SCRIPT_BASENAME;
       gMsgMan.loadFrameScript(jsURL, false);
       deferred.resolve(msg("init"));
     });
   }, true, true);
-  openUILinkIn(pageURL, "current");
+  openTrustedLinkIn(pageURL, "current");
   return deferred.promise;
 }
 
 function promiseMsg(name, type, msgMan) {
   return new Promise(resolve => {
     info("Waiting for " + name + " message " + type + "...");
     msgMan.addMessageListener(name, function onMsg(msgObj) {
       info("Received " + name + " message " + msgObj.data.type + "\n");
--- a/browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
+++ b/browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
@@ -33,17 +33,19 @@ add_task(async function test_remoteWebNa
     let path = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort + "/test";
 
     let postdata =
       "Content-Length: 7\r\n" +
       "Content-Type: application/x-www-form-urlencoded\r\n" +
       "\r\n" +
       "success";
 
-    openUILinkIn(path, "tab", null, makeInputStream(postdata));
-
+    openTrustedLinkIn(path, "tab", {
+       allowThirdPartyFixup: null,
+       postData: makeInputStream(postdata),
+     });
   });
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 
   await new Promise(resolve => {
     server.stop(function() { resolve(); });
   });
 });
--- a/browser/base/content/test/tabs/browser_abandonment_telemetry.js
+++ b/browser/base/content/test/tabs/browser_abandonment_telemetry.js
@@ -181,17 +181,17 @@ const PROBE_TESTS = [
   {
     name: "Browsing to a new URL",
 
     category: "newURI",
 
     prepare(browser) {},
 
     async doAction(browser) {
-      openUILinkIn(PAGE_2, "current");
+      openTrustedLinkIn(PAGE_2, "current");
       await BrowserTestUtils.browserLoaded(browser);
     },
   },
 ];
 
 /**
  * Takes a Telemetry histogram snapshot and makes sure
  * that the index for that value (as defined by CATEGORIES)