Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=789713
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 789713</title>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=789713">Mozilla Bug 789713</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 <iframe id="ifr"></iframe>
17 </div>
18 <pre id="test">
19 <script type="application/javascript">
21 /** Test for Bug 789713 **/
23 function go() {
24 var pass = true;
25 var doc = document.getElementById('ifr').contentDocument;
27 // Tree walkers use nsDOMGenericSH, which has a spineless PreCreate.
28 var walker = doc.createTreeWalker(doc.body);
29 pass = pass && (walker.root === doc.body);
31 // Grab a reference to Object.prototype to make sure we test the machinery
32 // with respect to standard prototype remapping.
33 var objProto = ifr.contentWindow.Object.prototype;
35 // First, do the document.domain operation. This shouldn't crash.
36 document.domain = "example.org";
38 // Now, make sure that we still can't access cross-origin properties despite
39 // the fact that the WN is shared under the hood.
40 try {
41 walker.root;
42 pass = false;
43 } catch (e) { pass = pass && /Permission denied/.exec(e.message); }
44 window.parent.postMessage(pass, '*');
45 }
47 // We can't set document.domain on mochi.test, because it's forbidden to set
48 // document.domain to a TLD.
49 var ifr = document.getElementById('ifr');
50 if (window.location.hostname == "mochi.test") {
51 SimpleTest.waitForExplicitFinish();
52 ifr.src = window.location.toString().replace("mochi.test:8888", "test1.example.org").split('?')[0];
53 window.onmessage = function(message) { ok(message.data, "Test succeeded and didn't crash"); SimpleTest.finish(); };
54 } else {
55 ifr.src = "file_empty.html";
56 ifr.onload = go;
57 }
59 </script>
60 </pre>
61 </body>
62 </html>