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

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

mercurial