diff options
author | 迷渡 <justjavac@gmail.com> | 2019-06-10 19:20:59 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-06-10 07:20:59 -0400 |
commit | 5871d22d9b1f99a4735ff7b4e2dcca977795aa74 (patch) | |
tree | 4eeb9dabb651058cddb4bc4cd30aee043ff0dfee /js/url_search_params.ts | |
parent | a115340288d974f141cceb16faac71914402c445 (diff) |
check `URLSearchParams.constructor`'s params (#2488)
Diffstat (limited to 'js/url_search_params.ts')
-rw-r--r-- | js/url_search_params.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/js/url_search_params.ts b/js/url_search_params.ts index 1d9aa43b3..d9c4e59ab 100644 --- a/js/url_search_params.ts +++ b/js/url_search_params.ts @@ -280,11 +280,11 @@ export class URLSearchParams { // Overload: sequence<sequence<USVString>> for (const tuple of init) { // If pair does not contain exactly two items, then throw a TypeError. - requiredArguments( - "URLSearchParams.constructor tuple array argument", - tuple.length, - 2 - ); + if (tuple.length !== 2) { + throw new TypeError( + "URLSearchParams.constructor tuple array argument must only contain pair elements" + ); + } this.append(tuple[0], tuple[1]); } } |