Skip to content

Commit b7bff25

Browse files
committed
Bug 1976160 [wpt PR 53645] - Update QuotaExceededError expectations, a=testonly
Automatic update from web-platform-tests Update QuotaExceededError expectations (#53645) See whatwg/webidl#1465. -- wpt-commits: 1d2c5fb36a6e477c8f915bde7eca027be6abe792 wpt-pr: 53645 UltraBlame original commit: 272d71b3fbc93813a5879430d9f769e4f0eac25c
1 parent 6183e1c commit b7bff25

16 files changed

+251
-63
lines changed

testing/web-platform/tests/WebCryptoAPI/getRandomValues.any.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ for (const array of arrays) {
6060

6161
test(function() {
6262
const maxlength = 65536 / ctor.BYTES_PER_ELEMENT;
63-
assert_throws_dom("QuotaExceededError", function() {
64-
self.crypto.getRandomValues(new ctor(maxlength + 1))
65-
}, "crypto.getRandomValues length over 65536")
63+
assert_throws_quotaexceedederror(() => {
64+
self.crypto.getRandomValues(new ctor(maxlength + 1));
65+
}, null, null, "crypto.getRandomValues length over 65536");
6666
}, "Large length: " + array);
6767

6868
test(function() {

testing/web-platform/tests/ai/language_detection/detector.https.window.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ promise_test(async t => {
133133
const detectPromise = detector.detect(text);
134134

135135
if (inputUsage >= detector.inputQuota) {
136-
await promise_rejects_dom(t, 'QuotaExceededError', detectPromise);
136+
await promise_rejects_quotaexceedederror(t, detectPromise, requested => requested !== null, detector.inputQuota);
137137
} else {
138138
await detectPromise;
139139
}

testing/web-platform/tests/ai/translator/translator.optional.https.window.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ promise_test(async t => {
189189
if (inputUsage < translator.inputQuota) {
190190
assert_equals(await translator.translate(text), 'こんにちは');
191191
} else {
192-
await promise_rejects_dom(
193-
t, 'QuotaExceededError', translator.translate(text));
192+
await promise_rejects_quotaexceedederror(t, translator.translate(text), requested => requested !== null, translator.inputQuota);
194193
}
195194
}, 'Translator.measureInputUsage() and inputQuota basic usage.');
196195

testing/web-platform/tests/background-fetch/fetch.https.window.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ backgroundFetchTest(async (test, backgroundFetch) => {
170170

171171

172172
const options = {downloadTotal: Number.MAX_SAFE_INTEGER};
173-
await promise_rejects_dom(
174-
test, 'QUOTA_EXCEEDED_ERR',
175-
backgroundFetch.fetch(registrationId, 'resources/feature-name.txt', options),
176-
'This fetch should have thrown a quota exceeded error');
173+
await promise_rejects_quotaexceedederror(
174+
test, backgroundFetch.fetch(registrationId, 'resources/feature-name.txt', options),
175+
null, null
176+
);
177177

178178
}, 'Background Fetch that exceeds the quota throws a QuotaExceededError');
179179

testing/web-platform/tests/encrypted-media/scripts/setmediakeys-to-multiple-video-elements.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function runTest(config, qualifier) {
3535
assert_equals(_video2.mediaKeys, _mediaKeys);
3636
return Promise.resolve();
3737
}, function(error) {
38-
assert_equals(error.name, 'QuotaExceededError');
38+
assert_equals(error.constructor, globalThis.QuotaExceededError, 'QuotaExceededError constructor match');
39+
assert_equals(error.quota, null, 'quota');
40+
assert_equals(error.requested, null, 'requested');
3941
assert_not_equals(error.message, '');
4042

4143
return Promise.resolve();
@@ -51,4 +53,4 @@ function runTest(config, qualifier) {
5153
test.done();
5254
}).catch(onFailure);
5355
}, testname);
54-
}
56+
}

testing/web-platform/tests/fetch/fetch-later/quota/accumulated-oversized-payload.tentative.https.window.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ test(
3737

3838

3939

40-
assert_throws_dom('QuotaExceededError', () => {
40+
assert_throws_quotaexceedederror(() => {
4141
fetchLater(requestUrl, {
4242
method: 'POST',
4343
signal: controller.signal,
4444
body: makeBeaconData(generatePayload(quota), dataType),
4545

4646
referrer: '',
4747
});
48-
});
48+
}, null, null);
4949

5050

5151

testing/web-platform/tests/fetch/fetch-later/quota/max-payload.tentative.https.window.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ promise_test(async _ => {
3636
test(_ => {
3737
const uuid = token();
3838
const requestUrl = generateSetBeaconURL(uuid, {host: HTTPS_ORIGIN});
39-
assert_throws_dom(
40-
'QuotaExceededError',
41-
() => fetchLater(requestUrl, {
42-
activateAfter: 0,
43-
method: 'POST',
44-
body: generatePayload(
45-
getRemainingQuota(QUOTA_PER_ORIGIN, requestUrl, headers) + 1,
46-
dataType),
47-
}));
39+
40+
assert_throws_quotaexceedederror(() => {
41+
fetchLater(requestUrl, {
42+
activateAfter: 0,
43+
method: 'POST',
44+
body: generatePayload(
45+
getRemainingQuota(QUOTA_PER_ORIGIN, requestUrl, headers) + 1,
46+
dataType),
47+
});
48+
}, null, null);
4849
}, `fetchLater() rejects max+1 payload in a POST request body of ${dataType}.`);

testing/web-platform/tests/fetch/fetch-later/quota/oversized-payload.tentative.https.window.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ const OVERSIZED_REQUEST_BODY_SIZE = QUOTA_PER_ORIGIN + 1;
99
for (const dataType in BeaconDataType) {
1010

1111

12-
test(
13-
() => assert_throws_dom(
14-
'QuotaExceededError',
15-
() => fetchLater('/', {
16-
activateAfter: 0,
17-
method: 'POST',
18-
body: makeBeaconData(
19-
generatePayload(OVERSIZED_REQUEST_BODY_SIZE), dataType),
20-
})),
21-
`fetchLater() does not accept payload[size=${
12+
test(() => {
13+
assert_throws_quotaexceedederror(() => {
14+
fetchLater('/', {
15+
activateAfter: 0,
16+
method: 'POST',
17+
body: makeBeaconData(
18+
generatePayload(OVERSIZED_REQUEST_BODY_SIZE), dataType),
19+
});
20+
}, null, null);
21+
}, `fetchLater() does not accept payload[size=${
2222
OVERSIZED_REQUEST_BODY_SIZE}] exceeding per-origin quota in a POST request body of ${
2323
dataType}.`);
2424
}

testing/web-platform/tests/fetch/fetch-later/resources/fetch-later.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030
fetchLater(TARGET_URL, REQUEST_INIT);
3131
postMessageBack({type: FetchLaterIframeMessageType.DONE});
3232
} catch (e) {
33-
if (e.name == "QuotaExceededError" &&
34-
e instanceof DOMException) {
35-
// PostMessage is unable to serialize the QuotExceededError object.
36-
// Therefore do basic checks here and pass error name if successful.
37-
e = {name: e.name};
38-
}
3933
postMessageBack({type: FetchLaterIframeMessageType.ERROR, error: e});
4034
}
4135
</script>

testing/web-platform/tests/fs/script-tests/FileSystemBaseHandle-buckets.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ directory_test(async (t, root_dir) => {
3434
await createFileWithContents('mtime.txt', 'short file', inboxRootDir);
3535

3636

37-
return promise_rejects_dom(
38-
t, 'QuotaExceededError',
39-
createFileWithContents(
37+
return promise_rejects_quotaexceedederror(
38+
t,
39+
createFileWithContents(
4040
'mtime2.txt',
4141
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
42-
inboxRootDir));
42+
inboxRootDir
43+
),
44+
null, null);
4345
}, 'Bucket quota restricts the size of a file that can be created');

0 commit comments

Comments
 (0)