test_jsimplemented_eventhandler.html (1309B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1186696 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1186696</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 /* global TestInterfaceJS */ 13 /** Test for Bug 1186696 */ 14 SimpleTest.waitForExplicitFinish(); 15 16 function doTest() { 17 var values = [ function() {}, 5, null, undefined, "some string", {} ]; 18 19 while (values.length) { 20 var value = values.pop(); 21 var t = new TestInterfaceJS(); 22 t.onsomething = value; 23 var gottenValue = t.onsomething; 24 if (typeof value == "object" || typeof value == "function") { 25 is(gottenValue, value, "Should get back the object-or-null we put in"); 26 } else { 27 is(gottenValue, null, "Should get back null"); 28 } 29 } 30 31 SimpleTest.finish(); 32 } 33 34 SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, 35 doTest); 36 </script> 37 </head> 38 <body> 39 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1186696">Mozilla Bug 1186696</a> 40 <p id="display"></p> 41 <div id="content" style="display: none"> 42 43 </div> 44 <pre id="test"> 45 </pre> 46 </body> 47 </html>