Permalink
Browse files

Dirty objects should not throw `handleEvent` errors.

And Kris didn't file a bug for it.
  • Loading branch information...
mattbasta committed Sep 28, 2012
1 parent a091905 commit 87d69b98ad9ef0d67a9d243676fd503e04f7bd54
Showing with 17 additions and 1 deletion.
  1. +15 −0 tests/test_js_instanceproperties.py
  2. +2 −1 validator/testcases/javascript/instanceproperties.py
@@ -136,3 +136,18 @@ def test_on_event_handleEvent_fail(self):
""")
self.assert_failed(with_errors=True)
+ def test_on_event_handleEvent_ignore(self):
+ """
+ Test that dirty objects don't trigger handleEvent errors.
+ """
+
+ self.setup_err(for_appversions=FX18_DEFINITION)
+
+ self.run_script("""
+ var dirty = this_creates_a_dirty_object();
+ foo.onclick = dirty;
+ """)
+ self.assert_silent()
+
+
+
@@ -104,7 +104,8 @@ def set_on_event(new_value, traverser):
line=traverser.line,
column=traverser.position,
context=traverser.context)
- elif not is_literal and new_value.has_property("handleEvent"):
+ elif (not is_literal and isinstance(new_value.value, jstypes.JSObject) and
+ "handleEvent" in new_value.value.data):
mess_type = (traverser.err.error if
traverser.err.supports_version(FX18_DEFINITION) else
traverser.err.warning)

0 comments on commit 87d69b9

Please sign in to comment.