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