content/base/test/file_mixed_content_frameNavigation_grandchild.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 doesn't exist
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 <iframe src="https://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?insecurePage_navigate_grandchild" id="child"></iframe>
michael@0 13
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 // When the page is navigating, it goes through about:blank and we will get a permission denied for loc.
michael@0 24 // Catch that specific exception and return
michael@0 25 try {
michael@0 26 var loc = child.contentDocument.location;
michael@0 27 } catch(e) {
michael@0 28 if (e.message && e.message.indexOf("Permission denied to access property") == -1) {
michael@0 29 // We received an exception we didn't expect.
michael@0 30 throw e;
michael@0 31 }
michael@0 32 counter++;
michael@0 33 return;
michael@0 34 }
michael@0 35 if (loc == "http://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?insecurePage_navigate_grandchild_response") {
michael@0 36 return;
michael@0 37 }
michael@0 38 else {
michael@0 39 if(counter < MAX_COUNT) {
michael@0 40 counter++;
michael@0 41 setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
michael@0 42 }
michael@0 43 else {
michael@0 44 // After we have called setTimeout the maximum number of times, assume navigating the iframe is blocked
michael@0 45 parent.parent.postMessage({"test": "insecurePage_navigate_grandchild", "msg": "navigating to insecure grandchild iframe blocked on insecure page"}, "http://mochi.test:8888");
michael@0 46 }
michael@0 47 }
michael@0 48 }
michael@0 49
michael@0 50 setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
michael@0 51
michael@0 52 </script>
michael@0 53 </body>
michael@0 54 </html>

mercurial