Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / bindings / test / test_lenientThis.html
blobf4fb4200a5da9c1f7f8d8c080def9cb5143046e7
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>[LenientThis]</title>
4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script>
6 <div id=log></div>
7 <script>
8 /* global test, assert_equals */
9 function noop1() { }
10 function noop2() { }
12 test(function() {
13 var desc = Object.getOwnPropertyDescriptor(Document.prototype, "onreadystatechange");
15 document.onreadystatechange = noop1;
16 assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1");
17 assert_equals(desc.get.call({ }), undefined, "document.onreadystatechange getter.call({}) == undefined");
18 }, "invoking Document.onreadystatechange's getter with an invalid this object returns undefined");
20 test(function() {
21 var desc = Object.getOwnPropertyDescriptor(Document.prototype, "onreadystatechange");
23 document.onreadystatechange = noop1;
24 assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1");
25 assert_equals(desc.set.call({ }, noop2), undefined, "document.onreadystatechange setter.call({}) == undefined");
26 assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1 (still)");
27 }, "invoking Document.onreadystatechange's setter with an invalid this object does nothing and returns undefined");
28 </script>