From cf214c49bd96e5e4131ac66736f29c103f5da28f Mon Sep 17 00:00:00 2001 From: Mark Striemer Date: Fri, 31 Oct 2014 14:57:16 -0500 Subject: [PATCH] Allow precompile in manifests (bug 1087653) --- appvalidator/specs/webapps.py | 5 ++++- tests/test_webapp.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/appvalidator/specs/webapps.py b/appvalidator/specs/webapps.py index 23bb6f5..f55c279 100644 --- a/appvalidator/specs/webapps.py +++ b/appvalidator/specs/webapps.py @@ -123,7 +123,7 @@ class WebappSpec(Spec): "orientation", "fullscreen", "appcache_path", "type", "activities", "permissions", "csp", "messages", "origin", "redirects", - "permissions", "chrome", "inputs", "role"], + "chrome", "inputs", "role", "precompile"], "allowed_nodes": [], "disallowed_nodes": ["widget"], "child_nodes": { @@ -231,6 +231,9 @@ class WebappSpec(Spec): }, "process": lambda s: s.process_permissions }, + "precompile": { + "expected_type": list, + }, "csp": {"expected_type": types.StringTypes, "not_empty": True}, "messages": { diff --git a/tests/test_webapp.py b/tests/test_webapp.py index c9d096b..6807e33 100644 --- a/tests/test_webapp.py +++ b/tests/test_webapp.py @@ -95,6 +95,10 @@ class WebappBaseTestCase(TestCase): "orientation": "landscape", "fullscreen": "true", "type": "web", + "precompile": [ + "game.js", + "database.js" + ], } self.resources = [("app_type", "web")] @@ -1018,3 +1022,9 @@ class TestWebapps(WebappBaseTestCase): self.data["chrome"] = [] self.analyze() self.assert_failed(with_errors=True) + + def test_precompile_wrong_format(self): + # "precompile" should be list of files not this weird dict. + self.data["precompile"] = {"foo.js": True} + self.analyze() + self.assert_failed(with_errors=True)