forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1539595 - Create a separate content process type for privleged mo…
…zilla content r=nika,flod Differential Revision: https://phabricator.services.mozilla.com/D30276 --HG-- rename : browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js => browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js rename : browser/base/content/test/general/browser_e10s_about_process.js => browser/base/content/test/tabs/browser_e10s_about_process.js rename : browser/base/content/test/general/browser_e10s_chrome_process.js => browser/base/content/test/tabs/browser_e10s_chrome_process.js rename : browser/base/content/test/general/browser_e10s_javascript.js => browser/base/content/test/tabs/browser_e10s_javascript.js rename : browser/base/content/test/general/browser_e10s_switchbrowser.js => browser/base/content/test/tabs/browser_e10s_switchbrowser.js rename : browser/base/content/test/general/file_about_child.html => browser/base/content/test/tabs/file_about_child.html rename : browser/base/content/test/general/file_about_parent.html => browser/base/content/test/tabs/file_about_parent.html rename : browser/base/content/test/general/test_process_flags_chrome.html => browser/base/content/test/tabs/test_process_flags_chrome.html extra : moz-landing-system : lando
- Loading branch information
1 parent
03b41fa
commit 21a98d9
Showing
21 changed files
with
481 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
176 changes: 0 additions & 176 deletions
176
browser/base/content/test/general/browser_e10s_about_process.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
135 changes: 135 additions & 0 deletions
135
browser/base/content/test/tabs/browser_e10s_about_process.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
const CHROME = { | ||
id: "cb34538a-d9da-40f3-b61a-069f0b2cb9fb", | ||
path: "test-chrome", | ||
flags: 0, | ||
}; | ||
const CANREMOTE = { | ||
id: "2480d3e1-9ce4-4b84-8ae3-910b9a95cbb3", | ||
path: "test-allowremote", | ||
flags: Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD, | ||
}; | ||
const MUSTREMOTE = { | ||
id: "f849cee5-e13e-44d2-981d-0fb3884aaead", | ||
path: "test-mustremote", | ||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD, | ||
}; | ||
const CANPRIVILEGEDREMOTE = { | ||
id: "a04ffafe-6c63-4266-acae-0f4b093165aa", | ||
path: "test-canprivilegedremote", | ||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD | | ||
Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS, | ||
}; | ||
const MUSTEXTENSION = { | ||
id: "f7a1798f-965b-49e9-be83-ec6ee4d7d675", | ||
path: "test-mustextension", | ||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_EXTENSION_PROCESS, | ||
}; | ||
|
||
|
||
const TEST_MODULES = [ | ||
CHROME, | ||
CANREMOTE, | ||
MUSTREMOTE, | ||
CANPRIVILEGEDREMOTE, | ||
MUSTEXTENSION, | ||
]; | ||
|
||
function AboutModule() { | ||
} | ||
|
||
AboutModule.prototype = { | ||
newChannel(aURI, aLoadInfo) { | ||
throw Cr.NS_ERROR_NOT_IMPLEMENTED; | ||
}, | ||
|
||
getURIFlags(aURI) { | ||
for (let module of TEST_MODULES) { | ||
if (aURI.pathQueryRef.startsWith(module.path)) { | ||
return module.flags; | ||
} | ||
} | ||
|
||
ok(false, "Called getURIFlags for an unknown page " + aURI.spec); | ||
return 0; | ||
}, | ||
|
||
getIndexedDBOriginPostfix(aURI) { | ||
return null; | ||
}, | ||
|
||
QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]), | ||
}; | ||
|
||
var AboutModuleFactory = { | ||
createInstance(aOuter, aIID) { | ||
if (aOuter) | ||
throw Cr.NS_ERROR_NO_AGGREGATION; | ||
return new AboutModule().QueryInterface(aIID); | ||
}, | ||
|
||
lockFactory(aLock) { | ||
throw Cr.NS_ERROR_NOT_IMPLEMENTED; | ||
}, | ||
|
||
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]), | ||
}; | ||
|
||
add_task(async function init() { | ||
SpecialPowers.setBoolPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", true); | ||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | ||
for (let module of TEST_MODULES) { | ||
registrar.registerFactory(Components.ID(module.id), "", | ||
"@mozilla.org/network/protocol/about;1?what=" + module.path, | ||
AboutModuleFactory); | ||
} | ||
}); | ||
|
||
registerCleanupFunction(() => { | ||
SpecialPowers.clearUserPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess"); | ||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | ||
for (let module of TEST_MODULES) { | ||
registrar.unregisterFactory(Components.ID(module.id), AboutModuleFactory); | ||
} | ||
}); | ||
|
||
add_task(async function test_chrome() { | ||
test_url_for_process_types("about:" + CHROME.path, true, false, false, false, false); | ||
}); | ||
|
||
add_task(async function test_any() { | ||
test_url_for_process_types("about:" + CANREMOTE.path, true, true, false, false, false); | ||
}); | ||
|
||
add_task(async function test_remote() { | ||
test_url_for_process_types("about:" + MUSTREMOTE.path, false, true, false, false, false); | ||
}); | ||
|
||
add_task(async function test_privileged_remote_true() { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [ | ||
["browser.tabs.remote.separatePrivilegedContentProcess", true], | ||
], | ||
}); | ||
|
||
// This shouldn't be taken literally. We will always use the privleged about | ||
// content type if the URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS flag is enabled and | ||
// the pref is turned on. | ||
test_url_for_process_types("about:" + CANPRIVILEGEDREMOTE.path, false, false, true, false, false); | ||
}); | ||
|
||
add_task(async function test_privileged_remote_false() { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [ | ||
["browser.tabs.remote.separatePrivilegedContentProcess", false], | ||
], | ||
}); | ||
|
||
// This shouldn't be taken literally. We will always use the privleged about | ||
// content type if the URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS flag is enabled and | ||
// the pref is turned on. | ||
test_url_for_process_types("about:" + CANPRIVILEGEDREMOTE.path, false, true, false, false, false); | ||
}); | ||
|
||
add_task(async function test_extension() { | ||
test_url_for_process_types("about:" + MUSTEXTENSION.path, false, false, false, false, true); | ||
}); |
Oops, something went wrong.