diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/indexedDB/test/unit/test_deleteDatabase_interactions.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/indexedDB/test/unit/test_deleteDatabase_interactions.js')
-rw-r--r-- | dom/indexedDB/test/unit/test_deleteDatabase_interactions.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_deleteDatabase_interactions.js b/dom/indexedDB/test/unit/test_deleteDatabase_interactions.js new file mode 100644 index 000000000..87f6a6d20 --- /dev/null +++ b/dom/indexedDB/test/unit/test_deleteDatabase_interactions.js @@ -0,0 +1,62 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +var testGenerator = testSteps(); + +function testSteps() +{ + const name = this.window ? window.location.pathname : "Splendid Test"; + + let request = indexedDB.open(name, 10); + request.onerror = errorHandler; + request.onsuccess = unexpectedSuccessHandler; + request.onupgradeneeded = grabEventAndContinueHandler; + + ok(request instanceof IDBOpenDBRequest, "Expect an IDBOpenDBRequest"); + + let event = yield undefined; + + is(event.type, "upgradeneeded", "Expect an upgradeneeded event"); + ok(event instanceof IDBVersionChangeEvent, "Expect a versionchange event"); + + let db = event.target.result; + db.createObjectStore("stuff"); + + request.onsuccess = grabEventAndContinueHandler; + + event = yield undefined; + + is(event.type, "success", "Expect a success event"); + is(event.target, request, "Event has right target"); + ok(event.target.result instanceof IDBDatabase, "Result should be a database"); + is(db.objectStoreNames.length, 1, "Expect an objectStore here"); + + db.close(); + + request = indexedDB.deleteDatabase(name); + + request.onerror = errorHandler; + request.onsuccess = grabEventAndContinueHandler; + + ok(request instanceof IDBOpenDBRequest, "Expect an IDBOpenDBRequest"); + + let openRequest = indexedDB.open(name, 1); + openRequest.onerror = errorHandler; + openRequest.onsuccess = unexpectedSuccessHandler; + + event = yield undefined; + is(event.type, "success", "expect a success event"); + is(event.target, request, "event has right target"); + is(event.target.result, undefined, "event should have no result"); + + openRequest.onsuccess = grabEventAndContinueHandler; + + event = yield undefined; + is(event.target.result.version, 1, "DB has proper version"); + is(event.target.result.objectStoreNames.length, 0, "DB should have no object stores"); + + finishTest(); + yield undefined; +} |