Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace some assert_throws('Something', stuff) calls with assert_throws_dom #21392

Merged
merged 1 commit into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions 2dcontext/imagebitmap/createImageBitmap-origin.sub.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.drawImage(bitmap, 0, 0);
assert_throws('SecurityError', () => canvas.toDataURL());
assert_throws_dom('SecurityError', () => canvas.toDataURL());
}

function assert_origin_unclean_transferFromImageBitmap(bitmap) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('bitmaprenderer');
ctx.transferFromImageBitmap(bitmap);
assert_throws('SecurityError', () => canvas.toDataURL());
assert_throws_dom('SecurityError', () => canvas.toDataURL());
}

forEachCanvasSource("http://{{domains[www1]}}:{{ports[http][0]}}",
Expand Down
2 changes: 1 addition & 1 deletion 2dcontext/imagebitmap/createImageBitmap-serializable.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
const image = await makeMakeHTMLImage(url)();
const bitmap = await createImageBitmap(image);

assert_throws('DataCloneError', () => worker.postMessage(bitmap));
assert_throws_dom('DataCloneError', () => worker.postMessage(bitmap));
}, 'Serializing a non-origin-clean ImageBitmap throws.');
</script>
2 changes: 1 addition & 1 deletion 2dcontext/imagebitmap/createImageBitmap-transfer.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
const image = await makeMakeHTMLImage(url)();
const bitmap = await createImageBitmap(image);

assert_throws('DataCloneError',
assert_throws_dom('DataCloneError',
() => worker.postMessage(bitmap, [bitmap]));
}, 'Transferring a non-origin-clean ImageBitmap throws.');

Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/clone-before-keypath-eval.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
const tx = db.transaction('store', 'readwrite');
const store = tx.objectStore('store');
const obj = new ProbeObject();
assert_throws('DataError', () => { store.put(obj); },
assert_throws_dom('DataError', () => { store.put(obj); },
'put() should throw if primary key cannot be injected');
assert_equals(
obj.invalid_id_count, 1,
Expand Down
14 changes: 7 additions & 7 deletions IndexedDB/idb-explicit-commit.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ promise_test(async testCase => {
const txn = db.transaction(['books'], 'readwrite');
const objectStore = txn.objectStore('books');
txn.commit();
assert_throws('TransactionInactiveError',
assert_throws_dom('TransactionInactiveError',
() => { objectStore.put({isbn: 'one', title: 'title1'}); },
'After commit is called, the transaction should be inactive.');
db.close();
Expand All @@ -76,7 +76,7 @@ promise_test(async testCase => {
const objectStore = txn.objectStore('books');
const putRequest = objectStore.put({isbn: 'one', title: 'title1'});
putRequest.onsuccess = testCase.step_func(() => {
assert_throws('TransactionInactiveError',
assert_throws_dom('TransactionInactiveError',
() => { objectStore.put({isbn:'two', title:'title2'}); },
'The transaction should not be active in the callback of a request after '
+ 'commit() is called.');
Expand All @@ -95,7 +95,7 @@ promise_test(async testCase => {
const objectStore = txn.objectStore('books');
txn.commit();

assert_throws('TransactionInactiveError',
assert_throws_dom('TransactionInactiveError',
() => { objectStore.put({isbn:'one', title:'title1'}); },
'After commit is called, the transaction should be inactive.');

Expand All @@ -116,7 +116,7 @@ promise_test(async testCase => {
const txn = db.transaction(['books'], 'readwrite');
const objectStore = txn.objectStore('books');
txn.abort();
assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
() => { txn.commit(); },
'The transaction should have been aborted.');
db.close();
Expand All @@ -130,7 +130,7 @@ promise_test(async testCase => {
const txn = db.transaction(['books'], 'readwrite');
const objectStore = txn.objectStore('books');
txn.commit();
assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
() => { txn.commit(); },
'The transaction should have already committed.');
db.close();
Expand All @@ -145,7 +145,7 @@ promise_test(async testCase => {
const objectStore = txn.objectStore('books');
const putRequest = objectStore.put({isbn:'one', title:'title1'});
txn.commit();
assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
() => { txn.abort(); },
'The transaction should already have committed.');
const txn2 = db.transaction(['books'], 'readwrite');
Expand Down Expand Up @@ -173,7 +173,7 @@ promise_test(async testCase => {
// state.
await timeoutPromise(0);

assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
() => { txn.commit(); },
'The transaction should be inactive so calling commit should throw.');
releaseTxnFunction();
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idbcursor-advance-exception-order.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
db.deleteObjectStore('s2');

setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => { cursor.advance(1); },
assert_throws_dom('TransactionInactiveError', () => { cursor.advance(1); },
'"not active" check (TransactionInactiveError) ' +
'should precede "deleted" check (InvalidStateError)');
t.done();
Expand Down Expand Up @@ -77,7 +77,7 @@
cursor.advance(1);

setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => { cursor.advance(1); },
assert_throws_dom('TransactionInactiveError', () => { cursor.advance(1); },
'"not active" check (TransactionInactiveError) ' +
'should precede "got value" check (InvalidStateError)');
t.done();
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idbcursor-advance-invalid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
cursor.advance(1);

// Second try
assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
function() { cursor.advance(1); }, 'second advance');

assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
function() { cursor.advance(3); }, 'third advance');

count++;
Expand Down
6 changes: 3 additions & 3 deletions IndexedDB/idbcursor-continue-exception-order.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
r.onsuccess = null;
const cursor = r.result;
setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.continue({not: "a valid key"});
}, '"Transaction inactive" check (TransactionInactiveError) ' +
'should precede "invalid key" check (DataError)');
Expand All @@ -44,7 +44,7 @@
cursor.continue();
r.onsuccess = t.step_func(() => {
setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.continue();
}, '"Transaction inactive" check (TransactionInactiveError) ' +
'should precede "got value flag" check (InvalidStateError)');
Expand All @@ -68,7 +68,7 @@
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
assert_throws('InvalidStateError', () => {
assert_throws_dom('InvalidStateError', () => {
cursor.continue({not: "a valid key"});
}, '"got value flag" check (InvalidStateError) should precede ' +
'"invalid key" check (DataError)');
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idbcursor-continuePrimaryKey-exceptions.htm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
assert_class_string(cursor, 'IDBCursorWithValue',
'result should be a cursor');

assert_throws('InvalidAccessError', function() {
assert_throws_dom('InvalidAccessError', function() {
cursor.continuePrimaryKey(2, 2);
}, 'continuePrimaryKey() should throw if source is not an index');
});
Expand Down Expand Up @@ -87,7 +87,7 @@
assert_equals(cursor.primaryKey, testcase.expected_primaryKey,
'primaryKey should match');

assert_throws('InvalidAccessError', function() {
assert_throws_dom('InvalidAccessError', function() {
cursor.continuePrimaryKey(
testcase.continue_key,
testcase.continue_primaryKey);
Expand Down
6 changes: 3 additions & 3 deletions IndexedDB/idbcursor-delete-exception-order.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
r.onsuccess = null;
const cursor = r.result;
setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.delete();
}, '"Transaction inactive" check (TransactionInactivError) ' +
'should precede "read only" check (ReadOnlyError)');
Expand All @@ -42,7 +42,7 @@
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
assert_throws('ReadOnlyError', () => {
assert_throws_dom('ReadOnlyError', () => {
cursor.delete();
}, '"Read only" check (ReadOnlyError) should precede ' +
'"got value flag" (InvalidStateError) check');
Expand All @@ -63,7 +63,7 @@
r.onsuccess = t.step_func(() => {
r.onsuccess = null;
const cursor = r.result;
assert_throws('ReadOnlyError', () => {
assert_throws_dom('ReadOnlyError', () => {
cursor.delete();
}, '"Read only" check (ReadOnlyError) should precede ' +
'"key only flag" (InvalidStateError) check');
Expand Down
8 changes: 4 additions & 4 deletions IndexedDB/idbcursor-update-exception-order.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
r.onsuccess = null;
const cursor = r.result;
setTimeout(t.step_func(() => {
assert_throws('TransactionInactiveError', () => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.update('value2');
}, '"Transaction inactive" check (TransactionInactiveError) ' +
'should precede "read only" check (ReadOnlyError)');
Expand All @@ -42,7 +42,7 @@
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
assert_throws('ReadOnlyError', () => {
assert_throws_dom('ReadOnlyError', () => {
cursor.update('value2');
}, '"Read only" check (ReadOnlyError) should precede '+
'"got value flag" check (InvalidStateError)');
Expand All @@ -63,7 +63,7 @@
r.onsuccess = t.step_func(() => {
r.onsuccess = null;
const cursor = r.result;
assert_throws('ReadOnlyError', () => {
assert_throws_dom('ReadOnlyError', () => {
cursor.update('value2');
}, '"Read only" check (ReadOnlyError) should precede '+
'"key only flag" check (InvalidStateError)');
Expand All @@ -85,7 +85,7 @@
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
assert_throws('InvalidStateError', () => {
assert_throws_dom('InvalidStateError', () => {
cursor.update({id: 123, data: 'value2'});
}, '"Got value flag" check (InvalidStateError) should precede ' +
'"modified key" check (DataError)');
Expand Down
4 changes: 2 additions & 2 deletions IndexedDB/idbcursor_continue_invalid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
cursor.continue(undefined);

// Second try
assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
function() { cursor.continue(); }, 'second continue');

assert_throws('InvalidStateError',
assert_throws_dom('InvalidStateError',
function() { cursor.continue(3); }, 'third continue');

count++;
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_delete_index2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
var cursor = e.target.result;

assert_true(cursor instanceof IDBCursor, "cursor exist");
assert_throws('ReadOnlyError', function() { cursor.delete(); });
assert_throws_dom('ReadOnlyError', function() { cursor.delete(); });
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_delete_index3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
});

e.target.transaction.oncomplete = t.step_func(function(e) {
assert_throws('TransactionInactiveError', function() { window.cursor.delete(); })
assert_throws_dom('TransactionInactiveError', function() { window.cursor.delete(); })
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_delete_objectstore2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
var cursor = e.target.result;

assert_true(cursor != null, "cursor exist");
assert_throws('ReadOnlyError', function() { cursor.delete(); });
assert_throws_dom('ReadOnlyError', function() { cursor.delete(); });
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_delete_objectstore3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
});

e.target.transaction.oncomplete = t.step_func(function(e) {
assert_throws('TransactionInactiveError', function() { window.cursor.delete(); })
assert_throws_dom('TransactionInactiveError', function() { window.cursor.delete(); })
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_index2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

cursor_rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
assert_throws('ReadOnlyError', function() { cursor.update(cursor.value); });
assert_throws_dom('ReadOnlyError', function() { cursor.update(cursor.value); });
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_index3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
});

e.target.transaction.oncomplete = t.step_func(function(e) {
assert_throws('TransactionInactiveError', function() { window.cursor.update(window.record); })
assert_throws_dom('TransactionInactiveError', function() { window.cursor.update(window.record); })
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_index5.htm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

var record = cursor.value;
record.data = document;
assert_throws('DataCloneError', function() {
assert_throws_dom('DataCloneError', function() {
cursor.update(record);
});
t.done();
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_index7.htm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
var cursor = e.target.result;
assert_true(cursor instanceof IDBCursor);

assert_throws('DataError', function() { cursor.update(null); });
assert_throws_dom('DataError', function() { cursor.update(null); });
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_objectstore2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

cursor_rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
assert_throws('ReadOnlyError', function() { cursor.update(cursor.value); });
assert_throws_dom('ReadOnlyError', function() { cursor.update(cursor.value); });
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_objectstore3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
});

e.target.transaction.oncomplete = t.step_func(function(e) {
assert_throws('TransactionInactiveError', function() { window.cursor.update(window.record); })
assert_throws_dom('TransactionInactiveError', function() { window.cursor.update(window.record); })
t.done();
});
}
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_objectstore6.htm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

var record = cursor.value;
record.data = document;
assert_throws('DataCloneError', function() {
assert_throws_dom('DataCloneError', function() {
cursor.update(record);
});
t.done();
Expand Down
2 changes: 1 addition & 1 deletion IndexedDB/idbcursor_update_objectstore8.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var cursor = e.target.result;
assert_true(cursor instanceof IDBCursor);

assert_throws('DataError', function() { cursor.update(null); });
assert_throws_dom('DataError', function() { cursor.update(null); });
t.done();
});
}
Expand Down