mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1552309 - Avoid timing out with buggy behaviour in IndexedDB test, r=asuth
Ensure that the test returns a result in various error conditions including databases not being defined, and databases() throwing an exception. This avoids the test timing out as a failure mode and so saves some runtime. Differential Revision: https://phabricator.services.mozilla.com/D31523 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b2dea19e2d
commit
d5479b6d88
@ -1,8 +1,7 @@
|
||||
[idbfactory-databases-opaque-origin.html]
|
||||
expected: TIMEOUT
|
||||
[IDBFactory.databases() in sandboxed iframe should reject]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
||||
[IDBFactory.databases() in non-sandboxed iframe should not reject]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
||||
|
@ -31,9 +31,16 @@ function wait_for_message(iframe) {
|
||||
const script =
|
||||
'<script>' +
|
||||
' window.onmessage = () => {' +
|
||||
' indexedDB.databases().then(' +
|
||||
' () => window.parent.postMessage({result: "no exception"}, "*"),' +
|
||||
' ex => window.parent.postMessage({result: ex.name}, "*"));' +
|
||||
' try { ' +
|
||||
' if (!indexedDB || !indexedDB.databases) {' +
|
||||
' window.parent.postMessage({result: "indexedDB.databases undefined"}, "*")' +
|
||||
' }' +
|
||||
' indexedDB.databases().then(' +
|
||||
' () => window.parent.postMessage({result: "no exception"}, "*"),' +
|
||||
' ex => window.parent.postMessage({result: ex.name}, "*"));' +
|
||||
' } catch(e) { ' +
|
||||
' window.parent.postMessage({result: e.name + " thrown, not rejected"}, "*")' +
|
||||
' }'+
|
||||
' };' +
|
||||
'<\/script>';
|
||||
|
||||
@ -50,6 +57,6 @@ promise_test(async t => {
|
||||
iframe.contentWindow.postMessage({}, '*');
|
||||
const message = await wait_for_message(iframe);
|
||||
assert_equals(message.result, 'SecurityError',
|
||||
'Exception should be SecurityError');
|
||||
'Promise should be rejected with SecurityError');
|
||||
}, 'IDBFactory.databases() in sandboxed iframe should reject');
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user