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.
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
6 var testGenerator = testSteps();
8 function testSteps()
9 {
10 const name = this.window ? window.location.pathname : "Splendid Test";
12 let request = indexedDB.open(name, 1);
13 request.onerror = errorHandler;
14 request.onupgradeneeded = grabEventAndContinueHandler;
15 request.onsuccess = unexpectedSuccessHandler;
17 let request2 = indexedDB.open(name, 2);
18 request2.onerror = errorHandler;
19 request2.onupgradeneeded = unexpectedSuccessHandler;
20 request2.onsuccess = unexpectedSuccessHandler;
22 let event = yield undefined;
23 is(event.type, "upgradeneeded", "Expect an upgradeneeded event");
24 is(event.target, request, "Event should be fired on the request");
25 ok(event.target.result instanceof IDBDatabase, "Expect a database here");
27 let db = event.target.result;
28 is(db.version, 1, "Database has correct version");
30 db.onupgradeneeded = function() {
31 ok(false, "our ongoing VERSION_CHANGE transaction should exclude any others!");
32 }
34 db.createObjectStore("foo");
36 try {
37 db.transaction("foo");
38 ok(false, "Transactions should be disallowed now!");
39 } catch (e) {
40 ok(e instanceof DOMException, "Expect a DOMException");
41 is(e.name, "InvalidStateError", "Expect an InvalidStateError");
42 is(e.code, DOMException.INVALID_STATE_ERR, "Expect an INVALID_STATE_ERR");
43 }
45 request.onupgradeneeded = unexpectedSuccessHandler;
46 request.transaction.oncomplete = grabEventAndContinueHandler;
48 event = yield undefined;
49 is(event.type, "complete", "Got complete event");
51 try {
52 db.transaction("foo");
53 ok(true, "Transactions should be allowed now!");
54 } catch (e) {
55 ok(false, "Transactions should be allowed now!");
56 }
58 request.onsuccess = grabEventAndContinueHandler;
60 event = yield undefined;
61 is(event.type, "success", "Expect a success event");
62 is(event.target.result, db, "Same database");
64 db.onversionchange = function() {
65 ok(true, "next setVersion was unblocked appropriately");
66 db.close();
67 }
69 try {
70 db.transaction("foo");
71 ok(true, "Transactions should be allowed now!");
72 } catch (e) {
73 ok(false, "Transactions should be allowed now!");
74 }
76 request.onsuccess = unexpectedSuccessHandler;
77 request2.onupgradeneeded = grabEventAndContinueHandler;
79 event = yield undefined;
80 is(event.type, "upgradeneeded", "Expect an upgradeneeded event");
82 db = event.target.result;
83 is(db.version, 2, "Database has correct version");
85 request2.onupgradeneeded = unexpectedSuccessHandler;
86 request2.onsuccess = grabEventAndContinueHandler;
88 event = yield undefined;
89 is(event.type, "success", "Expect a success event");
90 is(event.target.result, db, "Same database");
91 is(db.version, 2, "Database has correct version");
93 finishTest();
94 yield undefined;
95 }