content/base/test/file_mixed_content_frameNavigation_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_grandchild.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +Tests for Mixed Content Blocker - Navigating Grandchild frames when a secure parent doesn't exist
     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 +<iframe src="https://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?insecurePage_navigate_grandchild" id="child"></iframe>
    1.16 +
    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 +    // When the page is navigating, it goes through about:blank and we will get a permission denied for loc.
    1.27 +    // Catch that specific exception and return
    1.28 +    try {
    1.29 +      var loc = child.contentDocument.location;
    1.30 +    } catch(e) {
    1.31 +      if (e.message && e.message.indexOf("Permission denied to access property") == -1) {
    1.32 +        // We received an exception we didn't expect.
    1.33 +        throw e;
    1.34 +      }
    1.35 +      counter++;
    1.36 +      return;
    1.37 +    }
    1.38 +    if (loc == "http://example.com/tests/content/base/test/file_mixed_content_frameNavigation_innermost.html?insecurePage_navigate_grandchild_response") {
    1.39 +      return;
    1.40 +    }
    1.41 +    else {
    1.42 +      if(counter < MAX_COUNT) {
    1.43 +        counter++;
    1.44 +        setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
    1.45 +      }
    1.46 +      else {
    1.47 +        // After we have called setTimeout the maximum number of times, assume navigating the iframe is blocked
    1.48 +        parent.parent.postMessage({"test": "insecurePage_navigate_grandchild", "msg": "navigating to insecure grandchild iframe blocked on insecure page"}, "http://mochi.test:8888");
    1.49 +      }
    1.50 +    }
    1.51 +  }
    1.52 +
    1.53 +  setTimeout(navigationStatus, TIMEOUT_INTERVAL, child);
    1.54 +
    1.55 +</script>
    1.56 +</body>
    1.57 +</html>

mercurial