Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | <html> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Indexed Database Test</title> |
michael@0 | 8 | |
michael@0 | 9 | <script type="text/javascript;version=1.7"> |
michael@0 | 10 | let db; |
michael@0 | 11 | let version = window.location.href.charAt(window.location.href.length - 1); |
michael@0 | 12 | |
michael@0 | 13 | function onAddMore() { |
michael@0 | 14 | let transaction = db.transaction("foo", "readwrite"); |
michael@0 | 15 | |
michael@0 | 16 | transaction.oncomplete = function(event) { |
michael@0 | 17 | setTimeout(testFinishedCallback, 0, "complete"); |
michael@0 | 18 | } |
michael@0 | 19 | transaction.onabort = function(event) { |
michael@0 | 20 | setTimeout(testFinishedCallback, 0, "abort " + event.target.error.name); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | let objectStore = transaction.objectStore("foo"); |
michael@0 | 24 | let obj = { |
michael@0 | 25 | foo: " ", |
michael@0 | 26 | bar: " ", |
michael@0 | 27 | baz: " " |
michael@0 | 28 | }; |
michael@0 | 29 | for (let i = 0; i < 1000; i++) { |
michael@0 | 30 | objectStore.add(obj).onerror = errorHandler; |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function onDone() { |
michael@0 | 35 | window.removeEventListener("indexedDB-addMore", onAddMore, true); |
michael@0 | 36 | window.removeEventListener("indexedDB-done", onDone, true); |
michael@0 | 37 | |
michael@0 | 38 | let request = indexedDB.open(window.location.pathname, version++); |
michael@0 | 39 | request.onerror = errorHandler; |
michael@0 | 40 | request.onupgradeneeded = function(event) { |
michael@0 | 41 | db.deleteObjectStore("foo"); |
michael@0 | 42 | db.onversionchange = function () { db.close(); }; |
michael@0 | 43 | request.transaction.oncomplete = function(event) { |
michael@0 | 44 | testResult = "finished"; |
michael@0 | 45 | testException = undefined; |
michael@0 | 46 | finishTest(); |
michael@0 | 47 | } |
michael@0 | 48 | } |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | function testSteps() |
michael@0 | 52 | { |
michael@0 | 53 | const name = window.location.pathname; |
michael@0 | 54 | |
michael@0 | 55 | window.addEventListener("indexedDB-addMore", onAddMore, true); |
michael@0 | 56 | window.addEventListener("indexedDB-done", onDone, true); |
michael@0 | 57 | |
michael@0 | 58 | let request = indexedDB.open(name, version++); |
michael@0 | 59 | request.onerror = errorHandler; |
michael@0 | 60 | request.onupgradeneeded = grabEventAndContinueHandler; |
michael@0 | 61 | let event = yield undefined; |
michael@0 | 62 | |
michael@0 | 63 | db = event.target.result; |
michael@0 | 64 | |
michael@0 | 65 | db.onversionchange = function () { db.close(); }; |
michael@0 | 66 | |
michael@0 | 67 | db.createObjectStore("foo", { autoIncrement: true }); |
michael@0 | 68 | |
michael@0 | 69 | request.onsuccess = grabEventAndContinueHandler; |
michael@0 | 70 | yield undefined; |
michael@0 | 71 | |
michael@0 | 72 | setTimeout(testFinishedCallback, 0, "ready"); |
michael@0 | 73 | yield undefined; |
michael@0 | 74 | } |
michael@0 | 75 | </script> |
michael@0 | 76 | |
michael@0 | 77 | <script type="text/javascript;version=1.7" src="browserHelpers.js"></script> |
michael@0 | 78 | |
michael@0 | 79 | </head> |
michael@0 | 80 | |
michael@0 | 81 | <body onload="runTest();" onunload="finishTestNow();"></body> |
michael@0 | 82 | |
michael@0 | 83 | </html> |