function unexpectedSuccessHandler() {
ok(false, "got success when it was not expected!");
finishTest();
}
function finishTest() {
// Let window.onerror have a chance to fire
setTimeout(function() {
setTimeout(function() {
testGenerator.return();
window.parent.postMessage("SimpleTest.finish();", "*");
}, 0);
}, 0);
}
// Test 1: Throwing an exception in an upgradeneeded handler should
// abort the versionchange transaction and fire an error at the request.
let request = indexedDB.open(window.location.pathname, 1);
request.onerror = errorHandler;
request.onsuccess = unexpectedSuccessHandler;
request.onupgradeneeded = function() {
let transaction = request.transaction;
transaction.oncomplete = unexpectedSuccessHandler;
transaction.onabort = grabEventAndContinueHandler;
throw new Error("STOP");
};
let event = yield undefined;
is(event.type, "abort", "Throwing during an upgradeneeded event should abort the transaction.");
is(event.target.error.name, "AbortError", "Got AbortError object");
// Test 3: Throwing during a request's error handler should abort the
// transaction, even if preventDefault is called on the error event.
request = indexedDB.open(window.location.pathname, 1);
request.onerror = errorHandler;
request.onblocked = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
openrequest = request;
event = yield undefined;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.