From d7b8eeedcce15a70cec38ef08e31bcda20274364 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 28 Jan 2021 05:25:10 +0000 Subject: [PATCH] Bug 1685801: Part 3 - Remove BrowserUtils.makeURI and makeFileURI. r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D101483 --- .../browser/browser_favicon_firstParty.js | 6 +-- .../browser_privatebrowsing_favicon.js | 4 +- caps/tests/mochitest/browser_checkloaduri.js | 8 +-- .../test/general/test_bug1277803.xhtml | 53 +++++++++---------- toolkit/modules/BrowserUtils.jsm | 22 +------- 5 files changed, 30 insertions(+), 63 deletions(-) diff --git a/browser/components/originattributes/test/browser/browser_favicon_firstParty.js b/browser/components/originattributes/test/browser/browser_favicon_firstParty.js index a6ec99e0d722..cd9867eebee6 100644 --- a/browser/components/originattributes/test/browser/browser_favicon_firstParty.js +++ b/browser/components/originattributes/test/browser/browser_favicon_firstParty.js @@ -42,8 +42,6 @@ const ICON_DATA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABH0lEQVRYw2P8////f4YBBEwMAwxGHcBCUMX/91DGOSj/BpT/DkpzQChGBSjfBErLQsVZhmoI/L8LpRdD6X1QietQGhYy7FB5aAgwmkLpBKi4BZTPMThDgBGjHIDF+f9mKD0fKvGBRKNdoF7sgPL1saaJwZgGDkJ9vpZMn8PAHqg5G9FyifBgD4H/W9HyOWrU/f+DIzHhkoeZxxgzZEIAVtJ9RxX+Q6DAxCmP3byhXxkxshAs5odqbcioAY3UC1CBLyTGOTqAmsfAOWRCwBvqxV0oIUB2OQAzDy3/D+a6wB7q8mCU2vD/nw94GziYIQOtDRn9oXz+IZMGBKGMbCjNh9Ii+v8HR4uIAUeLiEEbb9twELaIRlqrmHG0bzjiHQAA1LVfww8jwM4AAAAASUVORK5CYII="; let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal(); -let makeURI = ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm", {}) - .BrowserUtils.makeURI; function clearAllImageCaches() { let tools = SpecialPowers.Cc["@mozilla.org/image/tools;1"].getService( @@ -244,8 +242,8 @@ function assertIconIsData(item) { } async function doTest(aTestPage, aExpectedCookies, aFaviconURL) { - let firstPageURI = makeURI(TEST_SITE_ONE + aTestPage); - let secondPageURI = makeURI(TEST_SITE_TWO + aTestPage); + let firstPageURI = Services.io.newURI(TEST_SITE_ONE + aTestPage); + let secondPageURI = Services.io.newURI(TEST_SITE_TWO + aTestPage); // Start to observe the event of that favicon has been fully loaded. let promiseFaviconLoaded = waitOnFaviconLoaded(aFaviconURL); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js index c0e671ce34ed..b455a60fab5d 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js @@ -15,8 +15,6 @@ const FAVICON_URI = TEST_SITE + TEST_DIRECTORY + "file_favicon.png"; const FAVICON_CACHE_URI = TEST_CACHE_SITE + TEST_DIRECTORY + "file_favicon.png"; let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal(); -let makeURI = ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm", {}) - .BrowserUtils.makeURI; function clearAllImageCaches() { let tools = SpecialPowers.Cc["@mozilla.org/image/tools;1"].getService( @@ -205,7 +203,7 @@ add_task(async function test_favicon_privateBrowsing() { let privateWindow = await BrowserTestUtils.openNewBrowserWindow({ private: true, }); - let pageURI = makeURI(TEST_PAGE); + let pageURI = Services.io.newURI(TEST_PAGE); // Generate two random cookies for non-private window and private window // respectively. diff --git a/caps/tests/mochitest/browser_checkloaduri.js b/caps/tests/mochitest/browser_checkloaduri.js index 4607c802288e..3f114427335d 100644 --- a/caps/tests/mochitest/browser_checkloaduri.js +++ b/caps/tests/mochitest/browser_checkloaduri.js @@ -254,7 +254,7 @@ function testURL( let threw = false; let targetURI; try { - targetURI = makeURI(target); + targetURI = Services.io.newURI(target); } catch (ex) { ok( !canCreate, @@ -300,7 +300,7 @@ add_task(async function() { if (sourceString.startsWith("about:test-chrome-privs")) { source = ssm.getSystemPrincipal(); } else { - source = ssm.createContentPrincipal(makeURI(sourceString), {}); + source = ssm.createContentPrincipal(Services.io.newURI(sourceString), {}); } for (let [ target, @@ -341,10 +341,6 @@ add_task(async function() { // eslint-disable-next-line no-shadow let baseFlags = ssm.STANDARD | ssm.DONT_REPORT_ERRORS; // eslint-disable-next-line no-unused-vars - let makeURI = ChromeUtils.import( - "resource://gre/modules/BrowserUtils.jsm", - {} - ).BrowserUtils.makeURI; let b = new content.Blob(["I am a blob"]); let contentBlobURI = content.URL.createObjectURL(b); let contentPrincipal = content.document.nodePrincipal; diff --git a/dom/security/test/general/test_bug1277803.xhtml b/dom/security/test/general/test_bug1277803.xhtml index 482dd6b916ec..43afb1f1a355 100644 --- a/dom/security/test/general/test_bug1277803.xhtml +++ b/dom/security/test/general/test_bug1277803.xhtml @@ -15,46 +15,41 @@