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_setVersion_throw.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_setVersion_throw.js')
-rw-r--r-- | dom/indexedDB/test/unit/test_setVersion_throw.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_setVersion_throw.js b/dom/indexedDB/test/unit/test_setVersion_throw.js new file mode 100644 index 000000000..a589bb385 --- /dev/null +++ b/dom/indexedDB/test/unit/test_setVersion_throw.js @@ -0,0 +1,54 @@ +/** + * 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 : "test_setVersion_throw"; + + // This test requires two databases. The first needs to be a low version + // number that gets closed when a second higher version number database is + // created. Then the upgradeneeded event for the second database throws an + // exception and triggers an abort/close. + + let request = indexedDB.open(name, 1); + request.onerror = errorHandler; + request.onsuccess = grabEventAndContinueHandler; + request.onupgradeneeded = function(event) { + info("Got upgradeneeded event for db 1"); + }; + let event = yield undefined; + + is(event.type, "success", "Got success event for db 1"); + + let db = event.target.result; + db.onversionchange = function(event) { + info("Got versionchange event for db 1"); + event.target.close(); + } + + executeSoon(continueToNextStepSync); + yield undefined; + + request = indexedDB.open(name, 2); + request.onerror = grabEventAndContinueHandler; + request.onsuccess = unexpectedSuccessHandler; + request.onupgradeneeded = function(event) { + info("Got upgradeneeded event for db 2"); + expectUncaughtException(true); + trigger_js_exception_by_calling_a_nonexistent_function(); + }; + event = yield undefined; + + event.preventDefault(); + + is(event.type, "error", "Got an error event for db 2"); + ok(event.target.error instanceof DOMError, "Request has a DOMError"); + is(event.target.error.name, "AbortError", "Request has AbortError"); + + finishTest(); + yield undefined; +} |