summaryrefslogtreecommitdiff
path: root/ext/flash/01_http.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/flash/01_http.js')
-rw-r--r--ext/flash/01_http.js14
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,