/editor/libeditor/html/crashtests/448329-1.html

http://github.com/zpao/v8monkey · HTML · 72 lines · 57 code · 15 blank · 0 comment · 0 complexity · ca656d5f5545b1fa7d5c7195f6b6b1f4 MD5 · raw file

  1. <!DOCTYPE HTML>
  2. <html><head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <title>Testcase for bug 448329</title>
  5. </head>
  6. <body>
  7. <iframe id="frame448329"></iframe>
  8. <script>
  9. function test448329(id,cmd) {
  10. var elm = document.getElementById(id);
  11. var doc = elm.contentDocument;
  12. doc.designMode = "On";
  13. // Work around getSelection depending on a presshell but not flushing to get
  14. // one.
  15. doc.body.offsetWidth;
  16. var s = doc.defaultView.getSelection();
  17. // Test document node
  18. if (s.rangeCount > 0)
  19. s.removeAllRanges();
  20. var range = doc.createRange();
  21. range.setStart(doc, 0);
  22. range.setEnd(doc, 0);
  23. s.addRange(range);
  24. doc.queryCommandIndeterm(cmd);
  25. // Test HTML node
  26. if (s.rangeCount > 0)
  27. s.removeAllRanges();
  28. range = doc.createRange();
  29. range.setStart(doc.documentElement, 0);
  30. range.setEnd(doc.documentElement, 0);
  31. s.addRange(range);
  32. doc.queryCommandIndeterm(cmd);
  33. // Test BODY node
  34. if (s.rangeCount > 0)
  35. s.removeAllRanges();
  36. range = doc.createRange();
  37. var body = doc.documentElement.childNodes[1];
  38. range.setStart(body, 0);
  39. range.setEnd(body, 0);
  40. s.addRange(range);
  41. doc.queryCommandIndeterm(cmd);
  42. var text = doc.createTextNode("Hello Kitty");
  43. body.insertBefore(text, null)
  44. // Test TEXT node
  45. if (s.rangeCount > 0)
  46. s.removeAllRanges();
  47. range = doc.createRange();
  48. range.setStart(text, 0);
  49. range.setEnd(text, 1);
  50. s.addRange(range);
  51. doc.queryCommandIndeterm(cmd);
  52. }
  53. test448329("frame448329", "backcolor")
  54. test448329("frame448329", "hilitecolor")
  55. </script>
  56. </body>
  57. </html>