content/html/content/test/file_iframe_sandbox_d_if14.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <meta charset="utf-8">
michael@0 5 <title>Tests for Bug 838692</title>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 8 </head>
michael@0 9
michael@0 10 <script type="text/javascript">
michael@0 11 var test20Context = "Test 20: Navigate another window (not opened by us): ";
michael@0 12
michael@0 13 function doTest() {
michael@0 14 // Try to navigate auxiliary browsing context (window) not opened by us.
michael@0 15 // We should not be able to do this as we are sandboxed.
michael@0 16 sendMouseEvent({type:'click'}, 'navigate_window');
michael@0 17 window.parent.postMessage({type: "attempted"}, "*");
michael@0 18
michael@0 19 // Try to navigate auxiliary browsing context (window) not opened by us, using window.open().
michael@0 20 // We should not be able to do this as we are sandboxed.
michael@0 21 try {
michael@0 22 window.open("file_iframe_sandbox_window_navigation_fail.html?" + escape(test20Context), "window_to_navigate2");
michael@0 23 window.parent.postMessage({type: "attempted"}, "*");
michael@0 24 } catch(error) {
michael@0 25 window.parent.postMessage({ok: true, desc: test20Context + "as expected, error thrown during window.open(..., \"window_to_navigate2\")"}, "*");
michael@0 26 }
michael@0 27 }
michael@0 28 </script>
michael@0 29
michael@0 30 <body onload="doTest()">
michael@0 31 I am sandboxed but with "allow-scripts allow-same-origin allow-top-navigation".
michael@0 32
michael@0 33 <a href="file_iframe_sandbox_window_navigation_fail.html?Test 14: Navigate another window (not opened by us):%20" target="window_to_navigate" id="navigate_window">navigate window</a>
michael@0 34 </body>
michael@0 35 </html>

mercurial