test_bug629845.html (1536B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=629845 5 --> 6 <head> 7 <title>Test for Bug 629845</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.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=629845">Mozilla Bug 629845</a> 14 <p id="display"></p> 15 16 <script> 17 function initFrame(frame) { 18 frame.contentWindow.document.designMode = "on"; 19 frame.contentWindow.document.writeln("<body></body>"); 20 21 document.getElementsByTagName("button")[0].click(); 22 } 23 24 function handleCommand(aName) { 25 var frame = document.getElementsByTagName("iframe")[0]; 26 27 is(frame.contentDocument.designMode, "on", "design mode should be on!"); 28 var caught = false; 29 try { 30 frame.contentDocument.execCommand(aName, false, null); 31 } catch (e) { 32 ok(false, "exception " + e + " was thrown"); 33 caught = true; 34 } 35 36 ok(!caught, "No exception should have been thrown."); 37 38 // Stop the document load before finishing, just to be clean. 39 document.getElementsByTagName("iframe")[0].contentWindow.document.close(); 40 SimpleTest.finish(); 41 } 42 </script> 43 44 <div id="content"> 45 <button type="button" onclick="handleCommand('bold');">Bold</button> 46 <iframe onload="initFrame(this);"></iframe> 47 </div> 48 <pre id="test"> 49 <script type="application/javascript"> 50 51 /** Test for Bug 629845 */ 52 53 SimpleTest.waitForExplicitFinish(); 54 55 </script> 56 </pre> 57 </body> 58 </html>