content/xul/document/test/test_bug468176.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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=468176
     6 -->
     7 <window title="Test for Bug 468176"
     8   id="test_bug468176_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=468176">Mozilla Bug 468176</a>
    18 <xul:hbox id="b1" value="foo"/>
    20 <xul:hbox id="o1">
    21   <xul:observes id="inner" element="b1" attribute="*"/>
    22 </xul:hbox>
    24 <pre id="test">
    25   <script class="testbody" type="text/javascript">
    26 <![CDATA[
    27   SimpleTest.waitForExplicitFinish();
    29   var broadcastCount = 0;
    30   function b_listener(evt) {
    31     ++broadcastCount;
    32   }
    34   function do_test() {
    35     var b1 = document.getElementById("b1");
    36     var o1 = document.getElementById("o1");
    37     var inner = document.getElementById("inner");
    38     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (1)");
    40     inner.addEventListener("broadcast", b_listener, true);
    41     b1.setAttribute("value", "bar");
    42     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (2)");
    43     is(broadcastCount, 1, "Wrong value (3)");
    45     b1.removeAttribute("value");
    46     is(o1.hasAttribute("value"), b1.hasAttribute("value"), "Wrong value (4)");
    47     is(broadcastCount, 2, "Wrong value (5)");
    49     o1.setAttribute("value", "foo");
    50     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (6)");
    51     is(broadcastCount, 2, "Wrong value (7)");
    53     b1.setAttribute("value", "foobar");
    54     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (8)");
    55     is(broadcastCount, 3, "Wrong value (9)");
    57     b1.removeAttribute("value");
    58     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (10)");
    59     is(broadcastCount, 4, "Wrong value (11)");
    61     b1.removeAttribute("value");
    62     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (12)");
    63     is(broadcastCount, 4, "Wrong value (13)");
    65     o1.setAttribute("value", "bar");
    66     b1.setAttribute("value", "bar"); // This should still dispatch 'broadcast'
    67     is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (14)");
    68     is(broadcastCount, 5, "Wrong value (15)");
    70     //After removing listener, changes to broadcaster shouldn't have any effect.
    71     o1.parentNode.removeChild(o1);
    72     b1.setAttribute("value", "foo");
    73     isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (16)");
    74     is(broadcastCount, 5, "Wrong value (17)");
    76     SimpleTest.finish();
    77   }
    79   addLoadEvent(do_test);
    80 ]]>
    81   </script>
    82 </pre>
    83 </body>
    84 </window>

mercurial