layout/forms/test/test_bug477700.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:49a6d31b9b95
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=477700
5 -->
6 <head>
7 <title>Test for Bug 477700</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=477700">Mozilla Bug 477700</a>
13 <p id="display">
14 <iframe id="i"
15 src="http://example.com/tests/layout/forms/test/bug477700_subframe.html"></iframe>
16 </p>
17 <div id="content" style="display: none">
18
19 </div>
20 <pre id="test">
21 <script type="application/javascript">
22
23 /** Test for Bug 477700 **/
24 SimpleTest.waitForExplicitFinish();
25 addLoadEvent(function() {
26 isnot(window.location.host, "example.com", "test is not testing cross-site");
27 var accessed = false;
28 try {
29 $("i").contentDocument.documentElement;
30 accessed = true;
31 } catch(e) {}
32 is(accessed, false, "Shouldn't be able to access cross-site");
33
34 $("i").style.display = "none";
35 document.body.offsetWidth;
36 is(document.defaultView.getComputedStyle($("i"), "").display, "none",
37 "toggling display failed");
38 $("i").style.display = "";
39 document.body.offsetWidth;
40 is(document.defaultView.getComputedStyle($("i"), "").display, "inline",
41 "toggling display back failed");
42
43 $("i").contentWindow.postMessage("start", "*");
44 });
45
46 window.addEventListener("message",
47 function(evt) {
48 var arr = evt.data.split(/ /).map(decodeURIComponent);
49 if (arr[0] == 't') {
50 is(arr[1], arr[2], arr[3]);
51 } else if (arr[0] == 'f') {
52 SimpleTest.finish();
53 }
54 },
55 false);
56
57 </script>
58 </pre>
59 </body>
60 </html>

mercurial