mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 21:28:04 +02:00
MozReview-Commit-ID: 4wsHtf9312c --HG-- rename : testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html => testing/web-platform/tests/html/browsers/windows/resources/echo-window-name.html rename : testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html => testing/web-platform/tests/html/browsers/windows/resources/nested-post-to-opener.html rename : testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html => testing/web-platform/tests/html/browsers/windows/resources/noreferrer-window-name.html rename : testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html => testing/web-platform/tests/html/browsers/windows/resources/post-to-opener.html rename : testing/web-platform/tests/html/browsers/windows/support-close.html => testing/web-platform/tests/html/browsers/windows/resources/window-close-button.html rename : testing/web-platform/tests/html/browsers/windows/support-opener-null.html => testing/web-platform/tests/html/browsers/windows/resources/window-opener.html rename : testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end.https.html => testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html rename : testing/web-platform/tests/notifications/shownotification-resolve-manual.html => testing/web-platform/tests/notifications/shownotification-resolve-manual.https.html rename : testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw-manual.html => testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw-manual.https.html rename : testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw.html => testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw.https.html rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/buildtests.py rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/common.js rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/entities.dat rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/tags.dat rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/timestamps.dat rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/tree-building.dat rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/entities.html rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/tags.html rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/timestamps.html rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html => testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/tree-building.html rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-formfeed.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-formfeed.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-lowercase.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-lowercase.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-null.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-null.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-too-short.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-partial.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-two-boms.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-two-boms.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-websrt.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-websrt.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-bom.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-bom.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-no-newline.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-no-newline.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-space-no-newline.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-space-no-newline.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-space.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-space.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-tab-no-newline.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-tab-no-newline.vtt rename : testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-tab.vtt => testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-tab.vtt
205 lines
6 KiB
HTML
205 lines
6 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Fire error event - Exception thrown</title>
|
|
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-error-event">
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=support.js></script>
|
|
<script>
|
|
setup({allow_uncaught_exception:true});
|
|
|
|
function fire_error_event_test(func, description) {
|
|
indexeddb_test(
|
|
(t, db) => {
|
|
db.createObjectStore('s');
|
|
},
|
|
(t, db) => {
|
|
const tx = db.transaction('s', 'readwrite');
|
|
tx.oncomplete = t.unreached_func('transaction should abort');
|
|
const store = tx.objectStore('s');
|
|
store.put(0, 0);
|
|
const request = store.add(0, 0);
|
|
request.onsuccess = t.unreached_func('request should fail');
|
|
func(t, db, tx, request);
|
|
},
|
|
description);
|
|
}
|
|
|
|
// Listeners on the request.
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
request.onerror = () => {
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on request');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
request.onerror = e => {
|
|
e.preventDefault();
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on request, with preventDefault');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
request.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event listener on request');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
request.addEventListener('error', () => {
|
|
// no-op
|
|
});
|
|
request.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in second error event listener on request');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
let second_listener_called = false;
|
|
request.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
request.addEventListener('error', t.step_func(() => {
|
|
second_listener_called = true;
|
|
assert_true(is_transaction_active(tx, 's'),
|
|
'Transaction should be active until dispatch completes');
|
|
}));
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_true(second_listener_called);
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in first error event listener on request, ' +
|
|
'transaction active in second');
|
|
|
|
// Listeners on the transaction.
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
tx.onerror = () => {
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on transaction');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
tx.onerror = e => {
|
|
e.preventDefault();
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on transaction, with preventDefault');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
tx.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event listener on transaction');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
tx.addEventListener('error', () => {
|
|
// no-op
|
|
});
|
|
tx.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in second error event listener on transaction');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
let second_listener_called = false;
|
|
tx.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.addEventListener('error', t.step_func(() => {
|
|
second_listener_called = true;
|
|
assert_true(is_transaction_active(tx, 's'),
|
|
'Transaction should be active until dispatch completes');
|
|
}));
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_true(second_listener_called);
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in first error event listener on transaction, ' +
|
|
'transaction active in second');
|
|
|
|
// Listeners on the connection.
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
db.onerror = () => {
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on connection');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
db.onerror = e => {
|
|
e.preventDefault()
|
|
throw Error();
|
|
};
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event handler on connection, with preventDefault');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
db.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in error event listener on connection');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
db.addEventListener('error', () => {
|
|
// no-op
|
|
});
|
|
db.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in second error event listener on connection');
|
|
|
|
fire_error_event_test((t, db, tx, request) => {
|
|
let second_listener_called = false;
|
|
db.addEventListener('error', () => {
|
|
throw Error();
|
|
});
|
|
db.addEventListener('error', t.step_func(() => {
|
|
second_listener_called = true;
|
|
assert_true(is_transaction_active(tx, 's'),
|
|
'Transaction should be active until dispatch completes');
|
|
}));
|
|
tx.onabort = t.step_func_done(() => {
|
|
assert_true(second_listener_called);
|
|
assert_equals(tx.error.name, 'AbortError');
|
|
});
|
|
}, 'Exception in first error event listener on connection, ' +
|
|
'transaction active in second');
|
|
|
|
</script>
|