Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #44 from diox/mobileid-and-precompile-feature-dete…
Browse files Browse the repository at this point in the history
…ction

Detect navigator.getMobileIdAssertion() and precompile manifest option (bug 1098408)
  • Loading branch information
diox committed Nov 21, 2014
2 parents a74390c + 8ab7852 commit 4d1670b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions appvalidator/specs/webapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class WebappSpec(Spec):
},
"precompile": {
"expected_type": list,
"process": lambda s: s.process_precompile,
},
"csp": {"expected_type": types.StringTypes,
"not_empty": True},
Expand Down Expand Up @@ -704,6 +705,9 @@ def process_origin(self, node):
"Found origin: %s" % node,
self.MORE_INFO])

def process_precompile(self, node):
self.err.feature_profile.add('PRECOMPILE_ASMJS')

def parse(self, data):
if isinstance(data, types.StringTypes):
return json.loads(data, strict=True)
Expand Down
2 changes: 1 addition & 1 deletion appvalidator/testcases/javascript/predefinedentities.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def wrap(t):
u"mozTCPSocket": feature("TCPSOCKET"),
u"mozInputMethod": feature("THIRDPARTY_KEYBOARD_SUPPORT"),
u"mozMobileConnections": feature("NETWORK_INFO_MULTIPLE"),

u"getMobileIdAssertion": feature("MOBILE_ID"),
u"getUserMedia": entity("getUserMedia"),
}

Expand Down
1 change: 1 addition & 0 deletions tests/js/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class TestNavigatorFeatures(FeatureTester):
("FM", "navigator.mozFMRadio();"),
("SMS", "navigator.mozSms.foo();"),
("GAMEPAD", "navigator.getGamepad();"),
("MOBILE_ID", "navigator.getMobileIdAssertion();"),
("NOTIFICATION", "navigator.mozNotification.foo();"),
("ALARM", "navigator.mozAlarms.foo();"),
("TCPSOCKET", "var x = new navigator.mozTCPSocket();"),
Expand Down
5 changes: 5 additions & 0 deletions tests/test_webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,3 +1028,8 @@ def test_precompile_wrong_format(self):
self.data["precompile"] = {"foo.js": True}
self.analyze()
self.assert_failed(with_errors=True)

def test_precompile_feature(self):
self.analyze()
self.assert_silent()
self.assert_has_feature('PRECOMPILE_ASMJS')

0 comments on commit 4d1670b

Please sign in to comment.