Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ promise_test(async _ => {
// Queues a max bytes request in the root document, which should also be
// rejected, because the target URL's origin `HTTPS_ORIGIN` already has 64kb
// pending from 1st request.
assert_throws_dom(
'QuotaExceededError',
assert_throws_quotaexceedederror(
() => fetchLater(requestUrl, {
method: 'POST',
body: generatePayload(
getRemainingQuota(QUOTA_PER_ORIGIN, requestUrl, headers), dataType),
// Required, as the size of referrer also take up quota.
referrer: '',
}));
}),
null, null);

// Release quota taken by the pending requests for subsequent tests.
for (const element of document.querySelectorAll('iframe')) {
Expand Down
7 changes: 2 additions & 5 deletions fetch/fetch-later/resources/fetch-later-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ class FetchLaterIframeExpectation {
url, 'nothing', this.expectedErrorType.name);
}
if (e.data.type === FetchLaterIframeMessageType.ERROR) {
if (e.data.error.constructor === this.expectedErrorType &&
e.data.error.name === this.expectedErrorType.name) {
if (e.data.error.name === this.expectedErrorType.name) {
return true;
}
throw new FetchLaterExpectationError(
Expand All @@ -417,9 +416,7 @@ class FetchLaterIframeExpectation {
const actual = e.data.error.name || e.data.error.type;
if (this.expectedDomErrorName === 'QuotaExceededError') {
return actual == this.expectedDomErrorName;
} else if (
e.data.error.constructor.name === 'DOMException' &&
actual == this.expectedDomErrorName) {
} else if (actual == this.expectedDomErrorName) {
return true;
}
throw new FetchLaterExpectationError(
Expand Down
6 changes: 5 additions & 1 deletion fetch/fetch-later/resources/fetch-later.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
fetchLater(TARGET_URL, REQUEST_INIT);
postMessageBack({type: FetchLaterIframeMessageType.DONE});
} catch (e) {
postMessageBack({type: FetchLaterIframeMessageType.ERROR, error: e});
postMessageBack({
type: FetchLaterIframeMessageType.ERROR,
// When an error is caught, it might not be cloneable across the boundary.
error: {name: e.name, message: e.message}
});
}
</script>
</body>