OLD | NEW |
1 // original test: | 1 // original test: |
2 // http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_remove_objec
tStore.html?force=1 | 2 // http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_remove_objec
tStore.html?force=1 |
3 // license of original test: | 3 // license of original test: |
4 // " Any copyright is dedicated to the Public Domain. | 4 // " Any copyright is dedicated to the Public Domain. |
5 // http://creativecommons.org/publicdomain/zero/1.0/ " | 5 // http://creativecommons.org/publicdomain/zero/1.0/ " |
6 | 6 |
7 if (this.importScripts) { | 7 if (this.importScripts) { |
8 importScripts('../../../../resources/js-test.js'); | 8 importScripts('../../../../resources/js-test.js'); |
9 importScripts('../../resources/shared.js'); | 9 importScripts('../../resources/shared.js'); |
10 } | 10 } |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 for (i = 0; i < 100; i++) { | 23 for (i = 0; i < 100; i++) { |
24 request = evalAndLog("request = objectStore.add({foo: i});"); | 24 request = evalAndLog("request = objectStore.add({foo: i});"); |
25 request.onerror = unexpectedErrorCallback; | 25 request.onerror = unexpectedErrorCallback; |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 function checkObjectStore() | 29 function checkObjectStore() |
30 { | 30 { |
31 shouldBe("db.objectStoreNames.length", "1"); | 31 shouldBe("db.objectStoreNames.length", "1"); |
32 shouldBe("db.objectStoreNames.item(0)", "objectStoreName"); | 32 shouldBe("db.objectStoreNames[0]", "objectStoreName"); |
33 evalAndLog("db.close()"); | 33 evalAndLog("db.close()"); |
34 | 34 |
35 evalAndLog("request = indexedDB.open(dbname, 2)"); | 35 evalAndLog("request = indexedDB.open(dbname, 2)"); |
36 request.onerror = unexpectedErrorCallback; | 36 request.onerror = unexpectedErrorCallback; |
37 request.onblocked = unexpectedBlockedCallback; | 37 request.onblocked = unexpectedBlockedCallback; |
38 request.onupgradeneeded = inSetVersion2; | 38 request.onupgradeneeded = inSetVersion2; |
39 request.onsuccess = setVersion3; | 39 request.onsuccess = setVersion3; |
40 } | 40 } |
41 | 41 |
42 function inSetVersion2() | 42 function inSetVersion2() |
43 { | 43 { |
44 db = event.target.result; | 44 db = event.target.result; |
45 evalAndLog("db.deleteObjectStore(objectStore.name);"); | 45 evalAndLog("db.deleteObjectStore(objectStore.name);"); |
46 shouldBe("db.objectStoreNames.length", "0"); | 46 shouldBe("db.objectStoreNames.length", "0"); |
47 | 47 |
48 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); | 48 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); |
49 shouldBe("db.objectStoreNames.length", "1"); | 49 shouldBe("db.objectStoreNames.length", "1"); |
50 shouldBe("db.objectStoreNames.item(0)", "objectStoreName"); | 50 shouldBe("db.objectStoreNames[0]", "objectStoreName"); |
51 | 51 |
52 request = evalAndLog("request = objectStore.openCursor();"); | 52 request = evalAndLog("request = objectStore.openCursor();"); |
53 request.onerror = unexpectedErrorCallback; | 53 request.onerror = unexpectedErrorCallback; |
54 request.onsuccess = function(event) { | 54 request.onsuccess = function(event) { |
55 shouldBe("event.target.result", "null"); | 55 shouldBe("event.target.result", "null"); |
56 deleteSecondObjectStore(); | 56 deleteSecondObjectStore(); |
57 }; | 57 }; |
58 } | 58 } |
59 | 59 |
60 function deleteSecondObjectStore() | 60 function deleteSecondObjectStore() |
(...skipping 19 matching lines...) Expand all Loading... |
80 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); | 80 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); |
81 request = evalAndLog("request = objectStore.add({foo:'bar'});"); | 81 request = evalAndLog("request = objectStore.add({foo:'bar'});"); |
82 request.onerror = unexpectedErrorCallback; | 82 request.onerror = unexpectedErrorCallback; |
83 request.onsuccess = deleteThirdObjectStore; | 83 request.onsuccess = deleteThirdObjectStore; |
84 } | 84 } |
85 | 85 |
86 function deleteThirdObjectStore() | 86 function deleteThirdObjectStore() |
87 { | 87 { |
88 evalAndLog("db.deleteObjectStore(objectStoreName);"); | 88 evalAndLog("db.deleteObjectStore(objectStoreName);"); |
89 } | 89 } |
OLD | NEW |