diff --git a/appvalidator/testcases/javascript/actions.py b/appvalidator/testcases/javascript/actions.py
index bc8e6c4..d254fb5 100644
--- a/appvalidator/testcases/javascript/actions.py
+++ b/appvalidator/testcases/javascript/actions.py
@@ -395,7 +395,7 @@ def _call_expression(traverser, node):
if member.is_global and "return" in member.value:
return member.value["return"](wrapper=member, arguments=args,
traverser=traverser)
- return True
+ return JSWrapper(traverser=traverser)
def _call_settimeout(a, t, e):
diff --git a/appvalidator/testcases/javascript/instanceproperties.py b/appvalidator/testcases/javascript/instanceproperties.py
index 6e839e9..60ae540 100644
--- a/appvalidator/testcases/javascript/instanceproperties.py
+++ b/appvalidator/testcases/javascript/instanceproperties.py
@@ -5,6 +5,10 @@ from appvalidator.constants import BUGZILLA_BUG
import jstypes
+EVENT_ASSIGNMENT = re.compile("<.+ on[a-z]+=")
+JS_URL = re.compile("href=[\'\"]javascript:")
+
+
def set_innerHTML(new_value, traverser):
"""Tests that values being assigned to innerHTML are not dangerous."""
return _set_HTML_property("innerHTML", new_value, traverser)
@@ -24,9 +28,8 @@ def _set_HTML_property(function, new_value, traverser):
if isinstance(literal_value, types.StringTypes):
# Static string assignments
- # Test for on* attributes
- event_assignment = re.compile("<.+ on[a-z]+=")
- if event_assignment.search(literal_value.lower()):
+ # Test for on* attributes and script tags.
+ if EVENT_ASSIGNMENT.search(literal_value.lower()):
traverser.err.warning(
err_id=("testcases_javascript_instancetypes",
"set_%s" % function, "event_assignment"),
@@ -41,6 +44,21 @@ def _set_HTML_property(function, new_value, traverser):
line=traverser.line,
column=traverser.position,
context=traverser.context)
+ elif ("";
+ x.innerHTML = "";
""")
self.assert_failed(with_errors=True)
+ def test_function_return(self):
+ """
+ Test that the return value of a function is considered a dynamic value.
+ """
+
+ self.run_script("""
+ x.innerHTML = foo();
+ """)
+ self.assert_failed()
+
class TestOnProperties(TestCase):