Bug 1596834 - Use forceNewProcess in browser_permmgr_sync.js. r=mconley

Also fix a few typos in comments.

Differential Revision: https://phabricator.services.mozilla.com/D53229

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-11-15 17:24:11 +00:00
Родитель f61ea84b1c
Коммит c18473df1d
1 изменённых файлов: 6 добавлений и 31 удалений

Просмотреть файл

@ -11,44 +11,19 @@ function addPerm(aOrigin, aName) {
add_task(async function() {
// Make sure that we get a new process for the tab which we create. This is
// important, becuase we wanto to assert information about the initial state
// important, because we want to assert information about the initial state
// of the local permissions cache.
//
// We use the same approach here as was used in the e10s-multi localStorage
// tests (dom/tests/browser/browser_localStorage_e10s.js (bug )). This ensures
// that our tab has its own process.
//
// Bug 1345990 tracks implementing a better tool for ensuring this.
let keepAliveCount = 0;
try {
keepAliveCount = SpecialPowers.getIntPref("dom.ipc.keepProcessesAlive.web");
} catch (ex) {
// Then zero is correct.
}
let safeProcessCount = keepAliveCount + 2;
info(
"dom.ipc.keepProcessesAlive.web is " +
keepAliveCount +
", boosting " +
"process count temporarily to " +
safeProcessCount
);
await SpecialPowers.pushPrefEnv({
set: [
["dom.ipc.processCount", safeProcessCount],
["dom.ipc.processCount.web", safeProcessCount],
],
});
addPerm("http://example.com", "perm1");
addPerm("http://foo.bar.example.com", "perm2");
addPerm("about:home", "perm3");
addPerm("https://example.com", "perm4");
// NOTE: This permission is a preload permission, so it should be avaliable in the content process from startup.
// NOTE: This permission is a preload permission, so it should be available in
// the content process from startup.
addPerm("https://somerandomwebsite.com", "document");
await BrowserTestUtils.withNewTab(
{ gBrowser, url: "about:blank" },
{ gBrowser, url: "about:blank", forceNewProcess: true },
async function(aBrowser) {
await ContentTask.spawn(aBrowser, null, async function() {
// Before the load http URIs shouldn't have been sent down yet
@ -171,7 +146,7 @@ add_task(async function() {
addPerm("https://someotherrandomwebsite.com", "document");
await ContentTask.spawn(aBrowser, null, async function() {
// The new permissions should be avaliable, but only for
// The new permissions should be available, but only for
// http://example.com, and about:home
is(
Services.perms.testPermissionFromPrincipal(
@ -283,7 +258,7 @@ add_task(async function() {
});
// Now that the https subdomain has loaded, we want to make sure that the
// permissions are also avaliable for its parent domain, https://example.com!
// permissions are also available for its parent domain, https://example.com!
is(
Services.perms.testPermissionFromPrincipal(
Services.scriptSecurityManager.createContentPrincipalFromOrigin(