dom/events/test/test_bug288392.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=288392
     5 -->
     6 <head>
     7   <title>Test for Bug 288392</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=288392">Mozilla Bug 288392</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    15 <div id="mutationTarget">
    16 </div>
    17 </div>
    18 <pre id="test">
    19 <script class="testbody" type="text/javascript">
    21 /** Test for Bug 288392 **/
    22 var subtreeModifiedCount;
    24 function subtreeModified(e)
    25 {
    26   ++subtreeModifiedCount;
    27 }
    29 function doTest() {
    30   var targetNode = document.getElementById("mutationTarget");
    31   targetNode.addEventListener("DOMSubtreeModified", subtreeModified, false);
    33   subtreeModifiedCount = 0;
    34   var temp = document.createElement("DIV");
    35   targetNode.appendChild(temp);
    36   is(subtreeModifiedCount, 1,
    37      "Appending a child node should have dispatched a DOMSubtreeModified event");
    39   subtreeModifiedCount = 0;
    40   temp.setAttribute("foo", "bar");
    41   is(subtreeModifiedCount, 1,
    42      "Setting an attribute should have dispatched a DOMSubtreeModified event");
    44   subtreeModifiedCount = 0;
    45   targetNode.removeChild(temp);
    46   is(subtreeModifiedCount, 1,
    47      "Removing a child node should have dispatched a DOMSubtreeModified event");
    49   // Testing events in a subtree, which is not in the document.
    50   var subtree = document.createElement("div");
    51   var s = "<e1 attr1='value1'>Something1</e1><e2 attr2='value2'>Something2</e2>";
    52   subtree.innerHTML = s;
    53   subtree.addEventListener("DOMSubtreeModified", subtreeModified, false);
    55   subtreeModifiedCount = 0;
    56   subtree.firstChild.firstChild.data = "foo";
    57   is(subtreeModifiedCount, 1,
    58      "Editing character data should have dispatched a DOMSubtreeModified event");
    60   subtreeModifiedCount = 0;
    61   subtree.firstChild.removeChild(subtree.firstChild.firstChild);
    62   is(subtreeModifiedCount, 1,
    63      "Removing a child node should have dispatched a DOMSubtreeModified event");
    65   subtreeModifiedCount = 0;
    66   subtree.firstChild.setAttribute("foo", "bar");
    67   is(subtreeModifiedCount, 1,
    68      "Setting an attribute should have dispatched a DOMSubtreeModified event");
    70   subtreeModifiedCount = 0;
    71   subtree.textContent = "foobar";
    72   is(subtreeModifiedCount, 1,
    73      "Setting .textContent should have dispatched a DOMSubtreeModified event");
    75   subtreeModifiedCount = 0;
    76   subtree.innerHTML = s;
    77   is(subtreeModifiedCount, 1,
    78      "Setting .innerHTML should have dispatched a DOMSubtreeModified event");
    80   subtreeModifiedCount = 0;
    81   subtree.removeEventListener("DOMSubtreeModified", subtreeModified, false);
    82   subtree.appendChild(document.createTextNode(""));
    83   subtree.addEventListener("DOMSubtreeModified", subtreeModified, false);
    84   subtree.normalize();
    85   is(subtreeModifiedCount, 1,
    86      "Calling normalize() should have dispatched a DOMSubtreeModified event");
    87 }
    89 SimpleTest.waitForExplicitFinish();
    90 addLoadEvent(doTest);
    91 addLoadEvent(SimpleTest.finish);
    93 </script>
    94 </pre>
    95 </body>
    96 </html>

mercurial