Bug 1496220 - 5. Pass explicit triggering principal in more places; r=jkt
☠☠ backed out by 47e77fc9d699 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Wed, 17 Oct 2018 16:12:40 +0000
changeset 500165 2c1353f4a3f554a95bcf73521b05ef4c0335f6e0
parent 500164 bc592bed0522e528eb713f24a639be4c299eb715
child 500166 8b15bab9cde939cc2f79e43e8e1890dae04f8ad3
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)
reviewersjkt
bugs1496220
milestone64.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 1496220 - 5. Pass explicit triggering principal in more places; r=jkt When defaulting to a null triggering principal, these tests would fail when loaded remotely. This patch adds explicit system triggering principal to the loadURI calls. Differential Revision: https://phabricator.services.mozilla.com/D8461
browser/components/payments/content/paymentDialogWrapper.js
toolkit/content/tests/chrome/bug304188_window.xul
toolkit/content/tests/chrome/bug360437_window.xul
toolkit/content/tests/chrome/findbar_entireword_window.xul
toolkit/content/tests/chrome/findbar_window.xul
--- a/browser/components/payments/content/paymentDialogWrapper.js
+++ b/browser/components/payments/content/paymentDialogWrapper.js
@@ -211,17 +211,19 @@ var paymentDialogWrapper = {
     this.mm.addMessageListener("paymentContentToChrome", this);
     this.mm.loadFrameScript("chrome://payments/content/paymentDialogFrameScript.js", true);
     // Until we have bug 1446164 and bug 1407418 we use form autofill's temporary
     // shim for data-localization* attributes.
     this.mm.loadFrameScript("chrome://formautofill/content/l10n.js", true);
     if (AppConstants.platform == "win") {
       this.frame.setAttribute("selectmenulist", "ContentSelectDropdown-windows");
     }
-    this.frame.loadURI("resource://payments/paymentRequest.xhtml");
+    this.frame.loadURI("resource://payments/paymentRequest.xhtml",
+                       { triggeringPrincipal:
+                           Services.scriptSecurityManager.getSystemPrincipal() });
 
     this.temporaryStore = {
       addresses: new TempCollection("addresses"),
       creditCards: new TempCollection("creditCards"),
     };
   },
 
   createShowResponse({
--- a/toolkit/content/tests/chrome/bug304188_window.xul
+++ b/toolkit/content/tests/chrome/bug304188_window.xul
@@ -47,17 +47,18 @@ find-menu appears in editor element whic
       let promise = ContentTask.spawn(gBrowser, null, async function() {
         return new Promise(resolve => {
           addEventListener("DOMContentLoaded", function listener() {
             removeEventListener("DOMContentLoaded", listener);
             resolve();
           });
         });
       });
-      gBrowser.loadURI("data:text/html;charset=utf-8,some%20random%20text");
+      gBrowser.loadURI("data:text/html;charset=utf-8,some%20random%20text",
+                       { triggeringPrincipal: window.document.nodePrincipal });
       await promise;
       await onDocumentLoaded();
     }
 
     async function onDocumentLoaded() {
       await ContentTask.spawn(gBrowser, null, async function() {
         var edsession = content.docShell.editingSession;
         edsession.makeWindowEditable(content, "html", false, true, false);
--- a/toolkit/content/tests/chrome/bug360437_window.xul
+++ b/toolkit/content/tests/chrome/bug360437_window.xul
@@ -47,17 +47,18 @@
       let promise = ContentTask.spawn(gBrowser, null, async function() {
         return new Promise(resolve => {
           addEventListener("DOMContentLoaded", function listener() {
             removeEventListener("DOMContentLoaded", listener);
             resolve();
           });
         });
       });
-      gBrowser.loadURI("data:text/html,<form><input id='input' type='text' value='text inside an input element'></form>");
+      gBrowser.loadURI("data:text/html,<form><input id='input' type='text' value='text inside an input element'></form>",
+                       { triggeringPrincipal: window.document.nodePrincipal });
       await promise;
       await onDocumentLoaded();
     }
 
     async function onDocumentLoaded() {
       gFindBar.onFindCommand();
 
       // Make sure the findfield is correctly focused on open
--- a/toolkit/content/tests/chrome/findbar_entireword_window.xul
+++ b/toolkit/content/tests/chrome/findbar_entireword_window.xul
@@ -127,17 +127,18 @@
       let promise = ContentTask.spawn(gBrowser, null, async function() {
         return new Promise(resolve => {
           addEventListener("DOMContentLoaded", function listener() {
             removeEventListener("DOMContentLoaded", listener);
             resolve();
           });
         });
       });
-      gBrowser.loadURI(kBaseURL + "/sample_entireword_" + testName + ".html");
+      gBrowser.loadURI(kBaseURL + "/sample_entireword_" + testName + ".html",
+                       { triggeringPrincipal: window.document.nodePrincipal });
       await promise;
       await onDocumentLoaded(testName);
     }
 
     async function onDocumentLoaded(testName) {
       let suite = kTests[testName];
       await testSimpleEntireWord(suite.testSimpleEntireWord);
       await testCaseSensitive(suite.testCaseSensitive);
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -86,17 +86,18 @@
       gFindBar.browser = gBrowser;
 
       // Tests delays the loading of a document for one second.
       await new Promise(resolve => setTimeout(resolve, 1000));
 
       let promise = BrowserTestUtils.browserLoaded(gBrowser);
       gBrowser.loadURI("data:text/html,<h2 id='h2'>" + SEARCH_TEXT +
         "</h2><h2><a href='" + SAMPLE_URL + "'>Link Test</a></h2><input id='text' type='text' value='" +
-        SAMPLE_TEXT + "'></input><input id='button' type='button'></input><img id='img' width='50' height='50'/>");
+        SAMPLE_TEXT + "'></input><input id='button' type='button'></input><img id='img' width='50' height='50'/>",
+        { triggeringPrincipal: window.document.nodePrincipal });
       await promise;
       await onDocumentLoaded();
     }
 
     async function onDocumentLoaded() {
       await testNormalFind();
       gFindBar.close();
       ok(gFindBar.hidden, "Failed to close findbar after testNormalFind");