content/base/test/file_mixed_content_frameNavigation_secure_grandchild.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 Tests for Mixed Content Blocker - Navigating Grandchild Frames when a secure parent exists
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=840388
michael@0 6 -->
michael@0 7 <head>
michael@0 8 <meta charset="utf-8">
michael@0 9 <title>Tests for Mixed Content Frame Navigation</title>
michael@0 10 </head>
michael@0 11 <body>
michael@0 12
michael@0 13 <iframe src="https://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?securePage_navigate_grandchild" id="child"></iframe>
michael@0 14 <script>
michael@0 15 // For tests that require setTimeout, set the maximum polling time to 50 x 100ms = 5 seconds.
michael@0 16 var MAX_COUNT = 50;
michael@0 17 var TIMEOUT_INTERVAL = 100;
michael@0 18 var counter = 0;
michael@0 19
michael@0 20 var child = document.getElementById("child");
michael@0 21 function navigationStatus(child)
michael@0 22 {
michael@0 23 var loc;
michael@0 24 // When the page is navigating, it goes through about:blank and we will get a permission denied for loc.
michael@0 25 // Catch that specific exception and return
michael@0 26 try {
michael@0 27 loc = document.getElementById("child").contentDocument.location;
michael@0 28 } catch(e) {
michael@0 29 if (e.message && e.message.indexOf("Permission denied to access property") == -1) {
michael@0 30 // We received an exception we didn't expect.
michael@0 31 throw e;
michael@0 32 }
michael@0 33 counter++;
michael@0 34 return;
michael@0 35 }
michael@0 36 if (loc == "http://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?securePage_navigate_grandchild_response") {
michael@0 37 return;
michael@0 38 }
michael@0 39 else {
michael@0 40 if(counter < MAX_COUNT) {
michael@0 41 counter++;
michael@0 42 setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
michael@0 43 }
michael@0 44 else {
michael@0 45 // After we have called setTimeout the maximum number of times, assume navigating the iframe is blocked
michael@0 46 dump("\nThe current location of the grandchild iframe is: "+loc+".\n");
michael@0 47 dump("\nWe have past the maximum timeout. Navigating a grandchild iframe from an https location to an http location on a secure page failed. We are about to post message to the top level page\n");
michael@0 48 parent.parent.postMessage({"test": "securePage_navigate_grandchild", "msg": "navigating to insecure grandchild iframe blocked on secure page"}, "http://mochi.test:8888");
michael@0 49 dump("\nAttempted postMessage\n");
michael@0 50 }
michael@0 51 }
michael@0 52 }
michael@0 53
michael@0 54 setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
michael@0 55
michael@0 56 </script>
michael@0 57 </body>
michael@0 58 </html>

mercurial