editor/libeditor/html/tests/test_bug635636.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug635636.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=635636
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 635636</title>
    1.11 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=635636">Mozilla Bug 635636</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content">
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 635636 **/
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +addLoadEvent(function() {
    1.26 +  var w, d;
    1.27 +
    1.28 +  function b1()
    1.29 +  {
    1.30 +    w = window.open('data:application/xhtml+xml,<html xmlns="http://www.w3.org/1999/xhtml"><div>1</div></html>');
    1.31 +    SimpleTest.waitForFocus(b2, w);
    1.32 +  }
    1.33 +
    1.34 +  function b2()
    1.35 +  {
    1.36 +    w.document.designMode = 'on';
    1.37 +    w.location = "data:text/plain,2";
    1.38 +    d = w.document.getElementsByTagName("div")[0];
    1.39 +    const Ci = Components.interfaces;
    1.40 +    var mainWindow = w.QueryInterface(Ci.nsIInterfaceRequestor)
    1.41 +                      .getInterface(Ci.nsIWebNavigation)
    1.42 +                      .QueryInterface(Ci.nsIDocShellTreeItem)
    1.43 +                      .rootTreeItem
    1.44 +                      .QueryInterface(Ci.nsIInterfaceRequestor)
    1.45 +                      .getInterface(Ci.nsIDOMWindow);
    1.46 +    var browser = mainWindow.gBrowser.selectedBrowser;
    1.47 +    browser.addEventListener("pageshow", function() {
    1.48 +      setTimeout(b3, 0);
    1.49 +    }, false);
    1.50 +  }
    1.51 +
    1.52 +  function b3()
    1.53 +  {
    1.54 +    d.parentNode.removeChild(d);
    1.55 +    ok(true, "Should not crash");
    1.56 +    // Not needed for the crash
    1.57 +    w.close();
    1.58 +    SimpleTest.finish();
    1.59 +  }
    1.60 +
    1.61 +  b1();
    1.62 +});
    1.63 +
    1.64 +</script>
    1.65 +</pre>
    1.66 +</body>
    1.67 +</html>

mercurial