content/base/test/test_bug696301-2.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=696301
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 696301</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696301">Mozilla Bug 696301</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    17 </div>
    18 <pre id="test">
    19 <!-- Test SVG script here -->
    20 <svg>
    21 <script type="application/javascript">
    22 var errorFired = false;
    23 var global = "";
    24 window.onerror = function(message, uri, line) {
    25   is(message, "Script error.", "Should have empty error message");
    26   is(uri,
    27      "http://example.com/tests/content/base/test/bug696301-script-1.js",
    28      "Should have correct script URI");
    29   is(line, 0, "Shouldn't have a line here");
    30   errorFired = true;
    31 }
    32 </script>
    33 <script xlink:href="http://example.com/tests/content/base/test/bug696301-script-1.js"></script>
    34 <script>
    35   is(errorFired, true, "Should have error in different origin script");
    36   is(global, "ran", "Different origin script should have run");
    37 </script>
    39 <script type="application/javascript">
    40 errorFired = false;
    41 global = "";
    42 window.onerror = function(message, uri, line) {
    43   is(message, "ReferenceError: c is not defined", "Should have correct error message");
    44   is(uri,
    45      "http://example.com/tests/content/base/test/bug696301-script-1.js",
    46      "Should also have correct script URI");
    47   is(line, 3, "Should have a line here");
    48   errorFired = true;
    49 }
    50 </script>
    51 <script xlink:href="http://example.com/tests/content/base/test/bug696301-script-1.js"
    52         crossorigin></script>
    53 <script>
    54   is(errorFired, true, "Should have error in different origin script with CORS");
    55   is(global, "ran", "Different origin script with CORS should have run");
    56 </script>
    58 <script type="application/javascript">
    59 errorFired = false;
    60 global = "";
    61 window.addEventListener("error", function(e) {
    62   is(Object.getPrototypeOf(e), Event.prototype,
    63      "Object prototype should be Event");
    64   var scripts = document.querySelectorAll("script");
    65   is(e.target, scripts[scripts.length - 1],
    66      "Event's target should be the right &lt;script>");
    67   errorFired = true;
    68 }, true);
    69 </script>
    70 <script xlink:href="http://example.com/tests/content/base/test/bug696301-script-2.js"
    71         crossorigin></script>
    72 <script>
    73   is(errorFired, true,
    74      "Should have error when different origin script fails CORS check");
    75   is(global, "", "Different origin script that fails CORS should not have run");
    76 </script>
    77 </svg>
    78 </pre>
    79 </body>
    80 </html>

mercurial