dom/xbl/test/file_bug397934.xhtml

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 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=397934
     4 -->
     5 <head>
     6   <title>Test for Bug 397934</title>
     7   <bindings xmlns="http://www.mozilla.org/xbl">
     8     <binding id="ancestor">
     9       <implementation>
    10         <field name="testAncestor">"ancestor"</field>
    11       </implementation>
    12     </binding>
    13     <binding id="test1" extends="#ancestor">
    14       <implementation>
    15         <constructor>
    16           this.storage = window;
    17         </constructor>
    18         <field name="window"></field>
    19         <field name="storage">null</field>
    20         <field name="parentNode"></field>
    21         <field name="ownerDocument">"ownerDocument"</field>
    22         <field name="emptyTest1"></field>
    23         <field name="emptyTest1">"empty1"</field>
    24         <field name="emptyTest2">"empty2"</field>        
    25         <field name="emptyTest2"></field>
    26         <field name="testAncestor"></field>
    27         <field name="testEvalOnce">XPCNativeWrapper.unwrap(window).counter++; undefined</field>
    28       </implementation>
    29     </binding>
    30     <binding id="test2" extends="#ancestor">
    31       <implementation>
    32         <constructor>
    33           this.storage = window;
    34         </constructor>
    35         <field name="window">undefined</field>
    36         <field name="storage">null</field>
    37         <field name="parentNode">undefined</field>
    38         <field name="ownerDocument">"ownerDocument"</field>
    39         <field name="emptyTest1">undefined</field>
    40         <field name="emptyTest1">"empty1"</field>
    41         <field name="emptyTest2">"empty2"</field>        
    42         <field name="emptyTest2">undefined</field>
    43         <field name="testAncestor">undefined</field>
    44       </implementation>
    45     </binding>
    46   </bindings>
    47 </head>
    48 <body>
    49 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397934">Mozilla Bug 397934</a>
    50 <p id="display1" style="-moz-binding: url(#test1)"></p>
    51 <p id="display2" style="-moz-binding: url(#test2)"></p>
    52 <div id="content" style="display: none">
    54 </div>
    55 <pre id="test">
    56 <script class="testbody" type="text/javascript">
    57 <![CDATA[
    59 /** Test for Bug 397934 **/
    60 SimpleTest = parent.SimpleTest;
    61 ok = parent.ok;
    62 is = parent.is;
    63 $ = function(x) { return document.getElementById(x); }
    64 window.onload = function() {
    65   var d;
    66   d = $("display1");
    67   is(d.storage, window,
    68      "test1" +
    69        ": |window| in the constructor should have resolved to our window");
    70   is(d.ownerDocument, "ownerDocument",
    71      "test1" + ": Control to test field overriding DOM prop");
    72   is(d.parentNode, document.body, "test1" + ": unexpected parent");
    73   is(d.emptyTest1, undefined,
    74      "test1" + ": First field wins even if undefined");
    75   is(typeof(d.emptyTest1), "undefined",
    76      "test1" + ": First field wins even if undefined, double-check");
    77   is(d.emptyTest2, "empty2",
    78      "test1" + ": First field wins");
    79   is(d.testAncestor, "ancestor",
    80      "test1" + ": Empty field should not override ancestor binding");
    82   var win = window;
    83   win.counter = 0;
    84   d.testEvalOnce;
    85   d.testEvalOnce;
    86   is(win.counter, 1, "Field should have evaluated once and only once");
    88   d = $("display2");
    89   is(d.storage, undefined,
    90      "test2" +
    91        ": |window| in the constructor should have resolved to undefined");
    92   is(typeof(d.storage), "undefined",
    93      "test2" +
    94        ": |window| in the constructor should really have resolved to undefined");
    95   is(d.ownerDocument, "ownerDocument",
    96      "test2" + ": Control to test field overriding DOM prop");
    97   is(d.parentNode, undefined, "test2" + ": unexpected parent");
    98   is(typeof(d.parentNode), "undefined", "test2" + ": unexpected parent for real");
    99   is(d.emptyTest1, undefined,
   100      "test2" + ": First field wins even if undefined");
   101   is(typeof(d.emptyTest1), "undefined",
   102      "test2" + ": First field wins even if undefined, double-check");
   103   is(d.emptyTest2, "empty2",
   104      "test2" + ": First field wins");
   105   is(d.testAncestor, undefined,
   106      "test2" + ": Undefined field should override ancestor binding");
   107   is(typeof(d.testAncestor), "undefined",
   108      "test2" + ": Undefined field should really override ancestor binding");
   109   SimpleTest.finish();
   110 }
   112 ]]>
   113 </script>
   114 </pre>
   115 </body>
   116 </html>

mercurial