From 83d64ccda069e4a45e9fc2d52e316fbccf019ada Mon Sep 17 00:00:00 2001 From: Robbendebiene Date: Tue, 7 Jul 2026 20:56:36 +0000 Subject: [PATCH] =?UTF-8?q?Bug=201685123=20-=20Throw=20errors=20for=20?= =?UTF-8?q?=E2=80=9Ccontent=5Fsecurity=5Fpolicy=E2=80=9D=20manifest=20prop?= =?UTF-8?q?erty=20with=20invalid=20types=20r=3Drobwu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is required to allow throwing errors for the sandbox CSP implementation Differential Revision: https://phabricator.services.mozilla.com/D309522 --- .../extensions/schemas/manifest.json | 1 - ...st_ext_manifest_content_security_policy.js | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/toolkit/components/extensions/schemas/manifest.json b/toolkit/components/extensions/schemas/manifest.json index f5ff348b11c8..1534c9309d64 100644 --- a/toolkit/components/extensions/schemas/manifest.json +++ b/toolkit/components/extensions/schemas/manifest.json @@ -213,7 +213,6 @@ "content_security_policy": { "optional": true, - "onError": "warn", "choices": [ { "max_manifest_version": 2, diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js b/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js index ae34906f906b..d06d119dccbb 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js @@ -46,12 +46,12 @@ add_task(async function test_manifest_csp() { }); ExtensionTestUtils.failOnSchemaWarnings(true); + Assert.deepEqual(normalized.errors, [], "Should have no warnings"); + Assert.deepEqual( - normalized.errors, - [ - `Error processing content_security_policy: Expected string instead of {"extension_pages":"script-src 'self'; object-src 'none'"}`, - ], - "Should have the expected warning" + normalized.error, + `Error processing content_security_policy: Expected string instead of {"extension_pages":"script-src 'self'; object-src 'none'"}`, + "Should have the expected error" ); }); @@ -63,12 +63,12 @@ add_task(async function test_manifest_csp_v3() { }); ExtensionTestUtils.failOnSchemaWarnings(true); + Assert.deepEqual(normalized.errors, [], "Should have no warnings"); + Assert.deepEqual( - normalized.errors, - [ - `Error processing content_security_policy: Expected object instead of "script-src 'self'; object-src 'none'"`, - ], - "Should have the expected warning" + normalized.error, + `Error processing content_security_policy: Expected object instead of "script-src 'self'; object-src 'none'"`, + "Should have the expected error" ); normalized = await ExtensionTestUtils.normalizeManifest({