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 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=795164 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 795164</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | <script type="application/javascript;version=1.7"> |
michael@0 | 12 | |
michael@0 | 13 | /** Test for Bug 795164 **/ |
michael@0 | 14 | |
michael@0 | 15 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 16 | |
michael@0 | 17 | var url1 = 'http://test1.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true'; |
michael@0 | 18 | var url2 = 'http://test2.example.com/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true'; |
michael@0 | 19 | |
michael@0 | 20 | var gGenerator = runTest(); |
michael@0 | 21 | |
michael@0 | 22 | function go() { |
michael@0 | 23 | SpecialPowers.pushPermissions( |
michael@0 | 24 | [{ "type": "webapps-manage", "allow": 1, "context": document }], |
michael@0 | 25 | function() { gGenerator.next() }); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function continueTest() { |
michael@0 | 29 | try { |
michael@0 | 30 | gGenerator.next(); |
michael@0 | 31 | } catch (e if e instanceof StopIteration) { |
michael@0 | 32 | SimpleTest.finish(); |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function mozAppsError() { |
michael@0 | 37 | ok(false, "mozApps error: " + this.error.name); |
michael@0 | 38 | SimpleTest.finish(); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function runTest() { |
michael@0 | 42 | // Set up. |
michael@0 | 43 | SpecialPowers.setAllAppsLaunchable(true); |
michael@0 | 44 | SpecialPowers.autoConfirmAppInstall(continueTest); |
michael@0 | 45 | yield undefined; |
michael@0 | 46 | |
michael@0 | 47 | // Keeping track of the number of times `mozApps.mgmt.onuninstall` gets triggered |
michael@0 | 48 | let uninstallCount = 0; |
michael@0 | 49 | |
michael@0 | 50 | navigator.mozApps.mgmt.onuninstall = function() { |
michael@0 | 51 | uninstallCount++; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | let request = navigator.mozApps.install(url1); |
michael@0 | 55 | request.onerror = mozAppsError; |
michael@0 | 56 | request.onsuccess = continueTest; |
michael@0 | 57 | yield undefined; |
michael@0 | 58 | let app1 = request.result; |
michael@0 | 59 | ok(app1, "App1 is non-null"); |
michael@0 | 60 | |
michael@0 | 61 | request = navigator.mozApps.install(url2); |
michael@0 | 62 | request.onerror = mozAppsError; |
michael@0 | 63 | request.onsuccess = continueTest; |
michael@0 | 64 | yield undefined; |
michael@0 | 65 | let app2 = request.result; |
michael@0 | 66 | ok(app2, "App2 is non-null"); |
michael@0 | 67 | |
michael@0 | 68 | request = navigator.mozApps.mgmt.uninstall(app1); |
michael@0 | 69 | request.onsuccess = function() { |
michael@0 | 70 | ok(true, "Succeed to uninstall the app1 as expected"); |
michael@0 | 71 | continueTest(); |
michael@0 | 72 | }; |
michael@0 | 73 | request.onerror = function() { |
michael@0 | 74 | ok(false, "Fail to uninstall the app1"); |
michael@0 | 75 | continueTest(); |
michael@0 | 76 | }; |
michael@0 | 77 | yield undefined; |
michael@0 | 78 | |
michael@0 | 79 | request = navigator.mozApps.mgmt.uninstall(app2); |
michael@0 | 80 | request.onsuccess = function() { |
michael@0 | 81 | ok(true, "Succeed to uninstall the app2 as expected"); |
michael@0 | 82 | continueTest(); |
michael@0 | 83 | }; |
michael@0 | 84 | request.onerror = function() { |
michael@0 | 85 | ok(false, "Fail to uninstall the app2"); |
michael@0 | 86 | continueTest(); |
michael@0 | 87 | }; |
michael@0 | 88 | yield undefined; |
michael@0 | 89 | |
michael@0 | 90 | is(uninstallCount, 2, "mgmt.onuninstall got triggered only twice"); |
michael@0 | 91 | |
michael@0 | 92 | navigator.mozApps.mgmt.onuninstall = null; |
michael@0 | 93 | } |
michael@0 | 94 | </script> |
michael@0 | 95 | </head> |
michael@0 | 96 | <body onload="go()"> |
michael@0 | 97 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795164">Mozilla Bug 795164</a> |
michael@0 | 98 | <p id="display"></p> |
michael@0 | 99 | <div id="content" style="display: none"> |
michael@0 | 100 | |
michael@0 | 101 | </div> |
michael@0 | 102 | <pre id="test"> |
michael@0 | 103 | </pre> |
michael@0 | 104 | </body> |
michael@0 | 105 | </html> |