toolkit/components/url-classifier/tests/mochitest/classifierFrame.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/url-classifier/tests/mochitest/classifierFrame.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +<title></title>
     1.7 +
     1.8 +<script type="text/javascript">
     1.9 +
    1.10 +var scriptItem = "untouched";
    1.11 +
    1.12 +function checkLoads() {
    1.13 +  // Make sure the javascript did not load.
    1.14 +  window.parent.is(scriptItem, "untouched", "Should not load bad javascript");
    1.15 +
    1.16 +  // Make sure the css did not load.
    1.17 +  var elt = document.getElementById("styleCheck");
    1.18 +  var style = document.defaultView.getComputedStyle(elt, "");
    1.19 +  window.parent.isnot(style.visibility, "hidden", "Should not load bad css");
    1.20 +
    1.21 +  // End (parent) test.
    1.22 +  window.parent.SimpleTest.finish();
    1.23 +}
    1.24 +
    1.25 +</script>
    1.26 +
    1.27 +<!-- Try loading from a malware javascript URI -->
    1.28 +<script type="text/javascript" src="http://malware.example.com/tests/toolkit/components/url-classifier/tests/mochitest/evil.js"></script>
    1.29 +
    1.30 +<!-- Try loading from a malware css URI -->
    1.31 +<link rel="stylesheet" type="text/css" href="http://malware.example.com/tests/toolkit/components/url-classifier/tests/mochitest/evil.css"></link>
    1.32 +
    1.33 +<!-- XXX How is this part of the test supposed to work (= be checked)? -->
    1.34 +<!-- Try loading a marked-as-malware css through an @import from a clean URI -->
    1.35 +<link rel="stylesheet" type="text/css" href="import.css"></link>
    1.36 +</head>
    1.37 +
    1.38 +<body onload="checkLoads()">
    1.39 +The following should not be hidden:
    1.40 +<div id="styleCheck">STYLE TEST</div>
    1.41 +</body>
    1.42 +</html>

mercurial