toolkit/devtools/server/tests/browser/storage-secured-iframe.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 Iframe for testing multiple host detetion in storage actor
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <script type="application/javascript;version=1.7">
michael@0 11
michael@0 12 document.cookie = "sc1=foobar;";
michael@0 13 localStorage.setItem("iframe-s-ls1", "foobar");
michael@0 14 sessionStorage.setItem("iframe-s-ss1", "foobar-2");
michael@0 15
michael@0 16 function success(event) {
michael@0 17 setupIDB.next(event);
michael@0 18 }
michael@0 19
michael@0 20 window.idbGenerator = function*(callback) {
michael@0 21 let request = indexedDB.open("idb-s1", 1);
michael@0 22 request.onupgradeneeded = success;
michael@0 23 request.onerror = function(e) {
michael@0 24 throw new Error("error opening db connection");
michael@0 25 };
michael@0 26 let event = yield undefined;
michael@0 27 let db = event.target.result;
michael@0 28 let store1 = db.createObjectStore("obj-s1", { keyPath: "id" });
michael@0 29
michael@0 30 store1.add({id: 6, name: "foo", email: "foo@bar.com"}).onsuccess = success;
michael@0 31 yield undefined;
michael@0 32 store1.add({id: 7, name: "foo2", email: "foo2@bar.com"}).onsuccess = success;
michael@0 33 yield undefined;
michael@0 34 store1.transaction.oncomplete = success;
michael@0 35 yield undefined;
michael@0 36 db.close();
michael@0 37
michael@0 38 request = indexedDB.open("idb-s2", 1);
michael@0 39 request.onupgradeneeded = success;
michael@0 40 event = yield undefined;
michael@0 41
michael@0 42 let db2 = event.target.result;
michael@0 43 let store3 = db2.createObjectStore("obj-s2", { keyPath: "id3", autoIncrement: true });
michael@0 44 store3.createIndex("name2", "name2", { unique: true });
michael@0 45 store3.add({id3: 16, name2: "foo", email: "foo@bar.com"}).onsuccess = success;
michael@0 46 yield undefined;
michael@0 47 store3.transaction.oncomplete = success;
michael@0 48 yield undefined;
michael@0 49 db2.close();
michael@0 50 console.log("added cookies and stuff from secured iframe");
michael@0 51 callback();
michael@0 52 }
michael@0 53
michael@0 54 function successClear(event) {
michael@0 55 clearIterator.next(event);
michael@0 56 }
michael@0 57
michael@0 58 window.clear = function*(callback) {
michael@0 59 localStorage.clear();
michael@0 60 indexedDB.deleteDatabase("idb-s1").onsuccess = successClear;
michael@0 61 yield undefined;
michael@0 62 indexedDB.deleteDatabase("idb-s2").onsuccess = successClear;
michael@0 63 yield undefined;
michael@0 64 console.log("removed cookies and stuff from secured iframe");
michael@0 65 callback();
michael@0 66 }
michael@0 67 </script>
michael@0 68 </body>
michael@0 69 </html>

mercurial