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 | /** |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | var testGenerator = testSteps(); |
michael@0 | 7 | |
michael@0 | 8 | function testSteps() |
michael@0 | 9 | { |
michael@0 | 10 | const name = this.window ? window.location.pathname : "Splendid Test"; |
michael@0 | 11 | const objectStores = [ "foo", "bar" ]; |
michael@0 | 12 | |
michael@0 | 13 | let request = indexedDB.open(name, 1); |
michael@0 | 14 | request.onerror = errorHandler; |
michael@0 | 15 | request.onupgradeneeded = grabEventAndContinueHandler; |
michael@0 | 16 | let event = yield undefined; |
michael@0 | 17 | |
michael@0 | 18 | let db = event.target.result; |
michael@0 | 19 | is(db.objectStoreNames.length, 0, "Correct objectStoreNames list"); |
michael@0 | 20 | |
michael@0 | 21 | event.target.onsuccess = grabEventAndContinueHandler; |
michael@0 | 22 | for (let i in objectStores) { |
michael@0 | 23 | db.createObjectStore(objectStores[i], { autoIncrement: true }); |
michael@0 | 24 | } |
michael@0 | 25 | let event = yield undefined; |
michael@0 | 26 | |
michael@0 | 27 | is(db.objectStoreNames.length, objectStores.length, |
michael@0 | 28 | "Correct objectStoreNames list"); |
michael@0 | 29 | |
michael@0 | 30 | for (let i = 0; i < 50; i++) { |
michael@0 | 31 | let stepNumber = 0; |
michael@0 | 32 | |
michael@0 | 33 | request = db.transaction(["foo"], "readwrite") |
michael@0 | 34 | .objectStore("foo") |
michael@0 | 35 | .add({}); |
michael@0 | 36 | request.onerror = errorHandler; |
michael@0 | 37 | request.onsuccess = function(event) { |
michael@0 | 38 | is(stepNumber, 1, "This callback came first"); |
michael@0 | 39 | stepNumber++; |
michael@0 | 40 | event.target.transaction.oncomplete = grabEventAndContinueHandler; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | request = db.transaction(["foo"], "readwrite") |
michael@0 | 44 | .objectStore("foo") |
michael@0 | 45 | .add({}); |
michael@0 | 46 | request.onerror = errorHandler; |
michael@0 | 47 | request.onsuccess = function(event) { |
michael@0 | 48 | is(stepNumber, 2, "This callback came second"); |
michael@0 | 49 | stepNumber++; |
michael@0 | 50 | event.target.transaction.oncomplete = grabEventAndContinueHandler; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | request = db.transaction(["foo", "bar"], "readwrite") |
michael@0 | 54 | .objectStore("bar") |
michael@0 | 55 | .add({}); |
michael@0 | 56 | request.onerror = errorHandler; |
michael@0 | 57 | request.onsuccess = function(event) { |
michael@0 | 58 | is(stepNumber, 3, "This callback came third"); |
michael@0 | 59 | stepNumber++; |
michael@0 | 60 | event.target.transaction.oncomplete = grabEventAndContinueHandler; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | request = db.transaction(["foo", "bar"], "readwrite") |
michael@0 | 64 | .objectStore("bar") |
michael@0 | 65 | .add({}); |
michael@0 | 66 | request.onerror = errorHandler; |
michael@0 | 67 | request.onsuccess = function(event) { |
michael@0 | 68 | is(stepNumber, 4, "This callback came fourth"); |
michael@0 | 69 | stepNumber++; |
michael@0 | 70 | event.target.transaction.oncomplete = grabEventAndContinueHandler; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | request = db.transaction(["bar"], "readwrite") |
michael@0 | 74 | .objectStore("bar") |
michael@0 | 75 | .add({}); |
michael@0 | 76 | request.onerror = errorHandler; |
michael@0 | 77 | request.onsuccess = function(event) { |
michael@0 | 78 | is(stepNumber, 5, "This callback came fifth"); |
michael@0 | 79 | stepNumber++; |
michael@0 | 80 | event.target.transaction.oncomplete = grabEventAndContinueHandler; |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | stepNumber++; |
michael@0 | 84 | yield undefined; yield undefined; yield undefined; yield undefined; yield undefined; |
michael@0 | 85 | |
michael@0 | 86 | is(stepNumber, 6, "All callbacks received"); |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | finishTest(); |
michael@0 | 90 | yield undefined; |
michael@0 | 91 | } |
michael@0 | 92 |