summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit/fetch_test.ts10
-rw-r--r--extensions/fetch/26_fetch.js1
-rw-r--r--tools/wpt/expectation.json3
3 files changed, 12 insertions, 2 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index e046e9c03..e73953a5c 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -9,6 +9,16 @@ import {
} from "./test_util.ts";
import { Buffer } from "../../../test_util/std/io/buffer.ts";
+unitTest(
+ { perms: { net: true } },
+ async function fetchRequiresOneArgument(): Promise<void> {
+ await assertThrowsAsync(
+ fetch as unknown as () => Promise<void>,
+ TypeError,
+ );
+ },
+);
+
unitTest({ perms: { net: true } }, async function fetchProtocolError(): Promise<
void
> {
diff --git a/extensions/fetch/26_fetch.js b/extensions/fetch/26_fetch.js
index cd86d6023..1dd797339 100644
--- a/extensions/fetch/26_fetch.js
+++ b/extensions/fetch/26_fetch.js
@@ -273,6 +273,7 @@
*/
async function fetch(input, init = {}) {
const prefix = "Failed to call 'fetch'";
+ webidl.requiredArguments(arguments.length, 1, { prefix });
input = webidl.converters["RequestInfo"](input, {
prefix,
context: "Argument 1",
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json
index 5159ac0b0..407e301bb 100644
--- a/tools/wpt/expectation.json
+++ b/tools/wpt/expectation.json
@@ -1014,7 +1014,6 @@
"Response interface: operation json()",
"Response interface: operation text()",
"Response interface: calling redirect(USVString, optional unsigned short) on new Response() with too few arguments must throw TypeError",
- "Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError",
"Window interface: operation fetch(RequestInfo, optional RequestInit)"
]
},
@@ -1101,4 +1100,4 @@
"set.any.js": true
}
}
-} \ No newline at end of file
+}