diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/security/test/gtest/TestCSPParser.cpp | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/test/gtest/TestCSPParser.cpp')
-rw-r--r-- | dom/security/test/gtest/TestCSPParser.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/dom/security/test/gtest/TestCSPParser.cpp b/dom/security/test/gtest/TestCSPParser.cpp index 19ba0548de..388055f388 100644 --- a/dom/security/test/gtest/TestCSPParser.cpp +++ b/dom/security/test/gtest/TestCSPParser.cpp @@ -152,9 +152,14 @@ nsresult runTestSuite(const PolicyTest* aPolicies, uint32_t aPolicyCount, // Add prefs you need to set to parse CSP here, see comments for example // bool examplePref = false; + bool trustedTypesEnabled = false; + constexpr auto kTrustedTypesEnabledPrefName = + "dom.security.trusted_types.enabled"; if (prefs) { // prefs->GetBoolPref("security.csp.examplePref", &examplePref); // prefs->SetBoolPref("security.csp.examplePref", true); + prefs->GetBoolPref(kTrustedTypesEnabledPrefName, &trustedTypesEnabled); + prefs->SetBoolPref(kTrustedTypesEnabledPrefName, true); } for (uint32_t i = 0; i < aPolicyCount; i++) { @@ -165,6 +170,7 @@ nsresult runTestSuite(const PolicyTest* aPolicies, uint32_t aPolicyCount, if (prefs) { // prefs->SetBoolPref("security.csp.examplePref", examplePref); + prefs->SetBoolPref(kTrustedTypesEnabledPrefName, trustedTypesEnabled); } return NS_OK; @@ -220,6 +226,11 @@ TEST(CSPParser, Directives) "worker-src http://worker.com; frame-src http://frame.com; child-src http://child.com" }, { "script-src 'unsafe-allow-redirects' http://example.com", "script-src http://example.com"}, + { "require-trusted-types-for 'script'", + "require-trusted-types-for 'script'" }, + { "trusted-types somePolicyName", "trusted-types somePolicyName" }, + { "trusted-types somePolicyName anotherPolicyName 1 - # = _ / @ . % *", + "trusted-types somePolicyName anotherPolicyName 1 - # = _ / @ . % *" }, // clang-format on }; @@ -247,6 +258,11 @@ TEST(CSPParser, Keywords) "script-src 'wasm-unsafe-eval'" }, { "img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'", "img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'" }, + { "trusted-types somePolicyName 'allow-duplicates'", + "trusted-types somePolicyName 'allow-duplicates'" }, + { "trusted-types 'none'", "trusted-types 'none'" }, + { "trusted-types", "trusted-types 'none'" }, + { "trusted-types *", "trusted-types *" }, // clang-format on }; @@ -589,6 +605,7 @@ TEST(CSPParser, BadPolicies) { "report-uri http://:foo", ""}, { "require-sri-for", ""}, { "require-sri-for style", ""}, + { "trusted-types $", ""}, // clang-format on }; |