| <!DOCTYPE html> |
| <title>[LenientThis] test</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script> |
| test(function() { |
| // GlobalEventHandlers.onmouseenter is [LenientThis]. |
| assert_equals(document.onmouseenter, null, "|this| is an appropriate object."); |
| assert_equals(Document.prototype.onmouseenter, undefined, "|this| is not an appropriate object."); |
| Document.prototype.onmouseenter = 'foo'; // must not throw. |
| assert_equals(Document.prototype.onmouseenter, undefined, "the value must not change."); |
| |
| // GlobalEventHandlers.onmousedown is NOT [LenientThis]. |
| assert_equals(document.onmousedown, null, "|this| is an appropriate object."); |
| assert_throws(null, function() { |
| Document.prototype.onmousedown; |
| }, "Document.prototype is invalid as |this|."); |
| assert_throws(null, function() { |
| Document.prototype.onmousedown = 'foo'; |
| }, "Document.prototype is invalid as |this|."); |
| }); |
| </script> |