зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596855 - Update browser_permmgr_sync.js for Fission. r=pbz
The test was updated to ensure that under Fission we're not syncing all permission information to a "parent" content process, and instead just to the specific iframe that needs it. Differential Revision: https://phabricator.services.mozilla.com/D76103
This commit is contained in:
Родитель
5c34bc916d
Коммит
badadf3f93
|
@ -1,7 +1,6 @@
|
|||
[DEFAULT]
|
||||
|
||||
[browser_permmgr_sync.js]
|
||||
fail-if = fission
|
||||
# The browser_permmgr_sync test tests e10s specific behavior, and runs code
|
||||
# paths which would hit the debug only assertion in
|
||||
# PermissionManager::PermissionKey::CreateFromPrincipal. Because of this, it
|
||||
|
|
|
@ -78,15 +78,17 @@ add_task(async function() {
|
|||
"cookie-1"
|
||||
);
|
||||
|
||||
let iframe = content.document.createElement("iframe");
|
||||
|
||||
// Perform a load of example.com
|
||||
await new Promise(resolve => {
|
||||
let iframe = content.document.createElement("iframe");
|
||||
iframe.setAttribute("src", "http://example.com");
|
||||
iframe.onload = resolve;
|
||||
content.document.body.appendChild(iframe);
|
||||
});
|
||||
|
||||
// After the load finishes, we should know about example.com, but not foo.bar.example.com
|
||||
// After the load finishes, the iframe process should know about example.com, but not foo.bar.example.com
|
||||
await content.SpecialPowers.spawn(iframe, [], async function() {
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -97,6 +99,7 @@ add_task(async function() {
|
|||
Services.perms.ALLOW_ACTION,
|
||||
"perm1-2"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -107,6 +110,7 @@ add_task(async function() {
|
|||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm2-2"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -117,6 +121,7 @@ add_task(async function() {
|
|||
Services.perms.ALLOW_ACTION,
|
||||
"perm3-2"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -127,6 +132,7 @@ add_task(async function() {
|
|||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm4-2"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -139,15 +145,8 @@ add_task(async function() {
|
|||
);
|
||||
});
|
||||
|
||||
addPerm("http://example.com", "newperm1");
|
||||
addPerm("http://foo.bar.example.com", "newperm2");
|
||||
addPerm("about:home", "newperm3");
|
||||
addPerm("https://example.com", "newperm4");
|
||||
addPerm("https://someotherrandomwebsite.com", "cookie");
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [], async function() {
|
||||
// The new permissions should be available, but only for
|
||||
// http://example.com, and about:home
|
||||
// In Fission only, the parent process should have no knowledge about the child
|
||||
// process permissions
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -155,19 +154,12 @@ add_task(async function() {
|
|||
),
|
||||
"perm1"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"perm1-3"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://example.com"
|
||||
),
|
||||
"newperm1"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"newperm1-3"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -178,6 +170,62 @@ add_task(async function() {
|
|||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm2-3"
|
||||
);
|
||||
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"https://example.com"
|
||||
),
|
||||
"perm4"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm4-3"
|
||||
);
|
||||
});
|
||||
|
||||
addPerm("http://example.com", "newperm1");
|
||||
addPerm("http://foo.bar.example.com", "newperm2");
|
||||
addPerm("about:home", "newperm3");
|
||||
addPerm("https://example.com", "newperm4");
|
||||
addPerm("https://someotherrandomwebsite.com", "cookie");
|
||||
|
||||
await SpecialPowers.spawn(aBrowser, [], async function() {
|
||||
// The new permissions should be available, but only for
|
||||
// http://example.com (without Fission), and about:home.
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://example.com"
|
||||
),
|
||||
"perm1"
|
||||
),
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"perm1-4"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://example.com"
|
||||
),
|
||||
"newperm1"
|
||||
),
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"newperm1-1"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://foo.bar.example.com"
|
||||
),
|
||||
"perm2"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm2-4"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -186,7 +234,7 @@ add_task(async function() {
|
|||
"newperm2"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"newperm2-3"
|
||||
"newperm2-1"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -206,7 +254,7 @@ add_task(async function() {
|
|||
"newperm3"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"newperm3-3"
|
||||
"newperm3-1"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -216,7 +264,7 @@ add_task(async function() {
|
|||
"perm4"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm4-3"
|
||||
"perm4-4"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -226,7 +274,7 @@ add_task(async function() {
|
|||
"newperm4"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"newperm4-3"
|
||||
"newperm4-1"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -249,16 +297,29 @@ add_task(async function() {
|
|||
"othercookie-3"
|
||||
);
|
||||
|
||||
let iframe = content.document.createElement("iframe");
|
||||
// Loading a subdomain now, on https
|
||||
await new Promise(resolve => {
|
||||
let iframe = content.document.createElement("iframe");
|
||||
iframe.setAttribute("src", "https://sub1.test1.example.com");
|
||||
iframe.onload = resolve;
|
||||
content.document.body.appendChild(iframe);
|
||||
});
|
||||
|
||||
// Now that the https subdomain has loaded, we want to make sure that the
|
||||
// permissions are also available for its parent domain, https://example.com!
|
||||
// After the load finishes, the iframe process should not know about
|
||||
// the permissions of its base domain.
|
||||
await content.SpecialPowers.spawn(iframe, [], async function() {
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"https://example.com"
|
||||
),
|
||||
"perm4"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"perm4-5"
|
||||
);
|
||||
|
||||
// In Fission not across schemes, though.
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
|
@ -266,7 +327,36 @@ add_task(async function() {
|
|||
),
|
||||
"perm1"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"perm1-5"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://example.com"
|
||||
),
|
||||
"newperm1"
|
||||
),
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"newperm1-2"
|
||||
);
|
||||
});
|
||||
|
||||
// The parent process should still have no permission under Fission.
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"http://example.com"
|
||||
),
|
||||
"perm1"
|
||||
),
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"perm1-4"
|
||||
);
|
||||
is(
|
||||
|
@ -276,8 +366,22 @@ add_task(async function() {
|
|||
),
|
||||
"newperm1"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"newperm1-4"
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"newperm1-3"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"https://example.com"
|
||||
),
|
||||
"perm4"
|
||||
),
|
||||
SpecialPowers.useRemoteSubframes
|
||||
? Services.perms.UNKNOWN_ACTION
|
||||
: Services.perms.ALLOW_ACTION,
|
||||
"perm4-6"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -287,7 +391,7 @@ add_task(async function() {
|
|||
"perm2"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"perm2-4"
|
||||
"perm2-5"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -297,7 +401,7 @@ add_task(async function() {
|
|||
"newperm2"
|
||||
),
|
||||
Services.perms.UNKNOWN_ACTION,
|
||||
"newperm2-4"
|
||||
"newperm2-2"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
@ -317,27 +421,7 @@ add_task(async function() {
|
|||
"newperm3"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"newperm3-4"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"https://example.com"
|
||||
),
|
||||
"perm4"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"perm4-4"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
"https://example.com"
|
||||
),
|
||||
"newperm4"
|
||||
),
|
||||
Services.perms.ALLOW_ACTION,
|
||||
"newperm4-4"
|
||||
"newperm3-2"
|
||||
);
|
||||
is(
|
||||
Services.perms.testPermissionFromPrincipal(
|
||||
|
|
Загрузка…
Ссылка в новой задаче