content/base/test/test_bug696301-2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug696301-2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=696301
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 696301</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696301">Mozilla Bug 696301</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +  
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<!-- Test SVG script here -->
    1.23 +<svg>
    1.24 +<script type="application/javascript">
    1.25 +var errorFired = false;
    1.26 +var global = "";
    1.27 +window.onerror = function(message, uri, line) {
    1.28 +  is(message, "Script error.", "Should have empty error message");
    1.29 +  is(uri,
    1.30 +     "http://example.com/tests/content/base/test/bug696301-script-1.js",
    1.31 +     "Should have correct script URI");
    1.32 +  is(line, 0, "Shouldn't have a line here");
    1.33 +  errorFired = true;
    1.34 +}
    1.35 +</script>
    1.36 +<script xlink:href="http://example.com/tests/content/base/test/bug696301-script-1.js"></script>
    1.37 +<script>
    1.38 +  is(errorFired, true, "Should have error in different origin script");
    1.39 +  is(global, "ran", "Different origin script should have run");
    1.40 +</script>
    1.41 +
    1.42 +<script type="application/javascript">
    1.43 +errorFired = false;
    1.44 +global = "";
    1.45 +window.onerror = function(message, uri, line) {
    1.46 +  is(message, "ReferenceError: c is not defined", "Should have correct error message");
    1.47 +  is(uri,
    1.48 +     "http://example.com/tests/content/base/test/bug696301-script-1.js",
    1.49 +     "Should also have correct script URI");
    1.50 +  is(line, 3, "Should have a line here");
    1.51 +  errorFired = true;
    1.52 +}
    1.53 +</script>
    1.54 +<script xlink:href="http://example.com/tests/content/base/test/bug696301-script-1.js"
    1.55 +        crossorigin></script>
    1.56 +<script>
    1.57 +  is(errorFired, true, "Should have error in different origin script with CORS");
    1.58 +  is(global, "ran", "Different origin script with CORS should have run");
    1.59 +</script>
    1.60 +
    1.61 +<script type="application/javascript">
    1.62 +errorFired = false;
    1.63 +global = "";
    1.64 +window.addEventListener("error", function(e) {
    1.65 +  is(Object.getPrototypeOf(e), Event.prototype,
    1.66 +     "Object prototype should be Event");
    1.67 +  var scripts = document.querySelectorAll("script");
    1.68 +  is(e.target, scripts[scripts.length - 1],
    1.69 +     "Event's target should be the right &lt;script>");
    1.70 +  errorFired = true;
    1.71 +}, true);
    1.72 +</script>
    1.73 +<script xlink:href="http://example.com/tests/content/base/test/bug696301-script-2.js"
    1.74 +        crossorigin></script>
    1.75 +<script>
    1.76 +  is(errorFired, true,
    1.77 +     "Should have error when different origin script fails CORS check");
    1.78 +  is(global, "", "Different origin script that fails CORS should not have run");
    1.79 +</script>
    1.80 +</svg>
    1.81 +</pre>
    1.82 +</body>
    1.83 +</html>

mercurial