dom/tests/mochitest/bugs/test_bug335976.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/bugs/test_bug335976.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=335976
     1.7 +-->
     1.8 +<head>
     1.9 +  <title>Test for Bug 335976</title>
    1.10 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.11 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.12 +</head>
    1.13 +<body>
    1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=335976">Mozilla Bug 335976</a>
    1.15 +<p id="display"></p>
    1.16 +
    1.17 +<iframe src="data:application/xhtml+xml,&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;body&gt; &lt;textbox xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'/&gt; &lt;/body&gt;&lt;/html&gt;" style="width: 95%; height: 150px;"></iframe>
    1.18 +
    1.19 +<div id="rootish" style="background: yellow">
    1.20 +  <div>
    1.21 +    <textbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
    1.22 +  </div>
    1.23 +</div>
    1.24 +
    1.25 +
    1.26 +<div id="content" style="display: none">
    1.27 +  
    1.28 +</div>
    1.29 +<pre id="test">
    1.30 +<script class="testbody" type="text/javascript">
    1.31 +<![CDATA[
    1.32 +
    1.33 +function lookAtTextboxesIn(root, numExpected) 
    1.34 +{
    1.35 +  var textboxes = root.getElementsByTagName("textbox");
    1.36 +  var threw;
    1.37 +  var i;
    1.38 +  var n;
    1.39 +  
    1.40 +  for (i = 0; n = textboxes[i]; ++i) {
    1.41 +    threw = true;
    1.42 +    try { n.nodeType; threw = false; } catch(e) { }
    1.43 +    ok(!threw, "n.nodeType threw");
    1.44 +  }
    1.45 +
    1.46 +  ok(textboxes.length == numExpected, "Wrong number of textboxes");
    1.47 +}
    1.48 +
    1.49 +function init()
    1.50 +{
    1.51 +  // Look at the textbox in the yellow div.
    1.52 +  lookAtTextboxesIn(document.getElementById('rootish'), 1);
    1.53 +
    1.54 +  // Move the yellow div into the iframe.
    1.55 +  var nd = window.frames[0].document; 
    1.56 +  nd.body.appendChild(nd.adoptNode(document.getElementById('rootish')));
    1.57 +  
    1.58 +  // Look at the textboxes in the iframe.
    1.59 +  lookAtTextboxesIn(window.frames[0].document.body, 2);
    1.60 +  
    1.61 +  SimpleTest.finish();
    1.62 +}
    1.63 +
    1.64 +SimpleTest.waitForExplicitFinish();
    1.65 +addLoadEvent(init);
    1.66 +
    1.67 +]]>
    1.68 +</script>
    1.69 +</pre>
    1.70 +</body>
    1.71 +</html>

mercurial