Files
firefox/testing/web-platform/tests/fetch/api/request/request-init-priority.any.js
Patrick Meenan 2c579ff89a Bug 1805296 [wpt PR 37464] - Moved the fetch parts of the priority hints tests, a=testonly
Automatic update from web-platform-tests
Moved the fetch parts of the priority hints tests

Moved the fetch parts of the priority hints tests into fetch as we're
getting ready to land the spec changes.

This also adds tests that successful use of the priority requestinit
attribute works as expected and that the internal-only attributes
(blocking, priority and internalpriority) are not exposed on Request.

Bug: 1301942
Change-Id: I311fba04587d1eb50b89c0f9303ac628d86a9529
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4097472
Commit-Queue: Patrick Meenan <[email protected]>
Reviewed-by: Domenic Denicola <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1104084}

--

wpt-commits: 027bf08adebeda4dc2ead8b0186cabb951c1325d
wpt-pr: 37464
2023-03-02 11:01:29 +00:00

27 lines
965 B
JavaScript

var priorities = ["high",
"low",
"auto"
];
for (idx in priorities) {
test(() => {
new Request("", {priority: priorities[idx]});
}, "new Request() with a '" + priorities[idx] + "' priority does not throw an error");
}
test(() => {
assert_throws_js(TypeError, () => {
new Request("", {priority: 'invalid'});
}, "a new Request() must throw a TypeError if RequestInit's priority is an invalid value");
}, "new Request() throws a TypeError if any of RequestInit's members' values are invalid");
for (idx in priorities) {
promise_test(function(t) {
return fetch('hello.txt', { priority: priorities[idx] });
}, "fetch() with a '" + priorities[idx] + "' priority completes successfully");
}
promise_test(function(t) {
return promise_rejects_js(t, TypeError, fetch('hello.txt', { priority: 'invalid' }));
}, "fetch() with an invalid priority returns a rejected promise with a TypeError");