dom/tests/mochitest/bugs/test_bug531176.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=531176
     5 -->
     6 <head>
     7   <title>Test for Bug 531176</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=531176">Mozilla Bug 531176</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 531176 **/
    22 var errorCount = 0;
    23 function errorHandler(msg, filename, linenr) {
    24   is(msg, "SyntaxError: syntax error", "Wrong error!");
    25   is(filename, window.location, "Wrong filename!");
    26   is(linenr, 1, "Wrong linenr!");
    27   ++errorCount;
    28 }
    30 window.onerror = errorHandler;
    31 document.body.setAttribute("onclick", "var x=;");
    32 // Force eager compilation
    33 document.body.onclick;
    34 is(errorCount, 1, "Error handler should have been called! (1)");
    36 function recursiveHandler(msg, filename, linenr) {
    37   is(msg, "SyntaxError: syntax error", "Wrong error!");
    38   is(filename, window.location, "Wrong filename!");
    39   is(linenr, 1, "Wrong linenr!");
    40   ++errorCount;
    41   document.body.setAttribute("onclick", "var z=;");
    42 }
    44 window.onerror = recursiveHandler;
    45 document.body.setAttribute("onclick", "var y=;");
    46 // Force eager compilation
    47 document.body.onclick;
    48 is(errorCount, 2, "Error handler should have been called! (2)");
    50 // Check that error handler works even after recursion error.
    51 document.body.setAttribute("onclick", "var foo=;");
    52 // Force eager compilation
    53 document.body.onclick;
    54 is(errorCount, 3, "Error handler should have been called! (3)");
    56 window.onerror = function() { ++errorCount; };
    57 </script>
    58 <script>
    59 var foo =;
    60 </script>
    61 <script>
    62 is(errorCount, 4, "Error handler should have been called! (4)");
    63 </script>
    64 </pre>
    65 </body>
    66 </html>

mercurial