Bug 1640135 - P5: update tests; r=timhuang

Differential Revision: https://phabricator.services.mozilla.com/D77918
This commit is contained in:
Liang-Heng Chen 2020-06-04 10:51:28 +00:00
Родитель 01f8cce7e1
Коммит bc5fda4e76
6 изменённых файлов: 13 добавлений и 9 удалений

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

@ -55,6 +55,7 @@ add_task(async function test_deserialize_principal_with_csp() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
}, },
}, },
@ -69,6 +70,7 @@ add_task(async function test_deserialize_principal_with_csp() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
// Within Bug 965637 we removed CSP from Principals. Already serialized Principals however should still deserialize correctly (just without the CSP). // Within Bug 965637 we removed CSP from Principals. Already serialized Principals however should still deserialize correctly (just without the CSP).
// "cspJSON": "{\"csp-policies\":[{\"child-src\":[\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://www.youtube-nocookie.com\",\"https://trackertest.org\",\"https://www.surveygizmo.com\",\"https://accounts.firefox.com\",\"https://accounts.firefox.com.cn\",\"https://www.youtube.com\"],\"connect-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://accounts.firefox.com/\",\"https://accounts.firefox.com.cn/\"],\"default-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\"],\"frame-src\":[\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://www.youtube-nocookie.com\",\"https://trackertest.org\",\"https://www.surveygizmo.com\",\"https://accounts.firefox.com\",\"https://accounts.firefox.com.cn\",\"https://www.youtube.com\"],\"img-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"data:\",\"https://mozilla.org\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://adservice.google.com\",\"https://adservice.google.de\",\"https://adservice.google.dk\",\"https://creativecommons.org\",\"https://ad.doubleclick.net\"],\"report-only\":false,\"script-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"'unsafe-inline'\",\"'unsafe-eval'\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://tagmanager.google.com\",\"https://www.youtube.com\",\"https://s.ytimg.com\"],\"style-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"'unsafe-inline'\"]}]}", // "cspJSON": "{\"csp-policies\":[{\"child-src\":[\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://www.youtube-nocookie.com\",\"https://trackertest.org\",\"https://www.surveygizmo.com\",\"https://accounts.firefox.com\",\"https://accounts.firefox.com.cn\",\"https://www.youtube.com\"],\"connect-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://accounts.firefox.com/\",\"https://accounts.firefox.com.cn/\"],\"default-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\"],\"frame-src\":[\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://www.youtube-nocookie.com\",\"https://trackertest.org\",\"https://www.surveygizmo.com\",\"https://accounts.firefox.com\",\"https://accounts.firefox.com.cn\",\"https://www.youtube.com\"],\"img-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"data:\",\"https://mozilla.org\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://adservice.google.com\",\"https://adservice.google.de\",\"https://adservice.google.dk\",\"https://creativecommons.org\",\"https://ad.doubleclick.net\"],\"report-only\":false,\"script-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"'unsafe-inline'\",\"'unsafe-eval'\",\"https://www.googletagmanager.com\",\"https://www.google-analytics.com\",\"https://tagmanager.google.com\",\"https://www.youtube.com\",\"https://s.ytimg.com\"],\"style-src\":[\"'self'\",\"https://*.mozilla.net\",\"https://*.mozilla.org\",\"https://*.mozilla.com\",\"'unsafe-inline'\"]}]}",

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

@ -80,6 +80,7 @@ add_task(async function test_realHistoryCheck() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
}, },
}, },
@ -95,6 +96,7 @@ add_task(async function test_realHistoryCheck() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
}, },
}, },
@ -108,6 +110,7 @@ add_task(async function test_realHistoryCheck() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
}, },
}, },
@ -122,6 +125,7 @@ add_task(async function test_realHistoryCheck() {
privateBrowsingId: 0, privateBrowsingId: 0,
userContextId: 0, userContextId: 0,
geckoViewSessionContextId: "", geckoViewSessionContextId: "",
partitionKey: "",
}, },
}, },
}, },

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

@ -16,10 +16,10 @@ const HAS_FIRST_PARTY_DOMAIN = [
const OUTER_ORIGIN = "http://mochi.test:8888"; const OUTER_ORIGIN = "http://mochi.test:8888";
const FIRST_PARTY_DOMAIN = escape("(http,mochi.test)"); const FIRST_PARTY_DOMAIN = escape("(http,mochi.test)");
const INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN const INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN
? `http://example.com^firstPartyDomain=${FIRST_PARTY_DOMAIN}` ? `http://example.com^partitionKey=${FIRST_PARTY_DOMAIN}`
: "http://example.com"; : "http://example.com";
const SECURE_INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN const SECURE_INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN
? `https://example.com^firstPartyDomain=${FIRST_PARTY_DOMAIN}` ? `https://example.com^partitionKey=${FIRST_PARTY_DOMAIN}`
: "https://example.com"; : "https://example.com";
const OUTER_VALUE = "outer-value-" + RAND; const OUTER_VALUE = "outer-value-" + RAND;

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

@ -62,7 +62,7 @@ add_task(async function() {
const tests = [ const tests = [
{ {
prefValue: true, prefValue: true,
originAttributes: { firstPartyDomain: "(http,example.org)" }, originAttributes: { partitionKey: "(http,example.org)" },
}, },
{ {
prefValue: false, prefValue: false,

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

@ -69,14 +69,13 @@ this.DynamicFPIHelper = {
ifr.onload = async _ => { ifr.onload = async _ => {
await SpecialPowers.spawn(ifr, [], async _ => { await SpecialPowers.spawn(ifr, [], async _ => {
is( is(
content.document.nodePrincipal.originAttributes content.document.nodePrincipal.originAttributes.partitionKey,
.firstPartyDomain,
"", "",
"We don't have first-party set on nodePrincipal" "We don't have first-party set on nodePrincipal"
); );
is( is(
content.document.effectiveStoragePrincipal.originAttributes content.document.effectiveStoragePrincipal.originAttributes
.firstPartyDomain, .partitionKey,
"(http,example.net)", "(http,example.net)",
"We have first-party set on storagePrincipal" "We have first-party set on storagePrincipal"
); );

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

@ -71,14 +71,13 @@ this.StoragePrincipalHelper = {
ifr.onload = async _ => { ifr.onload = async _ => {
await SpecialPowers.spawn(ifr, [], async _ => { await SpecialPowers.spawn(ifr, [], async _ => {
is( is(
content.document.nodePrincipal.originAttributes content.document.nodePrincipal.originAttributes.partitionKey,
.firstPartyDomain,
"", "",
"We don't have first-party set on nodePrincipal" "We don't have first-party set on nodePrincipal"
); );
is( is(
content.document.effectiveStoragePrincipal.originAttributes content.document.effectiveStoragePrincipal.originAttributes
.firstPartyDomain, .partitionKey,
"(http,example.net)", "(http,example.net)",
"We have first-party set on storagePrincipal" "We have first-party set on storagePrincipal"
); );