test_interfaceToString.html (1336B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=742156 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 742156</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742156">Mozilla Bug 742156</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 742156 */ 22 23 var nativeToString = ("" + String).replace("String", "EventTarget"); 24 try { 25 var eventTargetToString = "" + EventTarget; 26 is(eventTargetToString, nativeToString, 27 "Stringifying a DOM interface object should return the same string" + 28 "as stringifying a native function."); 29 } catch (e) { 30 ok(false, "Stringifying a DOM interface object shouldn't throw."); 31 } 32 33 try { 34 eventTargetToString = Function.prototype.toString.call(EventTarget); 35 is(eventTargetToString, nativeToString, 36 "Stringifying a DOM interface object via Function.prototype.toString " + 37 "should return the same string as stringifying a native function."); 38 } catch (e) { 39 ok(false, "Stringifying a DOM interface object shouldn't throw."); 40 } 41 42 </script> 43 </pre> 44 </body> 45 </html>