diff --git a/addons/addObserver.xpi b/addons/addObserver.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/addObserver.xpi differ diff --git a/addons/evalInSandbox.xpi b/addons/evalInSandbox.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/evalInSandbox.xpi differ diff --git a/addons/illegal-access-eval.xpi b/addons/illegal-access-eval.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/illegal-access-eval.xpi differ diff --git a/addons/illegal-access-function.xpi b/addons/illegal-access-function.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/illegal-access-function.xpi differ diff --git a/addons/innerHTML-dynamically-set.xpi b/addons/innerHTML-dynamically-set.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/innerHTML-dynamically-set.xpi differ diff --git a/addons/javascript-complie-time-error.xpi b/addons/javascript-complie-time-error.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/javascript-complie-time-error.xpi differ diff --git a/addons/mozIJSSubScriptLoader.xpi b/addons/mozIJSSubScriptLoader.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/mozIJSSubScriptLoader.xpi differ diff --git a/addons/on-property.xpi b/addons/on-property.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/on-property.xpi differ diff --git a/addons/registerFactory-called-dangerously.xpi b/addons/registerFactory-called-dangerously.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/registerFactory-called-dangerously.xpi differ diff --git a/addons/setInterval.xpi b/addons/setInterval.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/setInterval.xpi differ diff --git a/addons/setSubstitution.xpi b/addons/setSubstitution.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/setSubstitution.xpi differ diff --git a/addons/setTimeout.xpi b/addons/setTimeout.xpi new file mode 100644 index 0000000..5810847 Binary files /dev/null and b/addons/setTimeout.xpi differ diff --git a/addons/unsafe-preference-branch.xpi b/addons/unsafe-preference-branch.xpi new file mode 100644 index 0000000..277f034 Binary files /dev/null and b/addons/unsafe-preference-branch.xpi differ diff --git a/test_validator.py b/test_validator.py index 31bdfe9..67b107f 100644 --- a/test_validator.py +++ b/test_validator.py @@ -124,6 +124,67 @@ def test_variable_element(self): self.validate('glee-20101227219.xpi') self.expectMsg(u'Variable element type being created') + def test_illegal_eval(self): + self.validate('illegal-access-eval.xpi') + self.expectMsg(u"Illegal or deprecated access to the 'eval'" + u" global") + + def test_illegal_function(self): + self.validate('illegal-access-function.xpi') + self.expectMsg(u"Illegal or deprecated access to the 'Function'" + u" global") + + def test_javascript_compile_time_error(self): + self.validate('javascript-complie-time-error.xpi') + self.expectMsg(u'JavaScript Compile-Time Error') + + def test_innerHTML_set_dynamically(self): + self.validate('innerHTML-dynamically-set.xpi') + self.expectMsg(u'innerHTML should not be set dynamically') + + def test_setSubstitution_called_dangerously(self): + self.validate('setSubstitution.xpi') + self.expectMsg(u"'setSubstitution' function called in potentially " + u"dangerous manner") + + def test_mozIJSSubScriptLoader_illegal_access(self): + self.validate('mozIJSSubScriptLoader.xpi') + self.expectMsg(u"Illegal or deprecated access to the " + u"'mozIJSSubScriptLoader' global") + + def test_unsafe_preference_branch(self): + self.validate('unsafe-preference-branch.xpi') + self.expectMsg(u'Potentially unsafe preference branch referenced') + + def test_on_propertyt(self): + self.validate('on-property.xpi') + self.expectMsg(u'on* property being assigned string') + + def test_setInterval_called_dangerously(self): + self.validate('setInterval.xpi') + self.expectMsg(u"'setInterval' function called in potentially " + u"dangerous manner") + + def test_evalInSandbox_illegal_access(self): + self.validate('evalInSandbox.xpi') + self.expectMsg(u"Illegal or deprecated access to the " + u"'evalInSandbox' global") + + def test_addObserver_called_dangerously(self): + self.validate('addObserver.xpi') + self.expectMsg(u"'addObserver' function called in potentially " + u"dangerous manner") + + def test_registerFactory_called_dangerously(self): + self.validate('registerFactory-called-dangerously.xpi') + self.expectMsg(u"'registerFactory' function called in potentially " + u"dangerous manner") + + def test_setTimeout_called_dangerously(self): + self.validate('setTimeout.xpi') + self.assertPartialMsg(u"'setTimeout' function called in potentially " + u"dangerous manner") + class GeneralTests(ValidatorTest):