Skip to content

Commit 1c15cd4

Browse files
authored
fetch: handle invalid priority values properly (#4522)
1 parent f2f3281 commit 1c15cd4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/web/fetch/request.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,12 @@ webidl.converters.RequestInit = webidl.dictionaryConverter([
10941094
{
10951095
key: 'dispatcher', // undici specific option
10961096
converter: webidl.converters.any
1097+
},
1098+
{
1099+
key: 'priority',
1100+
converter: webidl.converters.DOMString,
1101+
allowedValues: ['high', 'low', 'auto'],
1102+
defaultValue: () => 'auto'
10971103
}
10981104
])
10991105

test/web-platform-tests/expectation.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4131,8 +4131,7 @@
41314131
},
41324132
{
41334133
"name": "new Request() throws a TypeError if any of RequestInit's members' values are invalid",
4134-
"success": false,
4135-
"message": "assert_throws_js: a new Request() must throw a TypeError if RequestInit's priority is an invalid value function \"() => {\n new Request(\"\", {priority: 'invalid'});\n }\" did not throw"
4134+
"success": true
41364135
},
41374136
{
41384137
"name": "fetch() with a 'high' priority completes successfully",
@@ -4148,8 +4147,7 @@
41484147
},
41494148
{
41504149
"name": "fetch() with an invalid priority returns a rejected promise with a TypeError",
4151-
"success": false,
4152-
"message": "assert_unreached: Should have rejected: undefined Reached unreachable code"
4150+
"success": true
41534151
}
41544152
]
41554153
},

0 commit comments

Comments
 (0)