tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

file_frameNavigation_grandchild.html (1904B)


      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/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?insecurePage_navigate_grandchild" id="child"></iframe>
     13 
     14 <script>
     15  // For tests that require setTimeout, set the maximum polling time to 100 x 100ms = 10 seconds.
     16  var MAX_COUNT = 50;
     17  var TIMEOUT_INTERVAL = 100;
     18  var counter = 0;
     19 
     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;
     27      if (child.contentDocument) {
     28        loc = child.contentDocument.location;
     29      }
     30    } catch(e) {
     31      if (e.message && !e.message.includes("Permission denied to access property")) {
     32        // We received an exception we didn't expect.
     33        throw e;
     34      }
     35      counter++;
     36      return;
     37    }
     38    if (loc == "http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?insecurePage_navigate_grandchild_response") {
     39      return;
     40    }
     41    if(counter < MAX_COUNT) {
     42      counter++;
     43      setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
     44    }
     45    else {
     46      // After we have called setTimeout the maximum number of times, assume navigating the iframe is blocked
     47      parent.parent.postMessage({"test": "insecurePage_navigate_grandchild", "msg": "navigating to insecure grandchild iframe blocked on insecure page"}, "http://mochi.test:8888");
     48    }
     49  }
     50 
     51  setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
     52 
     53 </script>
     54 </body>
     55 </html>