Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: dom/indexedDB/test/unit/xpcshell-child-process.toml includes dom/indexedDB/test/unit/xpcshell-shared.toml
- Manifest: dom/indexedDB/test/unit/xpcshell-parent-process.toml includes dom/indexedDB/test/unit/xpcshell-shared.toml
/**
* Any copyright is dedicated to the Public Domain.
*/
/* exported testGenerator */
var testGenerator = testSteps();
function* testSteps() {
const name = this.window ? window.location.pathname : "Splendid Test";
let request = indexedDB.open(name, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield undefined;
let db = request.result;
ok(event.target === request, "Good event target");
let objectStore = db.createObjectStore("foo", { keyPath: null });
let key = 10;
request = objectStore.add({}, key);
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(request.result, key, "Correct key");
request = objectStore.add({}, key);
request.addEventListener("error", new ExpectError("ConstraintError", true));
request.onsuccess = unexpectedSuccessHandler;
yield undefined;
// Wait for success.
yield undefined;
finishTest();
}