test_treat_non_object_as_null.html (1072B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=952365 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 952365</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 13 /** Test for Bug 952365 */ 14 15 var onvolumechange; 16 var x = {}; 17 18 (function() { 19 onvolumechange = x; 20 is(onvolumechange, x, 21 "Should preserve an object value when assigning to event handler"); 22 // Test that we don't try to actually call the non-callable object 23 window.dispatchEvent(new Event("volumechange")); 24 onvolumechange = 5; 25 is(onvolumechange, null, 26 "Non-object values should become null when assigning to event handler"); 27 })(); 28 </script> 29 </head> 30 <body> 31 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=952365">Mozilla Bug 952365</a> 32 <p id="display"></p> 33 <div id="content" style="display: none"> 34 35 </div> 36 <pre id="test"> 37 </pre> 38 </body> 39 </html>