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

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     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>
     8 <iframe id="frame448329"></iframe>
    10 <script>
    12 function test448329(id,cmd) {
    14   var elm = document.getElementById(id);
    15   var doc = elm.contentDocument;
    16   doc.designMode = "On";
    18   // Work around getSelection depending on a presshell but not flushing to get
    19   // one.
    20   doc.body.offsetWidth;
    21   var s = doc.defaultView.getSelection();
    23   // Test document node
    24   if (s.rangeCount > 0)
    25     s.removeAllRanges();
    26   var range = doc.createRange();
    27   range.setStart(doc, 0);
    28   range.setEnd(doc, 0);
    29   s.addRange(range);
    30   doc.queryCommandIndeterm(cmd);
    32   // Test HTML node
    33   if (s.rangeCount > 0)
    34     s.removeAllRanges();
    35   range = doc.createRange();
    36   range.setStart(doc.documentElement, 0);
    37   range.setEnd(doc.documentElement, 0);
    38   s.addRange(range);
    39   doc.queryCommandIndeterm(cmd);
    41   // Test BODY node
    42   if (s.rangeCount > 0)
    43     s.removeAllRanges();
    44   range = doc.createRange();
    45   var body = doc.documentElement.childNodes[1];
    46   range.setStart(body, 0);
    47   range.setEnd(body, 0);
    48   s.addRange(range);
    49   doc.queryCommandIndeterm(cmd);
    51   var text = doc.createTextNode("Hello Kitty");
    52   body.insertBefore(text, null)
    54   // Test TEXT node
    55   if (s.rangeCount > 0)
    56     s.removeAllRanges();
    57   range = doc.createRange();
    58   range.setStart(text, 0);
    59   range.setEnd(text, 1);
    60   s.addRange(range);
    61   doc.queryCommandIndeterm(cmd);
    63 }
    65 test448329("frame448329", "backcolor")
    66 test448329("frame448329", "hilitecolor")
    68 </script>
    71 </body>
    72 </html>

mercurial