summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_bug482659.html
blob: df2c66a747e342f858cb54bacd630f5d5d7d4afa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=482659
-->
<head>
  <title>Test for Bug 482659</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=482659">Mozilla Bug 482659</a>
<p id="display">
  <iframe></iframe>
  <iframe src="about:blank"></iframe>
  <iframe></iframe>
  <iframe src="about:blank"></iframe>
</p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 482659 **/
SimpleTest.waitForExplicitFinish()

function testFrame(num) {
  is(window.frames[num].document.baseURI, document.baseURI,
     "Unexpected base URI in frame " + num);
  is(window.frames[num].document.documentURI, "about:blank",
     "Unexpected document URI in frame " + num);
}

function appendScript(doc) {
  var s = doc.createElement("script");
  s.textContent = "document.write('executed'); document.close()";
  doc.body.appendChild(s);
}

function verifyScriptRan(num) {
  is(window.frames[num].document.documentElement.textContent, "executed",
     "write didn't happen in frame " + num);
}

addLoadEvent(function() {
/* document.write part of test disabled due to bug 483818
  appendScript(window.frames[2].document);
  appendScript(window.frames[3].document);

  verifyScriptRan(2);
  verifyScriptRan(3);
*/
  for (var i = 0; i < 4; ++i) {
    testFrame(i);
  }

  SimpleTest.finish();
});

</script>
</pre>
</body>
</html>