diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2022-12-20 11:37:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 03:37:50 +0100 |
commit | 948f85216a15e4ef489af21bb532a9b201b0364c (patch) | |
tree | 35c2bbfa021cf9a4190ab803ed091c5547bfe9f4 /ext/flash | |
parent | 2ac575abfb75dc4533306c80240cb1beeb816b9b (diff) |
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
Diffstat (limited to 'ext/flash')
-rw-r--r-- | ext/flash/01_http.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/flash/01_http.js b/ext/flash/01_http.js index 2b0caff49..8c71322d7 100644 --- a/ext/flash/01_http.js +++ b/ext/flash/01_http.js @@ -27,11 +27,11 @@ } = window.__bootstrap.webSocket; const { _ws } = window.__bootstrap.http; const { - Function, ObjectPrototypeIsPrototypeOf, - Promise, + PromisePrototype, PromisePrototypeCatch, PromisePrototypeThen, + SafeArrayIterator, SafePromiseAll, TypedArrayPrototypeSubarray, TypeError, @@ -140,7 +140,7 @@ // status-line = HTTP-version SP status-code SP reason-phrase CRLF // Date header: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2 let str = `HTTP/1.1 ${status} ${statusCodes[status]}\r\nDate: ${date}\r\n`; - for (const [name, value] of headerList) { + for (const [name, value] of new SafeArrayIterator(headerList)) { // header-field = field-name ":" OWS field-value OWS str += `${name}: ${value}\r\n`; } @@ -439,10 +439,10 @@ return async function serve(arg1, arg2) { let options = undefined; let handler = undefined; - if (arg1 instanceof Function) { + if (typeof arg1 === "function") { handler = arg1; options = arg2; - } else if (arg2 instanceof Function) { + } else if (typeof arg2 === "function") { handler = arg2; options = arg1; } else { @@ -456,7 +456,7 @@ } handler = options.handler; } - if (!(handler instanceof Function)) { + if (typeof handler !== "function") { throw new TypeError("A handler function must be provided."); } if (options === undefined) { @@ -570,7 +570,7 @@ let resp; try { resp = handler(req); - if (resp instanceof Promise) { + if (ObjectPrototypeIsPrototypeOf(PromisePrototype, resp)) { PromisePrototypeCatch( PromisePrototypeThen( resp, |