From 814aa57c3ee3a36a8427f9999dd892d137c150b9 Mon Sep 17 00:00:00 2001 From: Matt Basta Date: Mon, 5 Nov 2012 16:50:48 -0800 Subject: [PATCH] Add support for "csp" elements (bug 807304) --- appvalidator/specs/webapps.py | 6 ++++-- tests/test_webapp.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/appvalidator/specs/webapps.py b/appvalidator/specs/webapps.py index f311ae4..453209f 100644 --- a/appvalidator/specs/webapps.py +++ b/appvalidator/specs/webapps.py @@ -39,7 +39,7 @@ class WebappSpec(Spec): "default_locale", "installs_allowed_from", "version", "screen_size", "required_features", "orientation", "fullscreen", "appcache_path", - "type", "activities", "permissions"], + "type", "activities", "permissions", "csp"], "allowed_nodes": ["developer"], "disallowed_nodes": ["widget"], "child_nodes": { @@ -143,7 +143,9 @@ class WebappSpec(Spec): } }, "process": lambda s: s.process_permissions - } + }, + "csp": {"expected_type": types.StringTypes, + "not_empty": True}, } } diff --git a/tests/test_webapp.py b/tests/test_webapp.py index eabe69c..c322d62 100644 --- a/tests/test_webapp.py +++ b/tests/test_webapp.py @@ -683,3 +683,8 @@ class TestWebapps(TestCase): self.data["permissions"]["settings"]["access"] = "createonly" self.analyze() self.assert_failed(with_errors=True) + + def test_csp(self): + self.data['csp'] = 'this is the csp policy. it can be a string.' + self.analyze() + self.assert_silent()