dom/tests/mochitest/bugs/test_bug393974.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=393974
     5 -->
     6 <head>
     7   <title>Test for Bug 393974</title>
     8   <script type="text/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=393974">Mozilla Bug 393974</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 SimpleTest.waitForExplicitFinish();
    22 function test()
    23 {
    24   // Create a tree walker with a filter which creates a cycle...
    25   var tw = document.createTreeWalker(document, NodeFilter.SHOW_ALL,
    26                                      function(n)
    27                                      {
    28                                        // force the closure to contain the
    29                                        // global object, in case a future
    30                                        // optimization might minimize the
    31                                        // function's captured environment
    32                                        if ("foo" + window == "fooPIRATES!")
    33                                          return NodeFilter.FILTER_ACCEPT;
    34                                        return NodeFilter.FILTER_REJECT;
    35                                      });
    37   // That should have been enough to create a leak, but we should do at least
    38   // a couple tests while we're here so that this document doesn't show up as
    39   // having no tests pass *or* fail.
    41   ok(tw.firstChild() === null, "shouldn't be a first child");
    42   ok(tw.currentNode === document, "should be unchanged");
    44   ok(tw.lastChild() === null, "shouldn't be a last child");
    45   ok(tw.currentNode === document, "should be unchanged");
    47   ok(tw.nextNode() === null, "shouldn't be a next node");
    48   ok(tw.currentNode === document, "should be unchanged");
    50   ok(tw.nextSibling() === null, "shouldn't be a next sibling");
    51   ok(tw.currentNode === document, "should be unchanged");
    53   ok(tw.parentNode() === null, "shouldn't be a parent node");
    54   ok(tw.currentNode === document, "should be unchanged");
    56   ok(tw.previousNode() === null, "shouldn't be a previous node");
    57   ok(tw.currentNode === document, "should be unchanged");
    59   ok(tw.previousSibling() === null, "shouldn't be a previous sibling");
    60   ok(tw.currentNode === document, "should be unchanged");
    61 }
    63 addLoadEvent(test);
    64 addLoadEvent(SimpleTest.finish);
    65 </script>
    66 </pre>
    67 </body>
    68 </html>

mercurial