content/base/test/file_mixed_content_frameNavigation_secure_grandchild.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/file_mixed_content_frameNavigation_secure_grandchild.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +Tests for Mixed Content Blocker - Navigating Grandchild Frames when a secure parent exists
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=840388
     1.9 +-->
    1.10 +<head>
    1.11 +  <meta charset="utf-8">
    1.12 +  <title>Tests for Mixed Content Frame Navigation</title>
    1.13 +</head>
    1.14 +<body>
    1.15 +
    1.16 +<iframe src="https://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?securePage_navigate_grandchild" id="child"></iframe>
    1.17 +<script>
    1.18 +  // For tests that require setTimeout, set the maximum polling time to 50 x 100ms = 5 seconds.
    1.19 +  var MAX_COUNT = 50;
    1.20 +  var TIMEOUT_INTERVAL = 100;
    1.21 +  var counter = 0;
    1.22 +
    1.23 +  var child = document.getElementById("child");
    1.24 +  function navigationStatus(child)
    1.25 +  {
    1.26 +    var loc;
    1.27 +    // When the page is navigating, it goes through about:blank and we will get a permission denied for loc.
    1.28 +    // Catch that specific exception and return
    1.29 +    try {
    1.30 +      loc = document.getElementById("child").contentDocument.location;
    1.31 +    } catch(e) {
    1.32 +      if (e.message && e.message.indexOf("Permission denied to access property") == -1) {
    1.33 +        // We received an exception we didn't expect.
    1.34 +        throw e;
    1.35 +      }
    1.36 +      counter++;
    1.37 +      return;
    1.38 +    }
    1.39 +    if (loc == "http://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?securePage_navigate_grandchild_response") {
    1.40 +      return;
    1.41 +    }
    1.42 +    else {
    1.43 +      if(counter < MAX_COUNT) {
    1.44 +        counter++;
    1.45 +        setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
    1.46 +      }
    1.47 +      else {
    1.48 +        // After we have called setTimeout the maximum number of times, assume navigating the iframe is blocked
    1.49 +        dump("\nThe current location of the grandchild iframe is: "+loc+".\n");
    1.50 +        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");
    1.51 +        parent.parent.postMessage({"test": "securePage_navigate_grandchild", "msg": "navigating to insecure grandchild iframe blocked on secure page"}, "http://mochi.test:8888");
    1.52 +        dump("\nAttempted postMessage\n");
    1.53 +      }
    1.54 +    }
    1.55 +  }
    1.56 +
    1.57 +  setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
    1.58 +
    1.59 +</script>
    1.60 +</body>
    1.61 +</html>

mercurial