From 8f54548bda78454598879a1b2c1db6fcca9d9f25 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 18 Aug 2022 22:14:54 +0000 Subject: [PATCH] Bug 1769791, part 2 - Add allowXULXBL for file URIs for reftests even if not http. r=jmaher This ensures we have the permission to load XUL files from file URIs when we are not using HTTP, which we seem to need for remote reftests, like Android. This also removes the setting of dom.allow_XUL_XBL_for_file in the reftest pref file, which doesn't seem to be enough to make Android remote reftests work for some reason, so I don't think it is doing anything. Differential Revision: https://phabricator.services.mozilla.com/D154690 --- layout/tools/reftest/manifest.jsm | 17 ++++++----------- testing/profiles/reftest/user.js | 2 -- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/layout/tools/reftest/manifest.jsm b/layout/tools/reftest/manifest.jsm index d88aea0a9bd1..69e1d4f7c143 100644 --- a/layout/tools/reftest/manifest.jsm +++ b/layout/tools/reftest/manifest.jsm @@ -714,16 +714,7 @@ function ServeTestBase(aURL, depth) { // this one is needed so tests can use example.org urls for cross origin testing g.server.registerDirectory("/", directory); - var secMan = Cc[NS_SCRIPTSECURITYMANAGER_CONTRACTID] - .getService(Ci.nsIScriptSecurityManager); - - var testbase = g.ioService.newURI("http://localhost:" + g.httpServerPort + - path + dirPath); - var testBasePrincipal = secMan.createContentPrincipal(testbase, {}); - - // Give the testbase URI access to XUL and XBL - Services.perms.addFromPrincipal(testBasePrincipal, "allowXULXBL", Services.perms.ALLOW_ACTION); - return testbase; + return g.ioService.newURI("http://localhost:" + g.httpServerPort + path + dirPath); } function CreateUrls(test) { @@ -733,8 +724,12 @@ function CreateUrls(test) { let manifestURL = g.ioService.newURI(test.manifest); let testbase = manifestURL; - if (test.runHttp) + if (test.runHttp) { testbase = ServeTestBase(manifestURL, test.httpDepth) + } + + let testbasePrincipal = secMan.createContentPrincipal(testbase, {}); + Services.perms.addFromPrincipal(testbasePrincipal, "allowXULXBL", Services.perms.ALLOW_ACTION); function FileToURI(file) { diff --git a/testing/profiles/reftest/user.js b/testing/profiles/reftest/user.js index 8f5ad2b4c13d..a54b3f8d5d80 100644 --- a/testing/profiles/reftest/user.js +++ b/testing/profiles/reftest/user.js @@ -25,8 +25,6 @@ user_pref("browser.startup.page", 0); // assumed 980px content. user_pref("browser.viewport.desktopWidth", 800); user_pref("datareporting.healthreport.uploadEnabled", false); -// Allow XUL and XBL files to be opened from file:// URIs -user_pref("dom.allow_XUL_XBL_for_file", true); // Don't forcibly kill content processes after a timeout user_pref("dom.ipc.tabs.shutdownTimeoutSecs", 0); // For mochitests, we're more interested in testing the behavior of in-