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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function testForceCheck() { |
michael@0 | 5 | addChromeEventListener("update-available", function(evt) { |
michael@0 | 6 | let update = evt.detail; |
michael@0 | 7 | is(update.displayVersion, "99.0"); |
michael@0 | 8 | is(update.isOSUpdate, false); |
michael@0 | 9 | statusSettingIs("check-complete", testDownload); |
michael@0 | 10 | return true; |
michael@0 | 11 | }); |
michael@0 | 12 | sendContentEvent("force-update-check"); |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function testDownload() { |
michael@0 | 16 | let gotStarted = false, gotProgress = false, gotStopped = false; |
michael@0 | 17 | let progress = 0, total = 0; |
michael@0 | 18 | |
michael@0 | 19 | addChromeEventListener("update-download-started", function(evt) { |
michael@0 | 20 | gotStarted = true; |
michael@0 | 21 | return true; |
michael@0 | 22 | }); |
michael@0 | 23 | addChromeEventListener("update-download-progress", function(evt) { |
michael@0 | 24 | progress = evt.detail.progress; |
michael@0 | 25 | total = evt.detail.total; |
michael@0 | 26 | gotProgress = true; |
michael@0 | 27 | if (total == progress) { |
michael@0 | 28 | ok(gotStarted); |
michael@0 | 29 | return true; |
michael@0 | 30 | } |
michael@0 | 31 | return false; |
michael@0 | 32 | }); |
michael@0 | 33 | addChromeEventListener("update-download-stopped", function(evt) { |
michael@0 | 34 | is(evt.detail.paused, false); |
michael@0 | 35 | gotStopped = true; |
michael@0 | 36 | ok(gotStarted); |
michael@0 | 37 | ok(gotProgress); |
michael@0 | 38 | return true; |
michael@0 | 39 | }); |
michael@0 | 40 | addChromeEventListener("update-downloaded", function(evt) { |
michael@0 | 41 | ok(gotStarted); |
michael@0 | 42 | ok(gotProgress); |
michael@0 | 43 | ok(gotStopped); |
michael@0 | 44 | is(progress, total); |
michael@0 | 45 | return true; |
michael@0 | 46 | }); |
michael@0 | 47 | addChromeEventListener("update-prompt-apply", function(evt) { |
michael@0 | 48 | let update = evt.detail; |
michael@0 | 49 | is(update.displayVersion, "99.0"); |
michael@0 | 50 | is(update.isOSUpdate, false); |
michael@0 | 51 | cleanUp(); |
michael@0 | 52 | }); |
michael@0 | 53 | sendContentEvent("update-available-result", { |
michael@0 | 54 | result: "download" |
michael@0 | 55 | }); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | function testApplied() { |
michael@0 | 59 | let updateFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); |
michael@0 | 60 | updateFile.initWithPath("/system/b2g/update_test/UpdateTestAddFile"); |
michael@0 | 61 | ok(updateFile.exists()); |
michael@0 | 62 | cleanUp(); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | // Update lifecycle callbacks |
michael@0 | 66 | function preUpdate() { |
michael@0 | 67 | testForceCheck(); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | function postUpdate() { |
michael@0 | 71 | testApplied(); |
michael@0 | 72 | } |