content/base/test/csp/test_policyuri_async_fetch.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/csp/test_policyuri_async_fetch.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=558431
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 558431</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<iframe id="cspframe"></iframe>
    1.16 +<script type="text/javascript">
    1.17 +// This tests that a policy is still attempted to be fetched
    1.18 +// asynchronously (bug 558431) and that a default policy of
    1.19 +// |allow 'none'| is applied when the fetching fails.
    1.20 +
    1.21 +var f = document.getElementById("cspframe");
    1.22 +// run our test functions when the inner frame is finished loading
    1.23 +f.addEventListener('load', function() {
    1.24 +  var inner = this.contentDocument.getElementById("inner");
    1.25 +  var test = inner.contentDocument.getElementById("test");
    1.26 +  // the inner document should not exist because it has an invalid
    1.27 +  // policy-uri and should have been blocked by the default
    1.28 +  // |allow 'none'| policy that was applied
    1.29 +  is(test, null, "test inner document");
    1.30 +  SimpleTest.finish();
    1.31 +}, false);
    1.32 +// load the test frame
    1.33 +f.src = "file_policyuri_async_fetch.html";
    1.34 +SimpleTest.waitForExplicitFinish();
    1.35 +</script>
    1.36 +</body>
    1.37 +</html>

mercurial