Bug 1485305 - toolkit/ Ensure loadURI always passes a triggeringPrincipal() r=Mossop
☠☠ backed out by 64c64fc5e163 ☠ ☠
authorJonathan Kingston <jkt@mozilla.com>
Wed, 29 Aug 2018 15:49:12 +0100
changeset 492771 63c50fd60ae4d343533a4b5541489d706409a230
parent 492770 bf0f2adb765ea00225a630307aa1aa659d7555d9
child 492772 2109849fe8e987f84486ab9d35c6597fc1798867
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1485305
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 1485305 - toolkit/ Ensure loadURI always passes a triggeringPrincipal() r=Mossop Differential Revision: https://phabricator.services.mozilla.com/D4563
toolkit/actors/WebNavigationChild.jsm
toolkit/components/extensions/ExtensionParent.jsm
toolkit/components/extensions/ExtensionXPCShellUtils.jsm
toolkit/components/mozprotocol/tests/browser_mozprotocol.js
toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js
toolkit/components/passwordmgr/test/browser/browser_passwordmgr_switchtab.js
toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
toolkit/components/places/tests/browser/browser_bug399606.js
toolkit/components/places/tests/browser/browser_favicon_privatebrowsing_perwindowpb.js
toolkit/components/places/tests/browser/browser_visited_notfound.js
toolkit/components/places/tests/browser/browser_visituri_nohistory.js
toolkit/components/reader/test/browser_readerMode.js
toolkit/components/reader/test/browser_readerMode_hidden_nodes.js
toolkit/components/remotebrowserutils/RemoteWebNavigation.js
toolkit/components/remotepagemanager/tests/browser/browser_RemotePageManager.js
toolkit/components/thumbnails/test/head.js
toolkit/components/url-classifier/tests/mochitest/test_donottrack.html
toolkit/components/url-classifier/tests/mochitest/test_privatebrowsing_trackingprotection.html
toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html
toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1312515.html
toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_whitelist.html
toolkit/components/viewsource/content/viewSource-content.js
toolkit/content/tests/browser/browser_audioCompeting.js
toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js
toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
toolkit/content/tests/browser/browser_autoplay_policy_iframe_hierarchy.js
toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js
toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js
toolkit/content/tests/browser/browser_autoscroll_disabled.js
toolkit/content/tests/browser/browser_block_autoplay_media.js
toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
toolkit/content/tests/browser/browser_block_multipleMedia.js
toolkit/content/tests/browser/browser_block_notInTreeAudio.js
toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
toolkit/content/tests/browser/browser_block_plugIn.js
toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
toolkit/content/tests/browser/browser_block_webAudio.js
toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
toolkit/content/tests/browser/browser_content_url_annotation.js
toolkit/content/tests/browser/browser_isSynthetic.js
toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
toolkit/content/tests/browser/browser_mediaPlayback.js
toolkit/content/tests/browser/browser_mediaPlayback_mute.js
toolkit/content/tests/browser/browser_mediaPlayback_suspended.js
toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js
toolkit/content/tests/browser/browser_mute_plugIn.js
toolkit/content/tests/browser/browser_mute_webAudio.js
toolkit/content/tests/browser/browser_resume_bkg_video_on_tab_hover.js
toolkit/content/tests/browser/browser_save_resend_postdata.js
toolkit/content/tests/browser/browser_sound_indicator_silent_video.js
--- a/toolkit/actors/WebNavigationChild.jsm
+++ b/toolkit/actors/WebNavigationChild.jsm
@@ -102,16 +102,19 @@ class WebNavigationChild extends ActorCh
     if (postData)
       postData = Utils.makeInputStream(postData);
     if (headers)
       headers = Utils.makeInputStream(headers);
     if (baseURI)
       baseURI = Services.io.newURI(baseURI);
     if (triggeringPrincipal)
       triggeringPrincipal = Utils.deserializePrincipal(triggeringPrincipal);
+    if (!triggeringPrincipal) {
+      triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal({});
+    }
     this._wrapURIChangeCall(() => {
       return this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
                                                    postData, headers, baseURI, triggeringPrincipal);
     });
   }
 
   setOriginAttributes(originAttributes) {
     if (originAttributes) {
--- a/toolkit/components/extensions/ExtensionParent.jsm
+++ b/toolkit/components/extensions/ExtensionParent.jsm
@@ -1107,17 +1107,17 @@ class HiddenXULWindow {
       let attrs = this.chromeShell.getOriginAttributes();
       attrs.privateBrowsingId = 1;
       this.chromeShell.setOriginAttributes(attrs);
     }
 
     let system = Services.scriptSecurityManager.getSystemPrincipal();
     this.chromeShell.createAboutBlankContentViewer(system);
     this.chromeShell.useGlobalHistory = false;
-    this.chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null);
+    this.chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null, system);
 
     await promiseObserved("chrome-document-global-created",
                           win => win.document == this.chromeShell.document);
     return promiseDocumentLoaded(windowlessBrowser.document);
   }
 
   /**
    * Creates the browser XUL element that will contain the WebExtension Page.
--- a/toolkit/components/extensions/ExtensionXPCShellUtils.jsm
+++ b/toolkit/components/extensions/ExtensionXPCShellUtils.jsm
@@ -126,17 +126,17 @@ class ContentPage {
 
     let system = Services.scriptSecurityManager.getSystemPrincipal();
 
     let chromeShell = this.windowlessBrowser.docShell
                           .QueryInterface(Ci.nsIWebNavigation);
 
     chromeShell.createAboutBlankContentViewer(system);
     chromeShell.useGlobalHistory = false;
-    chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null);
+    chromeShell.loadURI("chrome://extensions/content/dummy.xul", 0, null, null, null, system);
 
     await promiseObserved("chrome-document-global-created",
                           win => win.document == chromeShell.document);
 
     let chromeDoc = await promiseDocumentLoaded(chromeShell.document);
 
     let browser = chromeDoc.createElement("browser");
     browser.setAttribute("type", "content");
@@ -177,17 +177,19 @@ class ContentPage {
   addFrameScriptHelper(func) {
     let frameScript = `data:text/javascript,${encodeURI(func)}`;
     this.browser.messageManager.loadFrameScript(frameScript, false, true);
   }
 
   async loadURL(url, redirectUrl = undefined) {
     await this.browserReady;
 
-    this.browser.loadURI(url);
+    this.browser.loadURI(url, {
+      triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
+    });
     return promiseBrowserLoaded(this.browser, url, redirectUrl);
   }
 
   async fetch(url, options) {
     return this.sendMessage("Test:Fetch", {url, options});
   }
 
   spawn(params, task) {
--- a/toolkit/components/mozprotocol/tests/browser_mozprotocol.js
+++ b/toolkit/components/mozprotocol/tests/browser_mozprotocol.js
@@ -1,14 +1,14 @@
 // Check that entering moz://a into the address bar directs us to a new url
 add_task(async function() {
   let path = getRootDirectory(gTestPath).substring("chrome://mochitests/content/".length);
   await SpecialPowers.pushPrefEnv({
     set: [["toolkit.mozprotocol.url", `https://example.com/${path}mozprotocol.html`]],
   });
 
   await BrowserTestUtils.withNewTab("about:blank", async function() {
-    gBrowser.loadURI("moz://a");
+    BrowserTestUtils.loadURI(gBrowser, "moz://a");
     await BrowserTestUtils.waitForLocationChange(gBrowser,
       `https://example.com/${path}mozprotocol.html`);
     ok(true, "Made it to the expected page");
   });
 });
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
@@ -76,17 +76,17 @@ function task(contentIds) {
 
   return promise;
 }
 
 add_task(async function() {
   let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
 
   let promise = ContentTask.spawn(tab.linkedBrowser, ids, task);
-  tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
+  BrowserTestUtils.loadURI(tab.linkedBrowser, "data:text/html;charset=utf-8," +
                             "<html><body>" +
                             "<form id='" + ids.FORM1_ID + "'>" +
                             "<input id='" + ids.CHANGE_INPUT_ID + "'></form>" +
                             "<form id='" + ids.FORM2_ID + "'></form>" +
                             "</body></html>");
   await promise;
 
   ok(true, "Test completed");
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
@@ -82,17 +82,17 @@ function task(contentConsts) {
   }
 
   return promise;
 }
 
 add_task(async function() {
   let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
   let promise = ContentTask.spawn(tab.linkedBrowser, consts, task);
-  tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
+  BrowserTestUtils.loadURI(tab.linkedBrowser, "data:text/html;charset=utf-8," +
                             "<html><body>" +
                             "<form id='" + consts.FORM1_ID + "'>" +
                             "<input id='" + consts.CHANGE_INPUT_ID + "'></form>" +
                             "<form id='" + consts.FORM2_ID + "'></form>" +
                             "</body></html>");
   await promise;
   gBrowser.removeCurrentTab();
 });
--- a/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_formless_submit_chrome.js
@@ -52,17 +52,17 @@ add_task(async function test_urlbar_frag
     EventUtils.sendString("#fragment");
     EventUtils.synthesizeKey("KEY_Enter");
   });
 });
 
 add_task(async function test_backButton_forwardButton() {
   await withTestPage(async function(aBrowser) {
     // Load a new page in the tab so we can test going back
-    aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
+    BrowserTestUtils.loadURI(aBrowser, "https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
     await BrowserTestUtils.browserLoaded(aBrowser, false,
                                          "https://example.com" + DIRECTORY_PATH +
                                          "formless_basic.html?second");
     await fillTestPage(aBrowser);
 
     let forwardButton = document.getElementById("forward-button");
 
     let forwardTransitionPromise;
@@ -116,17 +116,17 @@ add_task(async function test_reloadButto
 
 add_task(async function test_back_keyboard_shortcut() {
   if (Services.prefs.getIntPref("browser.backspace_action") != 0) {
     ok(true, "Skipped testing backspace to go back since it's disabled");
     return;
   }
   await withTestPage(async function(aBrowser) {
     // Load a new page in the tab so we can test going back
-    aBrowser.loadURI("https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
+    BrowserTestUtils.loadURI(aBrowser, "https://example.com" + DIRECTORY_PATH + "formless_basic.html?second");
     await BrowserTestUtils.browserLoaded(aBrowser, false,
                                          "https://example.com" + DIRECTORY_PATH +
                                          "formless_basic.html?second");
     await fillTestPage(aBrowser);
 
     let backPromise = BrowserTestUtils.browserStopped(aBrowser);
     EventUtils.synthesizeKey("KEY_Backspace");
     await backPromise;
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_switchtab.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_switchtab.js
@@ -29,12 +29,12 @@ add_task(async function test() {
 
   Services.wm.addListener(listener);
   registerCleanupFunction(() => {
     Services.wm.removeListener(listener);
     gBrowser.removeTab(tab);
   });
 
   BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => finish());
-  tab.linkedBrowser.loadURI("http://example.com/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs");
+  BrowserTestUtils.loadURI(tab.linkedBrowser, "http://example.com/browser/toolkit/components/passwordmgr/test/browser/authenticate.sjs");
 
   });
 });
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -208,28 +208,28 @@ function whenDelayedStartupFinished(aWin
 }
 
 function testOnWindow(aIsPrivate, aCallback) {
   var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
   win.addEventListener("load", function() {
     whenDelayedStartupFinished(win, function() {
       win.addEventListener("DOMContentLoaded", function onInnerLoad() {
         if (win.content.location.href != contentPage) {
-          win.gBrowser.loadURI(contentPage);
+          BrowserTestUtils.loadURI(win.gBrowser, contentPage);
           return;
         }
         win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
         win.content.addEventListener("load", function innerLoad2() {
           win.content.removeEventListener("load", innerLoad2);
           testWindows.push(win);
           SimpleTest.executeSoon(function() { aCallback(win); });
         }, false, true);
       }, true);
-      SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
+      SimpleTest.executeSoon(function() { BrowserTestUtils.loadURI(win.gBrowser, contentPage); });
     });
   }, {capture: true, once: true});
 }
 
 var ignoreLoad = false;
 function handleLoad(aEvent) {
   // ignore every other load event ... We get one for loading the subtest (which
   // we want to ignore), and another when the subtest's form submits itself
--- a/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
@@ -209,17 +209,17 @@ add_task(async function test() {
 
   let newTab = BrowserTestUtils.addTab(gBrowser);
   let browser = newTab.linkedBrowser;
   // Setup monitoring in the tab
   info("Setting up monitoring in the tab");
   await ContentTask.spawn(newTab.linkedBrowser, null, frameScript);
 
   info("Opening URL");
-  newTab.linkedBrowser.loadURI(URL);
+  BrowserTestUtils.loadURI(newTab.linkedBrowser, URL);
 
   if (Services.sysinfo.getPropertyAsAString("name") == "Windows_NT") {
     info("Deactivating sanity checks under Windows (bug 1151240)");
   } else {
     info("Setting up sanity checks");
     monotinicity_tester(() => monitor.promiseSnapshot().then(snapshot => ({snapshot, pid: PARENT_PID})), "parent process");
     monotinicity_tester(() => promiseContentResponseOrNull(browser, "compartments-test:getStatistics", null), "content process" );
   }
--- a/toolkit/components/places/tests/browser/browser_bug399606.js
+++ b/toolkit/components/places/tests/browser/browser_bug399606.js
@@ -26,17 +26,17 @@ add_task(async function() {
     }
   }
 
   async function promiseLoadedThreeTimes(uri) {
     count = 0;
     expectedURI = uri;
     let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
     PlacesObservers.addListener(["page-visited"], onVisitsListener);
-    gBrowser.loadURI(uri);
+    BrowserTestUtils.loadURI(gBrowser, uri);
     await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
     await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
     await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uri);
     PlacesObservers.removeListener(["page-visited"], onVisitsListener);
     BrowserTestUtils.removeTab(tab);
   }
 
   for (let uri of URIS) {
--- a/toolkit/components/places/tests/browser/browser_favicon_privatebrowsing_perwindowpb.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_privatebrowsing_perwindowpb.js
@@ -19,17 +19,17 @@ function test() {
     whenNewWindowLoaded({private: aIsPrivate}, function(aWin) {
       windowsToClose.push(aWin);
       executeSoon(() => aCallback(aWin));
     });
   }
 
   function waitForTabLoad(aWin, aCallback) {
     BrowserTestUtils.browserLoaded(aWin.gBrowser.selectedBrowser).then(aCallback);
-    aWin.gBrowser.selectedBrowser.loadURI(pageURI);
+    BrowserTestUtils.loadURI(aWin.gBrowser.selectedBrowser, pageURI);
   }
 
   testOnWindow(true, function(win) {
     waitForTabLoad(win, function() {
       PlacesUtils.favicons.getFaviconURLForPage(NetUtil.newURI(pageURI),
         function(uri, dataLen, data, mimeType) {
           is(uri, null, "No result should be found");
           finish();
--- a/toolkit/components/places/tests/browser/browser_visited_notfound.js
+++ b/toolkit/components/places/tests/browser/browser_visited_notfound.js
@@ -24,15 +24,15 @@ add_task(async function test() {
       PlacesObservers.removeListener(["page-visited"], onVisits);
       is(events.length, 1, "Right number of visits");
       is(events[0].type, "page-visited");
       is(events[0].url, TEST_URL, "Check visited url");
       resolve();
     }
     PlacesObservers.addListener(["page-visited"], onVisits);
   });
-  gBrowser.selectedBrowser.loadURI(TEST_URL);
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URL);
   await promiseVisit;
 
   is(await PlacesTestUtils.fieldInDB(TEST_URL, "frecency"), frecency, "Frecency should be unchanged");
   is(await PlacesTestUtils.fieldInDB(TEST_URL, "hidden"), 0, "Page should not be hidden");
   is(await PlacesTestUtils.fieldInDB(TEST_URL, "typed"), 0, "page should not be marked as typed");
 });
--- a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js
@@ -23,17 +23,17 @@ add_task(async function() {
 
   let visitUriPromise = promiseObserve("uri-visit-saved");
 
   await BrowserTestUtils.openNewForegroundTab(gBrowser, INITIAL_URL);
 
   await SpecialPowers.popPrefEnv();
 
   let browserLoadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-  gBrowser.loadURI(FINAL_URL);
+  BrowserTestUtils.loadURI(gBrowser, FINAL_URL);
   await browserLoadedPromise;
 
   let subject = await visitUriPromise;
   let uri = subject.QueryInterface(Ci.nsIURI);
   is(uri.spec, FINAL_URL, "received expected visit");
 
   await PlacesUtils.history.clear();
   gBrowser.removeCurrentTab();
--- a/toolkit/components/reader/test/browser_readerMode.js
+++ b/toolkit/components/reader/test/browser_readerMode.js
@@ -167,43 +167,43 @@ add_task(async function test_reader_view
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
   is(menuitem.hidden, true, "menuitem element should have the hidden attribute");
 
   info("Navigate a reader-able page");
   let waitForPageshow = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
   await observeAttribute(menuitem, "hidden",
     () => {
       let url = TEST_PATH + "readerModeArticle.html";
-      tab.linkedBrowser.loadURI(url);
+      BrowserTestUtils.loadURI(tab.linkedBrowser, url);
     },
     () => {
       is(menuitem.hidden, false, "menuitem's hidden attribute should be false on a reader-able page");
     }
   );
   await waitForPageshow;
 
   info("Navigate a non-reader-able page");
   waitForPageshow = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
   await observeAttribute(menuitem, "hidden",
     () => {
       let url = TEST_PATH + "readerModeArticleHiddenNodes.html";
-      tab.linkedBrowser.loadURI(url);
+      BrowserTestUtils.loadURI(tab.linkedBrowser, url);
     },
     () => {
       is(menuitem.hidden, true, "menuitem's hidden attribute should be true on a non-reader-able page");
     }
   );
   await waitForPageshow;
 
   info("Navigate a reader-able page");
   waitForPageshow = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
   await observeAttribute(menuitem, "hidden",
     () => {
       let url = TEST_PATH + "readerModeArticle.html";
-      tab.linkedBrowser.loadURI(url);
+      BrowserTestUtils.loadURI(tab.linkedBrowser, url);
     },
     () => {
       is(menuitem.hidden, false, "menuitem's hidden attribute should be false on a reader-able page");
     }
   );
   await waitForPageshow;
 
   info("Enter Reader Mode");
@@ -230,16 +230,16 @@ add_task(async function test_reader_view
   );
   await waitForPageshow;
 
   info("Navigate a non-reader-able page");
   waitForPageshow = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
   await observeAttribute(menuitem, "hidden",
     () => {
       let url = TEST_PATH + "readerModeArticleHiddenNodes.html";
-      tab.linkedBrowser.loadURI(url);
+      BrowserTestUtils.loadURI(tab.linkedBrowser, url);
     },
     () => {
       is(menuitem.hidden, true, "menuitem's hidden attribute should be true on a non-reader-able page");
     }
   );
   await waitForPageshow;
 });
--- a/toolkit/components/reader/test/browser_readerMode_hidden_nodes.js
+++ b/toolkit/components/reader/test/browser_readerMode_hidden_nodes.js
@@ -40,13 +40,13 @@ add_task(async function test_reader_butt
         removeEventListener("DOMContentLoaded", onDCL);
         addEventListener("MozAfterPaint", function onPaint() {
           removeEventListener("MozAfterPaint", onPaint);
           resolve();
         });
       });
     });
   });
-  tab.linkedBrowser.loadURI(url);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, url);
   await paintPromise;
 
   is_element_hidden(readerButton, "Reader mode button is still not present on tab with unreadable content.");
 });
--- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.js
+++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.js
@@ -91,27 +91,28 @@ RemoteWebNavigation.prototype = {
           principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, attrs);
         }
         Services.io.speculativeConnect2(uri, principal, null);
       } catch (ex) {
         // Can't setup speculative connection for this uri string for some
         // reason (such as failing to parse the URI), just ignore it.
       }
     }
+
     this._sendMessage("WebNavigation:LoadURI", {
       uri: aURI,
       flags: aLoadFlags,
       referrer: aReferrer ? aReferrer.spec : null,
       referrerPolicy: aReferrerPolicy,
       postData: aPostData ? Utils.serializeInputStream(aPostData) : null,
       headers: aHeaders ? Utils.serializeInputStream(aHeaders) : null,
       baseURI: aBaseURI ? aBaseURI.spec : null,
       triggeringPrincipal: aTriggeringPrincipal
                            ? Utils.serializePrincipal(aTriggeringPrincipal)
-                           : null,
+                           : Services.scriptSecurityManager.createNullPrincipal({}),
       requestTime: Services.telemetry.msSystemNow(),
     });
   },
   setOriginAttributesBeforeLoading(aOriginAttributes) {
     this._sendMessage("WebNavigation:SetOriginAttributes", {
       originAttributes: aOriginAttributes,
     });
   },
--- a/toolkit/components/remotepagemanager/tests/browser/browser_RemotePageManager.js
+++ b/toolkit/components/remotepagemanager/tests/browser/browser_RemotePageManager.js
@@ -77,17 +77,17 @@ add_task(async function sharedData_aka_i
 // Test that opening a page creates a port, sends the load event and then
 // navigating to a new page sends the unload event. Going back should create a
 // new port
 add_task(async function init_navigate() {
   let port = await waitForPort(TEST_URL);
   is(port.browser, gBrowser.selectedBrowser, "Port is for the correct browser");
 
   let loaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-  gBrowser.loadURI("about:blank");
+  BrowserTestUtils.loadURI(gBrowser, "about:blank");
 
   await waitForMessage(port, "RemotePage:Unload");
 
   // Port should be destroyed now
   try {
     port.addMessageListener("Foo", failOnMessage);
     ok(false, "Should have seen exception");
   } catch (e) {
--- a/toolkit/components/thumbnails/test/head.js
+++ b/toolkit/components/thumbnails/test/head.js
@@ -102,17 +102,17 @@ function addTab(aURI, aCallback) {
 
 /**
  * Loads a new URI into the currently selected tab.
  * @param aURI The URI to load.
  */
 function navigateTo(aURI) {
   let browser = gBrowser.selectedBrowser;
   BrowserTestUtils.browserLoaded(browser).then(next);
-  browser.loadURI(aURI);
+  BrowserTestUtils.loadURI(browser, aURI);
 }
 
 /**
  * Continues the current test execution when a load event for the given element
  * has been received.
  * @param aElement The DOM element to listen on.
  * @param aCallback The function to call when the load event was dispatched.
  */
--- a/toolkit/components/url-classifier/tests/mochitest/test_donottrack.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_donottrack.html
@@ -78,17 +78,19 @@ function executeTest(test) {
   var win = mainWindow.OpenBrowserWindow({private: test.setting.pbMode});
 
   return new Promise(function(resolve, reject) {
     win.addEventListener("load", function() {
       TestUtils.topicObserved("browser-delayed-startup-finished",
                               subject => subject == win).then(() => {
         win.addEventListener("DOMContentLoaded", function onInnerLoad() {
           if (win.content.location.href != contentPage) {
-            win.gBrowser.loadURI(contentPage);
+            win.gBrowser.loadURI(contentPage, {
+              triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+            });
             return;
           }
 
           win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
           win.content.addEventListener("message", function(event) {
             let [key, value] = event.data.split("=");
             if (key == "finish") {
@@ -99,17 +101,21 @@ function executeTest(test) {
             } else if (key == "DNT") {
               let msg = test.expected.dnt == "1" ? "" : "not ";
               is(value, test.expected.dnt, "DNT header should " + msg + "be sent");
             } else {
               ok(false, "unexpected message");
             }
           });
         }, true);
-        SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
+        SimpleTest.executeSoon(function() {
+          win.gBrowser.loadURI(contentPage, {
+            triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+          });
+        });
       });
     }, {capture: true, once: true});
   });
 }
 
 let loop = function loop(index) {
   if (index >= tests.length) {
     SimpleTest.finish();
--- a/toolkit/components/url-classifier/tests/mochitest/test_privatebrowsing_trackingprotection.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_privatebrowsing_trackingprotection.html
@@ -26,30 +26,34 @@ ChromeUtils.import("resource://testing-c
 function testOnWindow(aPrivate) {
   return new Promise((resolve, reject) => {
     let win = mainWindow.OpenBrowserWindow({private: aPrivate});
     win.addEventListener("load", function() {
       TestUtils.topicObserved("browser-delayed-startup-finished",
                               subject => subject == win).then(() => {
         win.addEventListener("DOMContentLoaded", function onInnerLoad() {
           if (win.content.location.href != contentPage) {
-            win.gBrowser.loadURI(contentPage);
+            win.gBrowser.loadURI(contentPage, {
+              triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+            });
             return;
           }
           win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
           win.content.addEventListener("load", function innerLoad2() {
             win.content.removeEventListener("load", innerLoad2);
             SimpleTest.executeSoon(function() {
               resolve(win);
             });
           }, false, true);
         }, true);
         SimpleTest.executeSoon(function() {
-          win.gBrowser.loadURI(contentPage);
+          win.gBrowser.loadURI(contentPage, {
+            triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+          });
         });
       });
     }, {capture: true, once: true});
   });
 }
 
 var badids = [
   "badscript",
--- a/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html
@@ -16,36 +16,39 @@
 
 <script class="testbody" type="text/javascript">
 
 var mainWindow = window.docShell.rootTreeItem.domWindow;
 var contentPage = "chrome://mochitests/content/chrome/toolkit/components/url-classifier/tests/mochitest/classifiedAnnotatedPBFrame.html";
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
+ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
 ChromeUtils.import("resource://testing-common/TestUtils.jsm");
 
 function testOnWindow(aCallback) {
   var win = mainWindow.OpenBrowserWindow();
   win.addEventListener("load", function() {
     TestUtils.topicObserved("browser-delayed-startup-finished",
                             subject => subject == win).then(() => {
       win.addEventListener("DOMContentLoaded", function onInnerLoad() {
         if (win.content.location.href != contentPage) {
-          win.gBrowser.loadURI(contentPage);
+          BrowserTestUtils.loadURI(win.gBrowser, contentPage);
           return;
         }
         win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
         win.content.addEventListener("load", function innerLoad2() {
           win.content.removeEventListener("load", innerLoad2);
           SimpleTest.executeSoon(function() { aCallback(win); });
         }, false, true);
       }, true);
-      SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
+      SimpleTest.executeSoon(function() {
+        BrowserTestUtils.loadURI(win.gBrowser, contentPage);
+      });
     });
   }, {capture: true, once: true});
 }
 
 var badids = [
   "badscript",
 ];
 
--- a/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1312515.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1312515.html
@@ -19,36 +19,37 @@
 
 <script class="testbody" type="text/javascript">
 
 var mainWindow = window.docShell.rootTreeItem.domWindow;
 var contentPage = "http://www.itisatrap.org/chrome/toolkit/components/url-classifier/tests/mochitest/trackingRequest.html";
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
+ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
 ChromeUtils.import("resource://testing-common/TestUtils.jsm");
 
 function testOnWindow(aPrivate, aCallback) {
   var win = mainWindow.OpenBrowserWindow({private: aPrivate});
   win.addEventListener("load", function() {
     TestUtils.topicObserved("browser-delayed-startup-finished",
                             subject => subject == win).then(() => {
       win.addEventListener("DOMContentLoaded", function onInnerLoad() {
         if (win.content.location.href != contentPage) {
-          win.gBrowser.loadURI(contentPage);
+          BrowserTestUtils.loadURI(win.gBrowser, contentPage);
           return;
         }
         win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
         win.content.addEventListener("load", function innerLoad2() {
           win.content.removeEventListener("load", innerLoad2);
           SimpleTest.executeSoon(function() { aCallback(win); });
         }, false, true);
       }, true);
-      SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
+      SimpleTest.executeSoon(function() { BrowserTestUtils.loadURI(win.gBrowser, contentPage); });
     });
   }, {capture: true, once: true});
 }
 
 const topic = "http-on-before-connect";
 var testUrl;
 var testWindow;
 var resolve;
--- a/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_whitelist.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_whitelist.html
@@ -17,40 +17,41 @@
 <script class="testbody" type="text/javascript">
 
 var mainWindow = window.docShell.rootTreeItem.domWindow;
 var contentPage1 = "http://www.itisatrap.org/tests/toolkit/components/url-classifier/tests/mochitest/whitelistFrame.html";
 var contentPage2 = "http://example.com/tests/toolkit/components/url-classifier/tests/mochitest/whitelistFrame.html";
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
+ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
 ChromeUtils.import("resource://testing-common/TestUtils.jsm");
 
 function testOnWindow(contentPage) {
   return new Promise((resolve, reject) => {
     var win = mainWindow.OpenBrowserWindow();
     win.addEventListener("load", function() {
       TestUtils.topicObserved("browser-delayed-startup-finished",
                               subject => subject == win).then(() => {
         win.addEventListener("DOMContentLoaded", function onInnerLoad() {
           if (win.content.location.href != contentPage) {
-            win.gBrowser.loadURI(contentPage);
+            BrowserTestUtils.loadURI(win.gBrowser, contentPage);
             return;
           }
           win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
           win.content.addEventListener("load", function innerLoad2() {
             win.content.removeEventListener("load", innerLoad2);
             SimpleTest.executeSoon(function() {
               resolve(win);
             });
           }, false, true);
         }, true);
         SimpleTest.executeSoon(function() {
-          win.gBrowser.loadURI(contentPage);
+          BrowserTestUtils.loadURI(win.gBrowser, contentPage);
         });
       });
     }, {capture: true, once: true});
   });
 }
 
 var alwaysbadids = [
   "badscript",
--- a/toolkit/components/viewsource/content/viewSource-content.js
+++ b/toolkit/components/viewsource/content/viewSource-content.js
@@ -276,17 +276,17 @@ var ViewSourceContent = {
    * Load some URL in the browser.
    *
    * @param URL
    *        The URL string to load.
    */
   loadSourceFromURL(URL) {
     let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
     let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
-    webNav.loadURI(URL, loadFlags, null, null, null);
+    webNav.loadURI(URL, loadFlags, null, null, null, Services.scriptSecurityManager.getSystemPrincipal());
   },
 
   /**
    * This handler is for click events from:
    *   * error page content, which can show up if the user attempts to view the
    *     source of an attack page.
    *   * in-page context menu actions
    */
@@ -599,17 +599,18 @@ var ViewSourceContent = {
 
     // all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl)
     let loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
     let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET;
     let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
     webNav.loadURIWithOptions(uri, loadFlags,
                               null, referrerPolicy, // referrer
                               null, null, // postData, headers
-                              Services.io.newURI(baseURI));
+                              Services.io.newURI(baseURI),
+                              Services.scriptSecurityManager.getSystemPrincipal());
   },
 
   /**
    * Using special markers left in the serialized source, this helper makes the
    * underlying markup of the selected fragment to automatically appear as
    * selected on the inflated view-source DOM.
    */
   drawSelection() {
--- a/toolkit/content/tests/browser/browser_audioCompeting.js
+++ b/toolkit/content/tests/browser/browser_audioCompeting.js
@@ -53,23 +53,23 @@ add_task(async function setup_test_prefe
       ["dom.ipc.processCount", 1],
     ]});
 });
 
 add_task(async function cross_tabs_audio_competing() {
   info("- open tab 1 in foreground -");
   let tab1 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                          "about:blank");
-  tab1.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE);
   await waitForTabPlayingEvent(tab1, true);
 
   info("- open tab 2 in foreground -");
   let tab2 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab2.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE);
   await waitForTabPlayingEvent(tab1, false);
 
   info("- open tab 3 in foreground -");
   let tab3 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                          "about:blank");
   await ContentTask.spawn(tab2.linkedBrowser, null,
                           audio_should_keep_playing_even_go_to_background);
 
@@ -82,17 +82,17 @@ add_task(async function cross_tabs_audio
   BrowserTestUtils.removeTab(tab2);
   BrowserTestUtils.removeTab(tab3);
 });
 
 add_task(async function within_one_tab_audio_competing() {
   info("- open tab and play audio1 -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await waitForTabPlayingEvent(tab, true);
 
   info("- play audio2 in the same tab -");
   await ContentTask.spawn(tab.linkedBrowser, null,
                           play_non_autoplay_audio);
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
--- a/toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js
+++ b/toolkit/content/tests/browser/browser_audioCompeting_onlyForActiveAgent.js
@@ -110,17 +110,17 @@ function stop_audio1_from_page() {
       audio1.onpause = null;
       ok(true, "Audio1 stopped playing.");
       resolve();
     };
   });
 }
 
 async function audio_competing_for_active_agent(url, browser) {
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the default suspended state of all audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_all_audio_suspended);
 
--- a/toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
+++ b/toolkit/content/tests/browser/browser_autoplay_audibleMediaOccurred.js
@@ -9,17 +9,19 @@ const PAGE = "https://example.com/browse
 add_task(async function testAudibleAutoplayMedia() {
   info("- open new tab  -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
   let browser = tab.linkedBrowser;
 
   // start observing the topic before loading the page to ensure we can get it.
   let audibleAutoplayOccurred = TestUtils.topicObserved("AudibleAutoplayMediaOccurred");
-  browser.loadURI(PAGE);
+  browser.loadURI(PAGE, {
+    triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
+  });
 
   await BrowserTestUtils.browserLoaded(browser);
   await audibleAutoplayOccurred;
   ok(true, "Got the topic 'AudibleAutoplayMediaOccurred'.");
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 });
--- a/toolkit/content/tests/browser/browser_autoplay_policy_iframe_hierarchy.js
+++ b/toolkit/content/tests/browser/browser_autoplay_policy_iframe_hierarchy.js
@@ -40,17 +40,17 @@ var frameTestArray = [
 ];
 
 async function test_permission_propagation(testName, testSrc, layersNum) {
   info(`- start test for ${testName} -`);
   for (let layerIdx = 1; layerIdx <= layersNum; layerIdx++) {
     info("- open new tab -");
     let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                           "about:blank");
-    tab.linkedBrowser.loadURI(testSrc);
+    BrowserTestUtils.loadURI(tab.linkedBrowser, testSrc);
     await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
     // If the frame isn't activated, the video play will fail.
     async function playing_video_should_fail(layersNum) {
       for (let layerIdx = 1; layerIdx <= layersNum; layerIdx++) {
         let doc;
         if (layerIdx == 1) {
           doc = content.document;
--- a/toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js
+++ b/toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js
@@ -8,17 +8,17 @@ function setup_test_preference(enableUse
     ["media.autoplay.enabled.user-gestures-needed", enableUserGesture],
   ]});
 }
 
 async function allow_play_for_played_video() {
   info("- open new tab  -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(VIDEO_PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- simulate user-click to start video -");
   await BrowserTestUtils.synthesizeMouseAtCenter("#v", {button: 0},
                                                  tab.linkedBrowser);
 
   async function play_video_again() {
     let video = content.document.getElementById("v");
--- a/toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js
+++ b/toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js
@@ -39,17 +39,17 @@ function simulateUserGesture(gesture, ta
       return false;
   }
 }
 
 async function test_play_without_user_gesture() {
   info("- open new tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(VIDEO_PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   async function check_autoplay_keyword() {
     info("- create an new autoplay video -");
     let video = content.document.createElement("video");
     video.src = "gizmo.mp4";
     video.autoplay = true;
     let canplayPromise = new Promise(function(resolve) {
@@ -77,17 +77,17 @@ async function test_play_without_user_ge
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 }
 
 async function test_play_with_user_gesture(gesture) {
   info("- open new tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(VIDEO_PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, VIDEO_PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- simulate user gesture -");
   await simulateUserGesture(gesture, tab.linkedBrowser);
 
   info("- call play() -");
   async function play_video(gesture) {
     let video = content.document.getElementById("v");
--- a/toolkit/content/tests/browser/browser_autoscroll_disabled.js
+++ b/toolkit/content/tests/browser/browser_autoscroll_disabled.js
@@ -2,17 +2,17 @@ add_task(async function() {
   const kPrefName_AutoScroll = "general.autoScroll";
   Services.prefs.setBoolPref(kPrefName_AutoScroll, false);
 
   let dataUri = 'data:text/html,<html><body id="i" style="overflow-y: scroll"><div style="height: 2000px"></div>\
       <iframe id="iframe" style="display: none;"></iframe>\
 </body></html>';
 
   let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-  gBrowser.loadURI(dataUri);
+  BrowserTestUtils.loadURI(gBrowser, dataUri);
   await loadedPromise;
 
   await BrowserTestUtils.synthesizeMouse("#i", 50, 50, { button: 1 },
                                          gBrowser.selectedBrowser);
 
   await ContentTask.spawn(gBrowser.selectedBrowser, { }, async function() {
     var iframe = content.document.getElementById("iframe");
 
--- a/toolkit/content/tests/browser/browser_block_autoplay_media.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_media.js
@@ -34,25 +34,25 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_autoplay_media() {
   info("- open new background tab1 -");
   let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab1.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
 
   info("- should block autoplay media for non-visited tab1 -");
   await check_audio_suspended(tab1.linkedBrowser, SuspendedType.SUSPENDED_BLOCK);
 
   info("- open new background tab2 -");
   let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab2.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
 
   info("- should block autoplay for non-visited tab2 -");
   await check_audio_suspended(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK);
 
   info("- select tab1 as foreground tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab1);
 
@@ -86,28 +86,28 @@ add_task(async function block_autoplay_m
   await SpecialPowers.pushPrefEnv({"set": [
     ["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.PROMPT],
     ["media.autoplay.enabled.user-gestures-needed", true],
     ["media.autoplay.ask-permission", true],
   ]});
 
   info("- open new background tab4 -");
   let tab4 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab4.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab4.linkedBrowser);
   info("- should block autoplay for non-visited tab4 -");
   await check_audio_suspended(tab4.linkedBrowser, SuspendedType.SUSPENDED_BLOCK);
   await check_audio_paused(tab4.linkedBrowser, true);
   tab4.linkedBrowser.resumeMedia();
   info("- should not block media from tab4 -");
   await waitForTabPlayingEvent(tab4, true);
   await check_audio_paused(tab4.linkedBrowser, false);
 
   info("- check that loading a new URI in page clears gesture activation status -");
-  tab4.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab4.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab4.linkedBrowser);
   info("- should block autoplay again as gesture activation status cleared -");
   await check_audio_paused(tab4.linkedBrowser, true);
 
   info("- remove tabs -");
   BrowserTestUtils.removeTab(tab1);
   BrowserTestUtils.removeTab(tab2);
   BrowserTestUtils.removeTab(tab3);
--- a/toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_media_pausedAfterPlay.js
@@ -33,27 +33,27 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_autoplay_media() {
   info("- open new background tab1, and check tab1's media suspend type -");
   let tab1 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab1.linkedBrowser.loadURI(PAGE_SHOULD_NOT_PLAY);
+  BrowserTestUtils.loadURI(tab1.linkedBrowser, PAGE_SHOULD_NOT_PLAY);
   await BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
   await ContentTask.spawn(tab1.linkedBrowser, SuspendedType.NONE_SUSPENDED,
                           check_audio_suspended);
 
   info("- the tab1 should not be blocked -");
   await waitForTabBlockEvent(tab1, false);
 
   info("- open new background tab2, and check tab2's media suspend type -");
   let tab2 = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab2.linkedBrowser.loadURI(PAGE_SHOULD_PLAY);
+  BrowserTestUtils.loadURI(tab2.linkedBrowser, PAGE_SHOULD_PLAY);
   await BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
   await ContentTask.spawn(tab2.linkedBrowser, SuspendedType.SUSPENDED_BLOCK,
                           check_audio_suspended);
 
   info("- the tab2 should be blocked -");
   await waitForTabBlockEvent(tab2, true);
 
   info("- select tab1 as foreground tab, and tab1's media should be paused -");
--- a/toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
+++ b/toolkit/content/tests/browser/browser_block_autoplay_playAfterTabVisible.js
@@ -54,17 +54,17 @@ add_task(async function setup_test_prefe
 /**
  * This test is used for testing the visible tab which was not resumed yet.
  * If the tab doesn't have any media component, it won't be resumed even it
  * has already gone to foreground until we start audio.
  */
 add_task(async function media_should_be_able_to_play_in_visible_tab() {
   info("- open new background tab, and check tab's media pause state -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
   await ContentTask.spawn(tab.linkedBrowser, true,
                           check_audio_pause_state);
 
   info("- select tab as foreground tab, and tab's media should still be paused -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
   await ContentTask.spawn(tab.linkedBrowser, true,
                           check_audio_pause_state);
--- a/toolkit/content/tests/browser/browser_block_multipleMedia.js
+++ b/toolkit/content/tests/browser/browser_block_multipleMedia.js
@@ -81,17 +81,17 @@ add_task(async function setup_test_prefe
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_multiple_media() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   let browser = tab.linkedBrowser;
-  browser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(browser, PAGE);
   await BrowserTestUtils.browserLoaded(browser);
 
   info("- tab should be blocked -");
   await waitForTabBlockEvent(tab, true);
 
   info("- autoplay media should be blocked -");
   await ContentTask.spawn(browser, SuspendedType.SUSPENDED_BLOCK,
                                    check_autoplay_audio_suspended);
--- a/toolkit/content/tests/browser/browser_block_notInTreeAudio.js
+++ b/toolkit/content/tests/browser/browser_block_notInTreeAudio.js
@@ -48,17 +48,17 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_not_in_tree_media() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should not be blocked -");
   await waitForTabBlockEvent(tab, false);
 
   info("- check audio's suspend state -");
   await ContentTask.spawn(tab.linkedBrowser, SuspendedType.NONE_SUSPENDED,
                           check_audio_suspended);
--- a/toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
+++ b/toolkit/content/tests/browser/browser_block_playMediaInMuteTab.js
@@ -59,17 +59,17 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function unblock_icon_should_disapear_after_resume_tab() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- audio doesn't be started in beginning -");
   await ContentTask.spawn(tab.linkedBrowser, true,
                           check_audio_pause_state);
 
   info("- audio shouldn't be muted or blocked -");
   await ContentTask.spawn(tab.linkedBrowser, SuspendedType.NONE_SUSPENDED,
--- a/toolkit/content/tests/browser/browser_block_plugIn.js
+++ b/toolkit/content/tests/browser/browser_block_plugIn.js
@@ -6,17 +6,17 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_plug_in() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should be blocked -");
   await waitForTabBlockEvent(tab, true);
 
   info("- switch tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 
--- a/toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
+++ b/toolkit/content/tests/browser/browser_block_silentAudioTrack_media.js
@@ -30,17 +30,17 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function unblock_icon_should_disapear_after_resume_tab() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- the suspend state of tab should be suspend-block -");
   await ContentTask.spawn(tab.linkedBrowser, SuspendedType.SUSPENDED_BLOCK,
                           check_audio_suspended);
 
   info("- tab should display unblocking icon -");
   await waitForTabBlockEvent(tab, true);
@@ -60,17 +60,17 @@ add_task(async function unblock_icon_sho
 
   info("- remove tab -");
   BrowserTestUtils.removeTab(tab);
 });
 
 add_task(async function should_not_show_sound_indicator_after_resume_tab() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- the suspend state of tab should be suspend-block -");
   await ContentTask.spawn(tab.linkedBrowser, SuspendedType.SUSPENDED_BLOCK,
                           check_audio_suspended);
 
   info("- tab should display unblocking icon -");
   await waitForTabBlockEvent(tab, true);
--- a/toolkit/content/tests/browser/browser_block_webAudio.js
+++ b/toolkit/content/tests/browser/browser_block_webAudio.js
@@ -12,17 +12,17 @@ add_task(async function setup_test_prefe
     ["media.useAudioChannelService.testing", true],
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_web_audio() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should be blocked -");
   await waitForTabBlockEvent(tab, true);
 
   info("- switch tab -");
   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 
--- a/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
+++ b/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
@@ -87,17 +87,17 @@ body > div > div {width: 1000px;height: 
 </body></html>'},
     {elem: "r", expected: expectScrollNone, testwindow: true, middlemousepastepref: true},
     {elem: "s", expected: expectScrollNone, testwindow: true, middlemousepastepref: true},
   ];
 
   for (let test of allTests) {
     if (test.dataUri) {
       let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-      gBrowser.loadURI(test.dataUri);
+      BrowserTestUtils.loadURI(gBrowser, test.dataUri);
       await loadedPromise;
       continue;
      }
 
     let prefsChanged = "middlemousepastepref" in test;
     if (prefsChanged) {
       await pushPrefs([["middlemouse.paste", test.middlemousepastepref]]);
     }
--- a/toolkit/content/tests/browser/browser_content_url_annotation.js
+++ b/toolkit/content/tests/browser/browser_content_url_annotation.js
@@ -55,17 +55,17 @@ add_task(async function test_content_url
       await new Promise((resolve) => {
         addEventListener("RedirectDone", function listener() {
           dump("Got RedirectDone\n");
           removeEventListener("RedirectDone", listener);
           resolve();
         }, true, true);
       });
     });
-    browser.loadURI(url);
+    BrowserTestUtils.loadURI(browser, url);
     await promise;
 
     // Crash the tab
     let annotations = await BrowserTestUtils.crashBrowser(browser);
 
     ok("URL" in annotations, "annotated a URL");
     is(annotations.URL, redirect_url,
        "Should have annotated the URL after redirect");
--- a/toolkit/content/tests/browser/browser_isSynthetic.js
+++ b/toolkit/content/tests/browser/browser_isSynthetic.js
@@ -39,23 +39,23 @@ add_task(async function() {
   let tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
   let browser = tab.linkedBrowser;
   await BrowserTestUtils.browserLoaded(browser);
   let listener = new LocationChangeListener(browser);
 
   is(browser.isSyntheticDocument, false, "Should not be synthetic");
 
   let loadPromise = waitForPageShow(browser);
-  browser.loadURI("data:text/html;charset=utf-8,<html/>");
+  BrowserTestUtils.loadURI(browser, "data:text/html;charset=utf-8,<html/>");
   await loadPromise;
   is(listener.wasSynthetic, false, "Should not be synthetic");
   is(browser.isSyntheticDocument, false, "Should not be synthetic");
 
   loadPromise = waitForPageShow(browser);
-  browser.loadURI(FILES + "empty.png");
+  BrowserTestUtils.loadURI(browser, FILES + "empty.png");
   await loadPromise;
   is(listener.wasSynthetic, true, "Should be synthetic");
   is(browser.isSyntheticDocument, true, "Should be synthetic");
 
   loadPromise = waitForPageShow(browser);
   browser.goBack();
   await loadPromise;
   is(listener.wasSynthetic, false, "Should not be synthetic");
--- a/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
+++ b/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
@@ -57,17 +57,17 @@ add_task(async function() {
     }
     dispatchedKeyEvents |= keyFlag;
     is(keyFlag, expectedKeyEvents & keyFlag, aEvent.type + " fired: " + key);
   }
 
   var dataUri = 'data:text/html,<body style="height:10000px;"></body>';
 
   let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-  gBrowser.loadURI(dataUri);
+  BrowserTestUtils.loadURI(gBrowser, dataUri);
   await loadedPromise;
 
   await SimpleTest.promiseFocus(gBrowser.selectedBrowser);
 
   window.addEventListener("keydown", onKey);
   window.addEventListener("keypress", onKey);
   window.addEventListener("keyup", onKey);
 
--- a/toolkit/content/tests/browser/browser_mediaPlayback.js
+++ b/toolkit/content/tests/browser/browser_mediaPlayback.js
@@ -5,17 +5,17 @@ function wait_for_event(browser, event) 
   return BrowserTestUtils.waitForEvent(browser, event, false, (event) => {
     is(event.originalTarget, browser, "Event must be dispatched to correct browser.");
     ok(!event.cancelable, "The event should not be cancelable");
     return true;
   });
 }
 
 async function test_on_browser(url, browser) {
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
   await wait_for_event(browser, "DOMAudioPlaybackStopped");
 }
 
 add_task(async function test_page() {
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: "about:blank",
--- a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js
+++ b/toolkit/content/tests/browser/browser_mediaPlayback_mute.js
@@ -27,17 +27,17 @@ function test_audio_in_browser() {
   var audio = get_audio_element();
   return {
     computedVolume: audio.computedVolume,
     computedMuted: audio.computedMuted,
   };
 }
 
 async function test_on_browser(url, browser) {
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   var result = await ContentTask.spawn(browser, null, test_audio_in_browser);
   is(result.computedVolume, 1, "Audio volume is 1");
   is(result.computedMuted, false, "Audio is not muted");
 
   ok(!browser.audioMuted, "Audio should not be muted by default");
   browser.mute();
@@ -46,17 +46,17 @@ async function test_on_browser(url, brow
   await wait_for_event(browser, "DOMAudioPlaybackStopped");
 
   result = await ContentTask.spawn(browser, null, test_audio_in_browser);
   is(result.computedVolume, 0, "Audio volume is 0 when muted");
   is(result.computedMuted, true, "Audio is muted");
 }
 
 async function test_visibility(url, browser) {
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   var result = await ContentTask.spawn(browser, null, test_audio_in_browser);
   is(result.computedVolume, 1, "Audio volume is 1");
   is(result.computedMuted, false, "Audio is not muted");
 
   await BrowserTestUtils.withNewTab({
     gBrowser,
--- a/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js
+++ b/toolkit/content/tests/browser/browser_mediaPlayback_suspended.js
@@ -36,17 +36,17 @@ function check_audio_pause_state(expecte
     is(audio.paused, true, "Audio is paused correctly.");
   } else {
     is(audio.paused, false, "Audio is resumed correctly.");
   }
 }
 
 async function suspended_pause(url, browser) {
   info("### Start test for suspended-pause ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the suspended state of audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_audio_suspended);
 
@@ -62,17 +62,17 @@ async function suspended_pause(url, brow
   await ContentTask.spawn(browser, false /* expect for playing */,
                                    check_audio_pause_state);
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_audio_suspended);
 }
 
 async function suspended_pause_disposable(url, browser) {
   info("### Start test for suspended-pause-disposable ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the suspended state of audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_audio_suspended);
 
@@ -88,17 +88,17 @@ async function suspended_pause_disposabl
   await ContentTask.spawn(browser, false /* expect for playing */,
                                    check_audio_pause_state);
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_audio_suspended);
 }
 
 async function suspended_stop_disposable(url, browser) {
   info("### Start test for suspended-stop-disposable ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the suspended state of audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_audio_suspended);
 
--- a/toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js
+++ b/toolkit/content/tests/browser/browser_mediaPlayback_suspended_multipleAudio.js
@@ -133,17 +133,17 @@ function no_audio_resumed() {
     ok(false, "Can't get the audio element!");
   }
 
   is(autoPlay.paused && nonAutoPlay.paused, true, "No audio was resumed.");
 }
 
 async function suspended_pause(url, browser) {
   info("### Start test for suspended-pause ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the default suspended state of all audio should be non-suspened-");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_all_audio_suspended);
 
@@ -171,17 +171,17 @@ async function suspended_pause(url, brow
 
   info("- both audio should be paused at the same time -");
   browser.pauseMedia(false /* non-disposable */);
   await ContentTask.spawn(browser, null, all_audio_onpause);
 }
 
 async function suspended_pause_disposable(url, browser) {
   info("### Start test for suspended-pause-disposable ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the default suspended state of all audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_all_audio_suspended);
 
@@ -203,17 +203,17 @@ async function suspended_pause_disposabl
   await ContentTask.spawn(browser, false /* expect for playing */,
                                    check_autoplay_audio_pause_state);
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_all_audio_suspended);
 }
 
 async function suspended_stop_disposable(url, browser) {
   info("### Start test for suspended-stop-disposable ###");
-  browser.loadURI(url);
+  BrowserTestUtils.loadURI(browser, url);
 
   info("- page should have playing audio -");
   await wait_for_event(browser, "DOMAudioPlaybackStarted");
 
   info("- the default suspended state of all audio should be non-suspened -");
   await ContentTask.spawn(browser, SuspendedType.NONE_SUSPENDED,
                                    check_all_audio_suspended);
 
--- a/toolkit/content/tests/browser/browser_mute_plugIn.js
+++ b/toolkit/content/tests/browser/browser_mute_plugIn.js
@@ -33,17 +33,17 @@ add_task(async function setup_test_prefe
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function block_plug_in() {
   info("- open new tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should be audible -");
   await waitForTabPlayingEvent(tab, true);
 
   info("- mute browser -");
   ok(!tab.linkedBrowser.audioMuted, "Audio should not be muted by default");
   await click_icon(tab);
--- a/toolkit/content/tests/browser/browser_mute_webAudio.js
+++ b/toolkit/content/tests/browser/browser_mute_webAudio.js
@@ -40,17 +40,17 @@ add_task(async function setup_test_prefe
     ["media.block-autoplay-until-in-foreground", true],
   ]});
 });
 
 add_task(async function mute_web_audio() {
   info("- open new tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
-  tab.linkedBrowser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   info("- tab should be audible -");
   await waitForTabPlayingEvent(tab, true);
 
   info("- mute browser -");
   ok(!tab.linkedBrowser.audioMuted, "Audio should not be muted by default");
   await click_icon(tab);
--- a/toolkit/content/tests/browser/browser_resume_bkg_video_on_tab_hover.js
+++ b/toolkit/content/tests/browser/browser_resume_bkg_video_on_tab_hover.js
@@ -102,17 +102,17 @@ add_task(async function setup_test_prefe
  */
 add_task(async function resume_and_suspend_background_video_decoding() {
   info("- open new background tab -");
   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
   let browser = tab.linkedBrowser;
 
   info("- before loading media, we shoudn't send the tab hover msg for tab -");
   await check_should_not_send_unselected_tab_hover_msg(browser);
-  browser.loadURI(PAGE);
+  BrowserTestUtils.loadURI(browser, PAGE);
   await BrowserTestUtils.browserLoaded(browser);
 
   info("- should suspend background video decoding -");
   await get_video_decoding_suspend_promise(browser, true);
   await check_should_send_unselected_tab_hover_msg(browser);
 
   info("- when cursor is hovering over the tab, resuming the video decoding -");
   let promise = get_video_decoding_resume_promise(browser);
--- a/toolkit/content/tests/browser/browser_save_resend_postdata.js
+++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js
@@ -12,17 +12,17 @@ MockFilePicker.init(window);
  *
  * Test for bug 485196 <https://bugzilla.mozilla.org/show_bug.cgi?id=485196>:
  * Web page generated by POST is retried as GET when Save Frame As used, and the
  * page is no longer in the cache.
  */
 function test() {
   waitForExplicitFinish();
 
-  gBrowser.loadURI("http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs");
+  BrowserTestUtils.loadURI(gBrowser, "http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs");
 
   gBrowser.addEventListener("pageshow", function pageShown(event) {
     if (event.target.location == "about:blank")
       return;
     gBrowser.removeEventListener("pageshow", pageShown);
 
     // Submit the form in the outer page, then wait for both the outer
     // document and the inner frame to be loaded again.
--- a/toolkit/content/tests/browser/browser_sound_indicator_silent_video.js
+++ b/toolkit/content/tests/browser/browser_sound_indicator_silent_video.js
@@ -28,17 +28,17 @@ add_task(async function should_not_show_
   info("- open new foreground tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
 
   info("- tab should not have sound indicator before playing silent video -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- loading autoplay silent video -");
-  tab.linkedBrowser.loadURI(SILENT_PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, SILENT_PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
   await ContentTask.spawn(tab.linkedBrowser, true /* playing */,
                           check_audio_playing_state);
 
   info("- tab should not have sound indicator after playing silent video -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- remove tab -");
@@ -49,17 +49,17 @@ add_task(async function should_not_show_
   info("- open new foreground tab -");
   let tab = await BrowserTestUtils.openNewForegroundTab(window.gBrowser,
                                                         "about:blank");
 
   info("- tab should not have sound indicator before playing almost silent video -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- loading autoplay almost silent video -");
-  tab.linkedBrowser.loadURI(ALMOST_SILENT_PAGE);
+  BrowserTestUtils.loadURI(tab.linkedBrowser, ALMOST_SILENT_PAGE);
   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
   await ContentTask.spawn(tab.linkedBrowser, true /* playing */,
                           check_audio_playing_state);
 
   info("- tab should not have sound indicator after playing almost silent video -");
   await waitForTabPlayingEvent(tab, false);
 
   info("- remove tab -");