dom/tests/mochitest/bugs/test_bug848088.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=848088
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 848088</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   <script type="application/javascript">
    13   /** Test for Bug 848088 **/
    15 function test(loopFor, setExpandoAt)
    16 {
    17     var list = document.getElementsByTagName("audio");
    18     delete list.length;
    19     var shouldHaveExpando = false;
    20     var realLength = list.length;
    21     for (var i = 0; i < loopFor; ++i) {
    22         if (i == setExpandoAt) {
    23             // Add an expando that shadows.
    24             Object.defineProperty(list, "length", { value: "a" });
    25             shouldHaveExpando = true;
    26         }
    27         var hasExpando = (list.length != realLength);
    28         if (shouldHaveExpando != hasExpando) {
    29             return false;
    30         }
    31     }
    32     return true;
    33 }
    35 ok(test(200000, 100000), "Correctly detected expando on DOM list object");
    37  </script>
    38 </head>
    39 <body>
    40 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=848088">Mozilla Bug 848088</a>
    41 <p id="display"></p>
    42 <div id="content" style="display: none">
    44 </div>
    45 <pre id="test">
    46 </pre>
    47 </body>
    48 </html>

mercurial