content/xul/document/test/test_bug445177.xul

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=445177
     6 -->
     7 <window title="Test for Bug 445177"
     8   id="test_bug445177_xul"
     9   xmlns:html="http://www.w3.org/1999/xhtml"
    10   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    11   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    13   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    15 <body id="body" xmlns="http://www.w3.org/1999/xhtml">
    16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445177">Mozilla Bug 445177</a>
    19 <hbox id="b1" value="foo"/>
    20 <hbox id="o1" observes="b1"/>
    22 <pre id="test">
    23   <script class="testbody" type="text/javascript">
    24 <![CDATA[
    25   SimpleTest.waitForExplicitFinish();
    26   function do_test() {
    27     var b1 = document.getElementById("b1");
    28     var o1 = document.getElementById("o1");
    30     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (1)");
    32     b1.setAttribute("value", "bar");
    33     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (2)");
    35     b1.removeAttribute("value");
    36     is(o1.hasAttribute("value"), b1.hasAttribute("value"), "Wrong value (3)");
    38     o1.setAttribute("value", "foo");
    39     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (4)");
    41     b1.setAttribute("value", "foobar");
    42     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (5)");
    44     //After removing listener, changes to broadcaster shouldn't have any effect.
    45     o1.parentNode.removeChild(o1);
    46     b1.setAttribute("value", "foo");
    47     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (6)");
    49     b1.parentNode.appendChild(o1);
    50     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (7)");
    52     o1.parentNode.removeChild(o1);
    53     o1.removeAttribute("observes");
    54     o1.removeAttribute("value");
    55     b1.parentNode.appendChild(o1);
    56     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (8)");
    58     document.addBroadcastListenerFor(b1, o1, "value");
    59     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (9)");
    61     o1.parentNode.removeChild(o1);
    62     b1.setAttribute("value", "foobar");
    63     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (10)");
    65     b1.parentNode.appendChild(o1);
    66     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (11)");
    68     o1.setAttribute("observes", "b1");
    69     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (12)");
    71     // When broadcaster isn't in document, changes to its attributes aren't
    72     // reflected to listener.
    73     b1.parentNode.removeChild(b1);
    74     b1.setAttribute("value", "foo");
    75     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (13)");
    77     SimpleTest.finish();
    78   }
    80   addLoadEvent(do_test);
    81 ]]>
    82   </script>
    83 </pre>
    84 </body>
    85 </window>

mercurial