Skip to content

Commit

Permalink
Bug 1268159 - followup, update some tests that got missed in the conv…
Browse files Browse the repository at this point in the history
…ersion from straight quotes to curly quotes and revert the Sync client name change until a follow-up bug can track down the deeper regression. r=me on a CLOSED TREE.

MozReview-Commit-ID: 13k7s3n7jz7
  • Loading branch information
msujaws committed Apr 29, 2016
1 parent e889366 commit a9e6a47
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ let gWhitelist = [{
file: "netErrorApp.dtd",
key: "securityOverride.warningContent",
type: "single-quote"
}, {
file: "sync.properties",
key: "client.name2",
type: "apostrophe"
}
];

Expand Down
2 changes: 1 addition & 1 deletion services/sync/locales/en-US/sync.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# %1: the user name (Ed), %2: the app name (Firefox), %3: the operating system (Android)
client.name2 = %1$Ss %2$S on %3$S
client.name2 = %1$S's %2$S on %3$S

# %S is the date and time at which the last sync successfully completed
lastSync2.label = Last sync: %S
Expand Down
24 changes: 12 additions & 12 deletions toolkit/components/extensions/test/xpcshell/test_csp_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ add_task(function* test_csp_validator() {
null);

checkPolicy("",
"Policy is missing a required 'script-src' directive");
"Policy is missing a required \u2018script-src\u2019 directive");

checkPolicy("object-src 'none';",
"Policy is missing a required 'script-src' directive");
"Policy is missing a required \u2018script-src\u2019 directive");


checkPolicy("default-src 'self'", null,
Expand All @@ -39,47 +39,47 @@ add_task(function* test_csp_validator() {


checkPolicy("default-src 'self'; script-src http://example.com",
"'script-src' directive contains a forbidden http: protocol source",
"\u2018script-src\u2019 directive contains a forbidden http: protocol source",
"A valid default-src should not allow an invalid script-src directive");

checkPolicy("default-src 'self'; object-src http://example.com",
"'object-src' directive contains a forbidden http: protocol source",
"\u2018object-src\u2019 directive contains a forbidden http: protocol source",
"A valid default-src should not allow an invalid object-src directive");


checkPolicy("script-src 'self';",
"Policy is missing a required 'object-src' directive");
"Policy is missing a required \u2018object-src\u2019 directive");

checkPolicy("script-src 'none'; object-src 'none'",
"'script-src' must include the source 'self'");
"\u2018script-src\u2019 must include the source 'self'");

checkPolicy("script-src 'self'; object-src 'none';",
null);

checkPolicy("script-src 'self' 'unsafe-inline'; object-src 'self';",
"'script-src' directive contains a forbidden 'unsafe-inline' keyword");
"\u2018script-src\u2019 directive contains a forbidden 'unsafe-inline' keyword");


let directives = ["script-src", "object-src"];

for (let [directive, other] of [directives, directives.slice().reverse()]) {
for (let src of ["https://*", "https://*.blogspot.com", "https://*"]) {
checkPolicy(`${directive} 'self' ${src}; ${other} 'self';`,
`https: wildcard sources in '${directive}' directives must include at least one non-generic sub-domain (e.g., *.example.com rather than *.com)`);
`https: wildcard sources in \u2018${directive}\u2019 directives must include at least one non-generic sub-domain (e.g., *.example.com rather than *.com)`);
}

checkPolicy(`${directive} 'self' https:; ${other} 'self';`,
`https: protocol requires a host in '${directive}' directives`);
`https: protocol requires a host in \u2018${directive}\u2019 directives`);

checkPolicy(`${directive} 'self' http://example.com; ${other} 'self';`,
`'${directive}' directive contains a forbidden http: protocol source`);
`\u2018${directive}\u2019 directive contains a forbidden http: protocol source`);

for (let protocol of ["http", "ftp", "meh"]) {
checkPolicy(`${directive} 'self' ${protocol}:; ${other} 'self';`,
`'${directive}' directive contains a forbidden ${protocol}: protocol source`);
`\u2018${directive}\u2019 directive contains a forbidden ${protocol}: protocol source`);
}

checkPolicy(`${directive} 'self' 'nonce-01234'; ${other} 'self';`,
`'${directive}' directive contains a forbidden 'nonce-*' keyword`);
`\u2018${directive}\u2019 directive contains a forbidden 'nonce-*' keyword`);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ add_task(function* test_manifest_csp() {
equal(normalized.error, undefined, "Should not have an error");

Assert.deepEqual(normalized.errors,
["Error processing content_security_policy: SyntaxError: Policy is missing a required 'script-src' directive"],
["Error processing content_security_policy: SyntaxError: Policy is missing a required \u2018script-src\u2019 directive"],
"Should have the expected warning");

equal(normalized.value.content_security_policy, null,
Expand Down

0 comments on commit a9e6a47

Please sign in to comment.