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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for Power API</title> |
michael@0 | 5 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 7 | <script type="application/javascript"> |
michael@0 | 8 | |
michael@0 | 9 | /** Test for Power API **/ |
michael@0 | 10 | |
michael@0 | 11 | /** Test permission **/ |
michael@0 | 12 | // In b2g, addPermission 'power' is only working after a document reload |
michael@0 | 13 | // See bug 802312 |
michael@0 | 14 | |
michael@0 | 15 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 16 | |
michael@0 | 17 | function startTest() { |
michael@0 | 18 | SpecialPowers.pushPermissions([ |
michael@0 | 19 | {type: "power", allow: true, context: window.frames[0].document} |
michael@0 | 20 | ], doTest1); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function doTest1() { |
michael@0 | 24 | window.frames[0].frameElement.setAttribute('onload', 'doTest2()'); |
michael@0 | 25 | power = window.frames[0].navigator.mozPower; |
michael@0 | 26 | ok(power, "Should be able to access power manager with permission."); |
michael@0 | 27 | |
michael@0 | 28 | SpecialPowers.removePermission("power", window.frames[0].document); |
michael@0 | 29 | window.frames[0].location.reload(); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | function doTest2() { |
michael@0 | 33 | window.frames[0].frameElement.setAttribute('onload', 'doTest3()'); |
michael@0 | 34 | power = window.frames[0].navigator.mozPower; |
michael@0 | 35 | ok(!power, "Shouldn't be able to access power manager with permission."); |
michael@0 | 36 | |
michael@0 | 37 | SpecialPowers.addPermission("power",true, window.frames[0].document); |
michael@0 | 38 | window.frames[0].location.reload(); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function doTest3() { |
michael@0 | 42 | power = window.frames[0].navigator.mozPower; |
michael@0 | 43 | ok(power, "Should be able to access power manager with permission."); |
michael@0 | 44 | SimpleTest.finish(); |
michael@0 | 45 | } |
michael@0 | 46 | </script> |
michael@0 | 47 | </head> |
michael@0 | 48 | <body> |
michael@0 | 49 | <p id="display"></p> |
michael@0 | 50 | <div id="content" style="display: none"> |
michael@0 | 51 | </div> |
michael@0 | 52 | <iframe onload="startTest()"></iframe> |
michael@0 | 53 | <pre id="test"> |
michael@0 | 54 | </pre> |
michael@0 | 55 | </body> |
michael@0 | 56 | </html> |