Commit 90550368 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Make assert_reports_js use assert_throws_js

This was originally left out of https://crrev.com/d255670 due to an
error when trying to use assert_throws_js. After investigation, it turns
out just to be that the function using assert_reports_js was not passing
a TypeError from the right global.

Bug: None
Change-Id: I8067949ddf6e9108bd862287cb49eef7aa788eff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128243Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755070}
parent 047d57f3
......@@ -146,7 +146,7 @@ test_with_window((w) => {
}
w.customElements.define('a-a', A);
let d = w.document.createElement('div');
assert_reports_js(window, TypeError, () => {
assert_reports_js(window, w.TypeError, () => {
d.innerHTML = '<a-a>';
}, 'Creating an element that is already constructed marker should report ' +
'InvalidStateError');
......
......@@ -97,8 +97,5 @@ function assert_reports_js(w, expected_error, func, description) {
w.onerror = old_onerror;
}
assert_equals(errors.length, 1, 'only one error should have been reported');
assert_true(
typeof errors[0] === 'object' && errors[0] !== null,
'got something other than an error');
assert_equals(expected_error.name, errors[0].name);
assert_throws_js(expected_error, () => { throw errors[0]; });
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment