diff options
author | 2023-07-23 22:37:48 -0700 | |
---|---|---|
committer | 2023-07-23 22:37:48 -0700 | |
commit | 967ccb5d50b3ce163bb98fd125c56b039743de90 (patch) | |
tree | 39a5af943cdce0efc3cff951ec3ae769a2c8fbcc | |
parent | d8135e85ca28272bd01c4ffef07441ff33baaf0a (diff) | |
download | bun-967ccb5d50b3ce163bb98fd125c56b039743de90.tar.gz bun-967ccb5d50b3ce163bb98fd125c56b039743de90.tar.zst bun-967ccb5d50b3ce163bb98fd125c56b039743de90.zip |
Upgrade WebKit (#3777)
* Upgrade to latest WebKit
* Upgrade WebKit
* hm
* Fix failing tests
* Delete utf8-encoding-fixture.bin.cmp
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
39 files changed, 516 insertions, 633 deletions
diff --git a/.github/workflows/bun-linux-aarch64.yml b/.github/workflows/bun-linux-aarch64.yml index 721e5d052..aaeda6c4e 100644 --- a/.github/workflows/bun-linux-aarch64.yml +++ b/.github/workflows/bun-linux-aarch64.yml @@ -36,7 +36,7 @@ jobs: arch: aarch64 build_arch: arm64 runner: linux-arm64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-linux-arm64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-linux-arm64-lto.tar.gz" webkit_basename: "bun-webkit-linux-arm64-lto" build_machine_arch: aarch64 diff --git a/.github/workflows/bun-linux-build.yml b/.github/workflows/bun-linux-build.yml index f69b165bd..9ad92e6b1 100644 --- a/.github/workflows/bun-linux-build.yml +++ b/.github/workflows/bun-linux-build.yml @@ -46,7 +46,7 @@ jobs: arch: x86_64 build_arch: amd64 runner: big-ubuntu - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-linux-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-linux-amd64-lto.tar.gz" webkit_basename: "bun-webkit-linux-amd64-lto" build_machine_arch: x86_64 - cpu: nehalem @@ -54,7 +54,7 @@ jobs: arch: x86_64 build_arch: amd64 runner: big-ubuntu - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-linux-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-linux-amd64-lto.tar.gz" webkit_basename: "bun-webkit-linux-amd64-lto" build_machine_arch: x86_64 diff --git a/.github/workflows/bun-mac-aarch64.yml b/.github/workflows/bun-mac-aarch64.yml index db81f7d6b..7fa73017c 100644 --- a/.github/workflows/bun-mac-aarch64.yml +++ b/.github/workflows/bun-mac-aarch64.yml @@ -117,7 +117,7 @@ jobs: # obj: bun-obj-darwin-x64-baseline # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: true # compile_obj: false # - cpu: haswell @@ -126,7 +126,7 @@ jobs: # obj: bun-obj-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: true # compile_obj: false # - cpu: nehalem @@ -135,7 +135,7 @@ jobs: # obj: bun-obj-darwin-x64-baseline # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: false # compile_obj: true # - cpu: haswell @@ -144,7 +144,7 @@ jobs: # obj: bun-obj-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: false # compile_obj: true - cpu: native @@ -152,7 +152,7 @@ jobs: tag: bun-darwin-aarch64 obj: bun-obj-darwin-aarch64 artifact: bun-obj-darwin-aarch64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-arm64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-arm64-lto.tar.gz" runner: macos-arm64 dependencies: true compile_obj: true @@ -257,7 +257,7 @@ jobs: # package: bun-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # - cpu: haswell # arch: x86_64 # tag: bun-darwin-x64 @@ -265,14 +265,14 @@ jobs: # package: bun-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" - cpu: native arch: aarch64 tag: bun-darwin-aarch64 obj: bun-obj-darwin-aarch64 package: bun-darwin-aarch64 artifact: bun-obj-darwin-aarch64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-arm64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-arm64-lto.tar.gz" runner: macos-arm64 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/bun-mac-x64-baseline.yml b/.github/workflows/bun-mac-x64-baseline.yml index 80765d29c..bd75ec202 100644 --- a/.github/workflows/bun-mac-x64-baseline.yml +++ b/.github/workflows/bun-mac-x64-baseline.yml @@ -117,7 +117,7 @@ jobs: obj: bun-obj-darwin-x64-baseline runner: macos-11 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" dependencies: true compile_obj: false # - cpu: haswell @@ -126,7 +126,7 @@ jobs: # obj: bun-obj-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: true # compile_obj: false - cpu: nehalem @@ -135,7 +135,7 @@ jobs: obj: bun-obj-darwin-x64-baseline runner: macos-11 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" dependencies: false compile_obj: true # - cpu: haswell @@ -144,7 +144,7 @@ jobs: # obj: bun-obj-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: false # compile_obj: true # - cpu: native @@ -152,7 +152,7 @@ jobs: # tag: bun-darwin-aarch64 # obj: bun-obj-darwin-aarch64 # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # runner: macos-arm64 # dependencies: true # compile_obj: true @@ -258,7 +258,7 @@ jobs: package: bun-darwin-x64 runner: macos-11 artifact: bun-obj-darwin-x64-baseline - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # - cpu: haswell # arch: x86_64 # tag: bun-darwin-x64 @@ -266,14 +266,14 @@ jobs: # package: bun-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # - cpu: native # arch: aarch64 # tag: bun-darwin-aarch64 # obj: bun-obj-darwin-aarch64 # package: bun-darwin-aarch64 # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # runner: macos-arm64 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/bun-mac-x64.yml b/.github/workflows/bun-mac-x64.yml index 0f1e00b44..371486eff 100644 --- a/.github/workflows/bun-mac-x64.yml +++ b/.github/workflows/bun-mac-x64.yml @@ -117,7 +117,7 @@ jobs: # obj: bun-obj-darwin-x64-baseline # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: true # compile_obj: false - cpu: haswell @@ -126,7 +126,7 @@ jobs: obj: bun-obj-darwin-x64 runner: macos-11 artifact: bun-obj-darwin-x64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" dependencies: true compile_obj: false # - cpu: nehalem @@ -135,7 +135,7 @@ jobs: # obj: bun-obj-darwin-x64-baseline # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # dependencies: false # compile_obj: true - cpu: haswell @@ -144,7 +144,7 @@ jobs: obj: bun-obj-darwin-x64 runner: macos-11 artifact: bun-obj-darwin-x64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" dependencies: false compile_obj: true # - cpu: native @@ -152,7 +152,7 @@ jobs: # tag: bun-darwin-aarch64 # obj: bun-obj-darwin-aarch64 # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-arm64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-arm64-lto.tar.gz" # runner: macos-arm64 # dependencies: true # compile_obj: true @@ -260,7 +260,7 @@ jobs: # package: bun-darwin-x64 # runner: macos-11 # artifact: bun-obj-darwin-x64-baseline - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" - cpu: haswell arch: x86_64 tag: bun-darwin-x64 @@ -268,14 +268,14 @@ jobs: package: bun-darwin-x64 runner: macos-11 artifact: bun-obj-darwin-x64 - webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-amd64-lto.tar.gz" + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-amd64-lto.tar.gz" # - cpu: native # arch: aarch64 # tag: bun-darwin-aarch64 # obj: bun-obj-darwin-aarch64 # package: bun-darwin-aarch64 # artifact: bun-obj-darwin-aarch64 - # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/may20-6/bun-webkit-macos-arm64-lto.tar.gz" + # webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-july23/bun-webkit-macos-arm64-lto.tar.gz" # runner: macos-arm64 steps: - uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index c7fa8d523..304bf680d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ARG ARCH=x86_64 ARG BUILD_MACHINE_ARCH=x86_64 ARG TRIPLET=${ARCH}-linux-gnu ARG BUILDARCH=amd64 -ARG WEBKIT_TAG=may20-6 +ARG WEBKIT_TAG=2023-july23 ARG ZIG_TAG=jul1 ARG ZIG_VERSION="0.11.0-dev.4006+bf827d0b5" ARG WEBKIT_BASENAME="bun-webkit-linux-$BUILDARCH" Binary files differdiff --git a/package.json b/package.json index c6e47404f..9da688e5f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@types/ws": "^8.5.5", "@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/parser": "^5.31.0", - "bun-webkit": "0.0.1-1e5c61ef78b14e22278dd884e163a8a95e0529ea" + "bun-webkit": "0.0.1-3a53c6af693c5f387de752b0c793ac1ab5f0a164" }, "version": "0.0.0", "prettier": "./.prettierrc.cjs" diff --git a/src/bun.js/WebKit b/src/bun.js/WebKit -Subproject ecf1b9c4bc2247020add7b14a732bb0085f25d5 +Subproject 284095ff91529df883cf5ab30d66048a3207bad diff --git a/src/bun.js/bindings/URLDecomposition.cpp b/src/bun.js/bindings/URLDecomposition.cpp index 14cf25b6c..d3f11b27f 100644 --- a/src/bun.js/bindings/URLDecomposition.cpp +++ b/src/bun.js/bindings/URLDecomposition.cpp @@ -62,7 +62,7 @@ String URLDecomposition::username() const void URLDecomposition::setUsername(StringView user) { auto fullURL = this->fullURL(); - if (fullURL.host().isEmpty() || fullURL.cannotBeABaseURL() || fullURL.protocolIs("file"_s)) + if (fullURL.host().isEmpty() || fullURL.protocolIsFile()) return; fullURL.setUser(user); setFullURL(fullURL); @@ -76,7 +76,7 @@ String URLDecomposition::password() const void URLDecomposition::setPassword(StringView password) { auto fullURL = this->fullURL(); - if (fullURL.host().isEmpty() || fullURL.cannotBeABaseURL() || fullURL.protocolIs("file"_s)) + if (fullURL.host().isEmpty() || fullURL.protocolIsFile()) return; fullURL.setPassword(password); setFullURL(fullURL); @@ -100,14 +100,14 @@ static unsigned countASCIIDigits(StringView string) void URLDecomposition::setHost(StringView value) { auto fullURL = this->fullURL(); - if (value.isEmpty() && !fullURL.protocolIs("file"_s) && fullURL.hasSpecialScheme()) + if (value.isEmpty() && !fullURL.protocolIsFile() && fullURL.hasSpecialScheme()) return; size_t separator = value.reverseFind(':'); if (!separator) return; - if (fullURL.cannotBeABaseURL() || !fullURL.canSetHostOrPort()) + if (fullURL.hasOpaquePath()) return; // No port if no colon or rightmost colon is within the IPv6 section. @@ -120,13 +120,13 @@ void URLDecomposition::setHost(StringView value) return; unsigned portLength = countASCIIDigits(value.substring(separator + 1)); if (!portLength) { - fullURL.setHost(value.substring(0, separator)); + fullURL.setHost(value.left(separator)); } else { auto portNumber = parseInteger<uint16_t>(value.substring(separator + 1, portLength)); if (portNumber && WTF::isDefaultPortForProtocol(*portNumber, fullURL.protocol())) - fullURL.setHostAndPort(value.substring(0, separator)); + fullURL.setHostAndPort(value.left(separator)); else - fullURL.setHostAndPort(value.substring(0, separator + 1 + portLength)); + fullURL.setHostAndPort(value.left(separator + 1 + portLength)); } } if (fullURL.isValid()) @@ -138,24 +138,12 @@ String URLDecomposition::hostname() const return fullURL().host().toString(); } -static StringView removeAllLeadingSolidusCharacters(StringView string) -{ - unsigned i; - unsigned length = string.length(); - for (i = 0; i < length; ++i) { - if (string[i] != '/') - break; - } - return string.substring(i); -} - -void URLDecomposition::setHostname(StringView value) +void URLDecomposition::setHostname(StringView host) { auto fullURL = this->fullURL(); - auto host = removeAllLeadingSolidusCharacters(value); - if (host.isEmpty() && !fullURL.protocolIs("file"_s) && fullURL.hasSpecialScheme()) + if (host.isEmpty() && !fullURL.protocolIsFile() && fullURL.hasSpecialScheme()) return; - if (fullURL.cannotBeABaseURL() || !fullURL.canSetHostOrPort()) + if (fullURL.hasOpaquePath()) return; fullURL.setHost(host); if (fullURL.isValid()) @@ -200,7 +188,7 @@ static std::optional<std::optional<uint16_t>> parsePort(StringView string, Strin void URLDecomposition::setPort(StringView value) { auto fullURL = this->fullURL(); - if (fullURL.host().isEmpty() || fullURL.cannotBeABaseURL() || fullURL.protocolIs("file"_s) || !fullURL.canSetHostOrPort()) + if (fullURL.host().isEmpty() || fullURL.protocolIsFile()) return; auto port = parsePort(value, fullURL.protocol()); if (!port) @@ -217,7 +205,7 @@ String URLDecomposition::pathname() const void URLDecomposition::setPathname(StringView value) { auto fullURL = this->fullURL(); - if (fullURL.cannotBeABaseURL() || !fullURL.canSetPathname()) + if (fullURL.hasOpaquePath()) return; fullURL.setPath(value); setFullURL(fullURL); @@ -236,7 +224,6 @@ void URLDecomposition::setSearch(const String& value) // If the given value is the empty string, set url's query to null. fullURL.setQuery({}); } else { - String newSearch = value; // Make sure that '#' in the query does not leak to the hash. fullURL.setQuery(makeStringByReplacingAll(value, '#', "%23"_s)); } diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 52f633f3d..759217ed1 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -1312,7 +1312,7 @@ JSC_DEFINE_HOST_FUNCTION(functionBTOA, return JSC::JSValue::encode(JSC::jsEmptyString(vm)); } - if (!encodedString.isAllLatin1()) { + if (!encodedString.containsOnlyLatin1()) { throwException(globalObject, throwScope, createDOMException(globalObject, InvalidCharacterError)); return JSC::JSValue::encode(JSC::JSValue {}); } diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 9fb0c18d5..981a475a3 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -1256,7 +1256,7 @@ void WebCore__DOMURL__pathname_(WebCore__DOMURL* domURL, ZigString* arg1) BunString WebCore__DOMURL__fileSystemPath(WebCore__DOMURL* arg0) { const WTF::URL& url = arg0->href(); - if (url.isLocalFile()) { + if (url.protocolIsFile()) { return Bun::toString(url.fileSystemPath()); } diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index 61ac91ba7..0e5fa18d8 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -358,7 +358,7 @@ static inline bool rebindValue(JSC::JSGlobalObject* lexicalGlobalObject, sqlite3 return false; } - if (roped.is8Bit() && roped.isAllASCII()) { + if (roped.is8Bit() && roped.containsOnlyASCII()) { CHECK_BIND(sqlite3_bind_text(stmt, i, reinterpret_cast<const char*>(roped.characters8()), roped.length(), transientOrStatic)); } else if (!roped.is8Bit()) { CHECK_BIND(sqlite3_bind_text16(stmt, i, roped.characters16(), roped.length() * 2, transientOrStatic)); diff --git a/src/bun.js/bindings/webcore/FetchHeaders.cpp b/src/bun.js/bindings/webcore/FetchHeaders.cpp index 9d8572faf..02a3c8b3a 100644 --- a/src/bun.js/bindings/webcore/FetchHeaders.cpp +++ b/src/bun.js/bindings/webcore/FetchHeaders.cpp @@ -63,7 +63,7 @@ static ExceptionOr<bool> canWriteHeader(const String& name, const String& value, static ExceptionOr<void> appendToHeaderMap(const String& name, const String& value, HTTPHeaderMap& headers, FetchHeaders::Guard guard) { - String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value); + String normalizedValue = value.trim(isHTTPSpace); String combinedValue = normalizedValue; HTTPHeaderName headerName; if (findHTTPHeaderName(name, headerName)) { @@ -107,7 +107,7 @@ static ExceptionOr<void> appendToHeaderMap(const String& name, const String& val static ExceptionOr<void> appendToHeaderMap(const HTTPHeaderMap::HTTPHeaderMapConstIterator::KeyValue& header, HTTPHeaderMap& headers, FetchHeaders::Guard guard) { - String normalizedValue = stripLeadingAndTrailingHTTPSpaces(header.value); + String normalizedValue = header.value.trim(isHTTPSpace); auto canWriteResult = canWriteHeader(header.key, normalizedValue, header.value, guard); if (canWriteResult.hasException()) return canWriteResult.releaseException(); @@ -229,7 +229,7 @@ ExceptionOr<bool> FetchHeaders::has(const String& name) const ExceptionOr<void> FetchHeaders::set(const String& name, const String& value) { - String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value); + String normalizedValue = value.trim(isHTTPSpace); auto canWriteResult = canWriteHeader(name, normalizedValue, normalizedValue, m_guard); if (canWriteResult.hasException()) return canWriteResult.releaseException(); @@ -248,7 +248,7 @@ ExceptionOr<void> FetchHeaders::set(const String& name, const String& value) void FetchHeaders::filterAndFill(const HTTPHeaderMap& headers, Guard guard) { for (auto& header : headers) { - String normalizedValue = stripLeadingAndTrailingHTTPSpaces(header.value); + String normalizedValue = header.value.trim(isHTTPSpace); auto canWriteResult = canWriteHeader(header.key, normalizedValue, header.value, guard); if (canWriteResult.hasException()) continue; diff --git a/src/bun.js/bindings/webcore/HTTPHeaderField.cpp b/src/bun.js/bindings/webcore/HTTPHeaderField.cpp index a4d101bdd..bdcd3e3be 100644 --- a/src/bun.js/bindings/webcore/HTTPHeaderField.cpp +++ b/src/bun.js/bindings/webcore/HTTPHeaderField.cpp @@ -29,7 +29,7 @@ namespace WebCore { namespace RFC7230 { - + bool isTokenCharacter(UChar c) { return isASCIIAlpha(c) || isASCIIDigit(c) @@ -118,7 +118,7 @@ static bool isValidValue(StringView value) State state = State::OptionalWhitespace; size_t commentDepth = 0; bool hadNonWhitespace = false; - + for (size_t i = 0; i < value.length(); ++i) { UChar c = value[i]; switch (state) { @@ -141,7 +141,7 @@ static bool isValidValue(StringView value) continue; } return false; - + case State::Token: if (isTokenCharacter(c)) continue; @@ -187,7 +187,7 @@ static bool isValidValue(StringView value) continue; } } - + switch (state) { case State::OptionalWhitespace: case State::Token: @@ -204,14 +204,14 @@ static bool isValidValue(StringView value) std::optional<HTTPHeaderField> HTTPHeaderField::create(String&& unparsedName, String&& unparsedValue) { - StringView strippedName = StringView(unparsedName).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace); - StringView strippedValue = StringView(unparsedValue).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace); - if (!RFC7230::isValidName(strippedName) || !RFC7230::isValidValue(strippedValue)) + auto trimmedName = StringView(unparsedName).trim(isTabOrSpace<UChar>); + auto trimmedValue = StringView(unparsedValue).trim(isTabOrSpace<UChar>); + if (!RFC7230::isValidName(trimmedName) || !RFC7230::isValidValue(trimmedValue)) return std::nullopt; - String name = strippedName.length() == unparsedName.length() ? WTFMove(unparsedName) : strippedName.toString(); - String value = strippedValue.length() == unparsedValue.length() ? WTFMove(unparsedValue) : strippedValue.toString(); - return {{ WTFMove(name), WTFMove(value) }}; + auto name = trimmedName.length() == unparsedName.length() ? WTFMove(unparsedName) : trimmedName.toString(); + auto value = trimmedValue.length() == unparsedValue.length() ? WTFMove(unparsedValue) : trimmedValue.toString(); + return { { WTFMove(name), WTFMove(value) } }; } } diff --git a/src/bun.js/bindings/webcore/HTTPParsers.cpp b/src/bun.js/bindings/webcore/HTTPParsers.cpp index a696be94c..f2c4ff989 100644 --- a/src/bun.js/bindings/webcore/HTTPParsers.cpp +++ b/src/bun.js/bindings/webcore/HTTPParsers.cpp @@ -62,7 +62,7 @@ static inline bool skipWhile(const String& str, unsigned& pos, const Function<bo // Note: Might return pos == str.length() static inline bool skipWhiteSpace(const String& str, unsigned& pos) { - skipWhile(str, pos, RFC7230::isWhitespace); + skipWhile(str, pos, isTabOrSpace<UChar>); return pos < str.length(); } @@ -100,7 +100,7 @@ static inline bool skipValue(const String& str, unsigned& pos) unsigned start = pos; unsigned len = str.length(); while (pos < len) { - if (str[pos] == ' ' || str[pos] == '\t' || str[pos] == ';') + if (isTabOrSpace(str[pos]) || str[pos] == ';') break; ++pos; } @@ -122,20 +122,28 @@ bool isValidReasonPhrase(const String& value) bool isValidHTTPHeaderValue(const String& value) { UChar c = value[0]; - if (c == ' ' || c == '\t') + if (isTabOrSpace(c)) return false; c = value[value.length() - 1]; - if (c == ' ' || c == '\t') + if (isTabOrSpace(c)) return false; - for (unsigned i = 0; i < value.length(); ++i) { - c = value[i]; - if (c == 0x00 || c == 0x0A || c == 0x0D) - return false; - - //NOTE: The spec doesn't require ASCII or Latin1 but common - // implementations, including Node, disallow codepoints > 255 - if (c > 255) return false; + if (value.is8Bit()) { + const LChar* end = value.characters8() + value.length(); + for (const LChar* p = value.characters8(); p != end; ++p) { + if (UNLIKELY(*p <= 13)) { + LChar c = *p; + if (c == 0x00 || c == 0x0A || c == 0x0D) + return false; + } + } + } else { + for (unsigned i = 0; i < value.length(); ++i) { + c = value[i]; + if (c == 0x00 || c == 0x0A || c == 0x0D || c > 0x7F) + return false; + } } + return true; } @@ -342,12 +350,12 @@ StringView filenameFromHTTPContentDisposition(StringView value) if (valueStartPos == notFound) continue; - auto key = keyValuePair.left(valueStartPos).stripWhiteSpace(); + auto key = keyValuePair.left(valueStartPos).trim(isUnicodeCompatibleASCIIWhitespace<UChar>); if (key.isEmpty() || key != "filename"_s) continue; - auto value = keyValuePair.substring(valueStartPos + 1).stripWhiteSpace(); + auto value = keyValuePair.substring(valueStartPos + 1).trim(isUnicodeCompatibleASCIIWhitespace<UChar>); // Remove quotes if there are any if (value.length() > 1 && value[0] == '\"') @@ -366,7 +374,7 @@ String extractMIMETypeFromMediaType(const String& mediaType) for (; position < length; ++position) { UChar c = mediaType[position]; - if (c != '\t' && c != ' ') + if (!isTabOrSpace(c)) break; } @@ -388,7 +396,7 @@ String extractMIMETypeFromMediaType(const String& mediaType) if (c == ',') break; - if (c == '\t' || c == ' ' || c == ';') + if (isTabOrSpace(c) || c == ';') break; typeEnd = position + 1; @@ -535,7 +543,7 @@ XSSProtectionDisposition parseXSSProtectionHeader(const String& header, String& ContentTypeOptionsDisposition parseContentTypeOptionsHeader(StringView header) { StringView leftToken = header.left(header.find(',')); - if (equalLettersIgnoringASCIICase(stripLeadingAndTrailingHTTPSpaces(leftToken), "nosniff"_s)) + if (equalLettersIgnoringASCIICase(leftToken.trim(isJSONOrHTTPWhitespace<UChar>), "nosniff"_s)) return ContentTypeOptionsDisposition::Nosniff; return ContentTypeOptionsDisposition::None; } @@ -562,8 +570,8 @@ XFrameOptionsDisposition parseXFrameOptionsHeader(StringView header) if (header.isEmpty()) return result; - for (auto currentHeader : header.split(',')) { - currentHeader = currentHeader.stripWhiteSpace(); + for (auto currentHeader : header.splitAllowingEmptyEntries(',')) { + currentHeader = currentHeader.trim(isUnicodeCompatibleASCIIWhitespace<UChar>); XFrameOptionsDisposition currentValue = XFrameOptionsDisposition::None; if (equalLettersIgnoringASCIICase(currentHeader, "deny"_s)) currentValue = XFrameOptionsDisposition::Deny; @@ -582,108 +590,54 @@ XFrameOptionsDisposition parseXFrameOptionsHeader(StringView header) return result; } -// https://fetch.spec.whatwg.org/#concept-header-list-get-structured-header -// FIXME: For now, this assumes the type is "item". -std::optional<std::pair<StringView, HashMap<String, String>>> parseStructuredFieldValue(StringView header) -{ - header = stripLeadingAndTrailingHTTPSpaces(header); - if (header.isEmpty()) - return std::nullopt; - - // Parse a token (https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.6). - if (!isASCIIAlpha(header[0]) && header[0] != '*') - return std::nullopt; - size_t index = 1; - while (index < header.length()) { - UChar c = header[index]; - if (!RFC7230::isTokenCharacter(c) && c != ':' && c != '/') - break; - ++index; - } - StringView bareItem = header.left(index); - - // Parse parameters (https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.3.2). - HashMap<String, String> parameters; - while (index < header.length()) { - if (header[index] != ';') - break; - ++index; // Consume ';'. - while (index < header.length() && header[index] == ' ') - ++index; - if (index == header.length()) - return std::nullopt; - // Parse a key (https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.3.3) - if (!isASCIILower(header[index])) - return std::nullopt; - size_t keyStart = index++; - while (index < header.length()) { - UChar c = header[index]; - if (!isASCIILower(c) && !isASCIIDigit(c) && c != '_' && c != '-' && c != '.' && c != '*') - break; - ++index; - } - StringView key = header.substring(keyStart, index - keyStart); - String value = trueAtom(); - if (index < header.length() && header[index] == '=') { - ++index; // Consume '='. - if (isASCIIAlpha(header[index]) || header[index] == '*') { - // https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.6 - size_t valueStart = index++; - while (index < header.length()) { - UChar c = header[index]; - if (!RFC7230::isTokenCharacter(c) && c != ':' && c != '/') - break; - ++index; - } - value = header.substring(valueStart, index - valueStart).toString(); - } else if (header[index] == '"') { - // https://datatracker.ietf.org/doc/html/rfc8941#section-4.2.5 - StringBuilder valueBuilder; - ++index; // Skip DQUOTE. - while (index < header.length()) { - if (header[index] == '\\') { - ++index; - if (index == header.length()) - return std::nullopt; - if (header[index] != '\\' && header[index] != '"') - return std::nullopt; - valueBuilder.append(header[index]); - } else if (header[index] == '\"') { - value = valueBuilder.toString(); - break; - } else if (header[index] <= 0x1F || (header[index] >= 0x7F && header[index] <= 0xFF)) // Not in VCHAR or SP. - return std::nullopt; - else - valueBuilder.append(header[index]); - ++index; - } - if (index == header.length()) - return std::nullopt; - ++index; // Skip DQUOTE. - } else - return std::nullopt; - } - parameters.set(key.toString(), WTFMove(value)); - } - if (index != header.length()) - return std::nullopt; - return std::make_pair(bareItem, parameters); -} +// OptionSet<ClearSiteDataValue> parseClearSiteDataHeader(const ResourceResponse& response) +// { +// OptionSet<ClearSiteDataValue> result; + +// auto headerValue = response.httpHeaderField(HTTPHeaderName::ClearSiteData); +// if (headerValue.isEmpty()) +// return result; + +// if (!WebCore::shouldTreatAsPotentiallyTrustworthy(response.url())) +// return result; + +// for (auto value : StringView(headerValue).split(',')) { +// auto trimmedValue = value.trim(isJSONOrHTTPWhitespace<UChar>); +// if (trimmedValue == "\"cache\""_s) +// result.add(ClearSiteDataValue::Cache); +// else if (trimmedValue == "\"cookies\""_s) +// result.add(ClearSiteDataValue::Cookies); +// else if (trimmedValue == "\"executionContexts\""_s) +// result.add(ClearSiteDataValue::ExecutionContexts); +// else if (trimmedValue == "\"storage\""_s) +// result.add(ClearSiteDataValue::Storage); +// else if (trimmedValue == "\"*\""_s) +// result.add({ ClearSiteDataValue::Cache, ClearSiteDataValue::Cookies, ClearSiteDataValue::ExecutionContexts, ClearSiteDataValue::Storage }); +// } +// return result; +// } + +// Implements <https://fetch.spec.whatwg.org/#simple-range-header-value>. +// FIXME: this whole function could be more efficient by walking through the range value once. +bool parseRange(StringView range, RangeAllowWhitespace allowWhitespace, long long& rangeStart, long long& rangeEnd) +{ + rangeStart = rangeEnd = -1; + + // Only 0x20 and 0x09 matter as newlines are already gone by the time we parse a header value. + if (allowWhitespace == RangeAllowWhitespace::No && range.find(isTabOrSpace<UChar>) != notFound) + return false; -bool parseRange(StringView range, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength) -{ - // The format of "Range" header is defined in RFC 2616 Section 14.35.1. - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 - // We don't support multiple range requests. + // The "bytes" unit identifier should be present. + static const unsigned bytesLength = 5; + if (!startsWithLettersIgnoringASCIICase(range, "bytes"_s)) + return false; - rangeOffset = rangeEnd = rangeSuffixLength = -1; + auto byteRange = range.substring(bytesLength).trim(isJSONOrHTTPWhitespace<UChar>); - // The "bytes" unit identifier should be present. - static const unsigned bytesLength = 6; - if (!startsWithLettersIgnoringASCIICase(range, "bytes="_s)) + if (!byteRange.startsWith('=')) return false; - StringView byteRange = range.substring(bytesLength); + byteRange = byteRange.substring(1); // The '-' character needs to be present. int index = byteRange.find('-'); @@ -694,8 +648,10 @@ bool parseRange(StringView range, long long& rangeOffset, long long& rangeEnd, l // Example: // -500 if (!index) { - if (auto value = parseInteger<long long>(byteRange.substring(index + 1))) - rangeSuffixLength = *value; + auto value = parseInteger<long long>(byteRange.substring(index + 1)); + if (!value) + return false; + rangeEnd = *value; return true; } @@ -707,7 +663,7 @@ bool parseRange(StringView range, long long& rangeOffset, long long& rangeEnd, l if (!firstBytePos) return false; - auto lastBytePosStr = stripLeadingAndTrailingHTTPSpaces(byteRange.substring(index + 1)); + auto lastBytePosStr = byteRange.substring(index + 1); long long lastBytePos = -1; if (!lastBytePosStr.isEmpty()) { auto value = parseInteger<long long>(lastBytePosStr); @@ -719,7 +675,7 @@ bool parseRange(StringView range, long long& rangeOffset, long long& rangeEnd, l if (*firstBytePos < 0 || !(lastBytePos == -1 || lastBytePos >= *firstBytePos)) return false; - rangeOffset = *firstBytePos; + rangeStart = *firstBytePos; rangeEnd = lastBytePos; return true; } @@ -854,35 +810,11 @@ size_t parseHTTPRequestBody(const uint8_t* data, size_t length, Vector<uint8_t>& bool isForbiddenHeaderName(const String& name) { return false; - // HTTPHeaderName headerName; - // if (findHTTPHeaderName(name, headerName)) { - // switch (headerName) { - // case HTTPHeaderName::AcceptCharset: - // case HTTPHeaderName::AcceptEncoding: - // case HTTPHeaderName::AccessControlRequestHeaders: - // case HTTPHeaderName::AccessControlRequestMethod: - // case HTTPHeaderName::Connection: - // case HTTPHeaderName::ContentLength: - // case HTTPHeaderName::Cookie: - // case HTTPHeaderName::Cookie2: - // case HTTPHeaderName::Date: - // case HTTPHeaderName::DNT: - // case HTTPHeaderName::Expect: - // case HTTPHeaderName::Host: - // case HTTPHeaderName::KeepAlive: - // case HTTPHeaderName::Origin: - // case HTTPHeaderName::Referer: - // case HTTPHeaderName::TE: - // case HTTPHeaderName::Trailer: - // case HTTPHeaderName::TransferEncoding: - // case HTTPHeaderName::Upgrade: - // case HTTPHeaderName::Via: - // return true; - // default: - // break; - // } - // } - // return startsWithLettersIgnoringASCIICase(name, "sec-"_s) || startsWithLettersIgnoringASCIICase(name, "proxy-"_s); +} + +bool isForbiddenHeader(const String& name, StringView value) +{ + return false; } // Implements <https://fetch.spec.whatwg.org/#no-cors-safelisted-request-header-name>. @@ -906,99 +838,65 @@ bool isNoCORSSafelistedRequestHeaderName(const String& name) // Implements <https://fetch.spec.whatwg.org/#privileged-no-cors-request-header-name>. bool isPriviledgedNoCORSRequestHeaderName(const String& name) { - return equalLettersIgnoringASCIICase(name, "range"_s); + return false; + // return equalLettersIgnoringASCIICase(name, "range"_s); } // Implements <https://fetch.spec.whatwg.org/#forbidden-response-header-name>. bool isForbiddenResponseHeaderName(const String& name) { - return equalLettersIgnoringASCIICase(name, "set-cookie"_s) || equalLettersIgnoringASCIICase(name, "set-cookie2"_s); + return false; + // return equalLettersIgnoringASCIICase(name, "set-cookie"_s) || equalLettersIgnoringASCIICase(name, "set-cookie2"_s); } // Implements <https://fetch.spec.whatwg.org/#forbidden-method>. -bool isForbiddenMethod(const String& name) +bool isForbiddenMethod(StringView name) { - return equalLettersIgnoringASCIICase(name, "connect"_s) || equalLettersIgnoringASCIICase(name, "trace"_s) || equalLettersIgnoringASCIICase(name, "track"_s); + // return equalLettersIgnoringASCIICase(name, "connect"_s) || equalLettersIgnoringASCIICase(name, "trace"_s) || equalLettersIgnoringASCIICase(name, "track"_s); + return false; } bool isSimpleHeader(const String& name, const String& value) { HTTPHeaderName headerName; - if (!findHTTPHeaderName(name, headerName)) - return false; - return isCrossOriginSafeRequestHeader(headerName, value); -} - -bool isCrossOriginSafeHeader(HTTPHeaderName name, const HTTPHeaderSet& accessControlExposeHeaderSet) -{ - switch (name) { - case HTTPHeaderName::CacheControl: - case HTTPHeaderName::ContentLanguage: - case HTTPHeaderName::ContentLength: - case HTTPHeaderName::ContentType: - case HTTPHeaderName::Expires: - case HTTPHeaderName::LastModified: - case HTTPHeaderName::Pragma: - case HTTPHeaderName::Accept: - return true; - case HTTPHeaderName::SetCookie: - case HTTPHeaderName::SetCookie2: - return false; - default: - break; - } - return accessControlExposeHeaderSet.contains<ASCIICaseInsensitiveStringViewHashTranslator>(httpHeaderNameString(name)); -} - -bool isCrossOriginSafeHeader(const String& name, const HTTPHeaderSet& accessControlExposeHeaderSet) -{ -#if ASSERT_ENABLED - HTTPHeaderName headerName; - ASSERT(!findHTTPHeaderName(name, headerName)); -#endif - return accessControlExposeHeaderSet.contains(name); -} - -static bool isSimpleRangeHeaderValue(const String& value) -{ - if (!value.startsWith("bytes="_s)) - return false; - - unsigned start = 0; - unsigned end = 0; - bool hasHyphen = false; - - for (size_t cptr = 6; cptr < value.length(); ++cptr) { - auto character = value[cptr]; - if (character >= '0' && character <= '9') { - if (productOverflows<unsigned>(hasHyphen ? end : start, 10)) - return false; - auto newDecimal = (hasHyphen ? end : start) * 10; - auto sum = Checked<unsigned, RecordOverflow>(newDecimal) + Checked<unsigned, RecordOverflow>(character - '0'); - if (sum.hasOverflowed()) - return false; - - if (hasHyphen) - end = sum.value(); - else - start = sum.value(); - continue; - } - if (character == '-' && !hasHyphen) { - hasHyphen = true; - continue; - } - return false; - } - - return hasHyphen && (!end || start < end); -} + return !findHTTPHeaderName(name, headerName); +} + +// bool isCrossOriginSafeHeader(HTTPHeaderName name, const HTTPHeaderSet& accessControlExposeHeaderSet) +// { +// // switch (name) { +// // case HTTPHeaderName::CacheControl: +// // case HTTPHeaderName::ContentLanguage: +// // case HTTPHeaderName::ContentLength: +// // case HTTPHeaderName::ContentType: +// // case HTTPHeaderName::Expires: +// // case HTTPHeaderName::LastModified: +// // case HTTPHeaderName::Pragma: +// // case HTTPHeaderName::Accept: +// // return true; +// // case HTTPHeaderName::SetCookie: +// // case HTTPHeaderName::SetCookie2: +// // return false; +// // default: +// // break; +// // } +// // return accessControlExposeHeaderSet.contains<HashTranslatorASCIILiteralCaseInsensitive>(httpHeaderNameString(name)); +// } + +// bool isCrossOriginSafeHeader(const String& name, const HTTPHeaderSet& accessControlExposeHeaderSet) +// { +// #if ASSERT_ENABLED +// HTTPHeaderName headerName; +// ASSERT(!findHTTPHeaderName(name, headerName)); +// #endif +// return accessControlExposeHeaderSet.contains(name); +// } // Implements https://fetch.spec.whatwg.org/#cors-safelisted-request-header bool isCrossOriginSafeRequestHeader(HTTPHeaderName name, const String& value) { - if (value.length() > 128) - return false; + // if (value.length() > 128) + // return false; // switch (name) { // case HTTPHeaderName::Accept: @@ -1023,11 +921,14 @@ bool isCrossOriginSafeRequestHeader(HTTPHeaderName name, const String& value) // break; // } // case HTTPHeaderName::Range: - // if (!isSimpleRangeHeaderValue(value)) + // long long start; + // long long end; + // if (!parseRange(value, RangeAllowWhitespace::No, start, end)) + // return false; + // if (start == -1) // return false; // break; // default: - // // FIXME: Should we also make safe other headers (DPR, Downlink, Save-Data...)? That would require validating their values. // return false; // } return true; @@ -1036,43 +937,43 @@ bool isCrossOriginSafeRequestHeader(HTTPHeaderName name, const String& value) // Implements <https://fetch.spec.whatwg.org/#concept-method-normalize>. String normalizeHTTPMethod(const String& method) { - const ASCIILiteral methods[] = { "DELETE"_s, "GET"_s, "HEAD"_s, "OPTIONS"_s, "POST"_s, "PUT"_s }; - for (auto value : methods) { - if (equalIgnoringASCIICase(method, value)) { - // Don't bother allocating a new string if it's already all uppercase. - if (method == value) - break; - return value; - } - } + // static constexpr ASCIILiteral methods[] = { "DELETE"_s, "GET"_s, "HEAD"_s, "OPTIONS"_s, "POST"_s, "PUT"_s }; + // for (auto value : methods) { + // if (equalIgnoringASCIICase(method, value)) { + // // Don't bother allocating a new string if it's already all uppercase. + // if (method == value) + // break; + // return value; + // } + // } return method; } // Defined by https://tools.ietf.org/html/rfc7231#section-4.2.1 bool isSafeMethod(const String& method) { - const ASCIILiteral safeMethods[] = { "GET"_s, "HEAD"_s, "OPTIONS"_s, "TRACE"_s }; - for (auto value : safeMethods) { - if (equalIgnoringASCIICase(method, value)) - return true; - } - return false; + // const ASCIILiteral safeMethods[] = { "GET"_s, "HEAD"_s, "OPTIONS"_s, "TRACE"_s }; + // for (auto value : safeMethods) { + // if (equalIgnoringASCIICase(method, value)) + // return true; + // } + return true; } CrossOriginResourcePolicy parseCrossOriginResourcePolicyHeader(StringView header) { - auto strippedHeader = stripLeadingAndTrailingHTTPSpaces(header); + auto trimmedHeader = header.trim(isJSONOrHTTPWhitespace<UChar>); - if (strippedHeader.isEmpty()) + if (trimmedHeader.isEmpty()) return CrossOriginResourcePolicy::None; - if (strippedHeader == "same-origin"_s) + if (trimmedHeader == "same-origin"_s) return CrossOriginResourcePolicy::SameOrigin; - if (strippedHeader == "same-site"_s) + if (trimmedHeader == "same-site"_s) return CrossOriginResourcePolicy::SameSite; - if (strippedHeader == "cross-origin"_s) + if (trimmedHeader == "cross-origin"_s) return CrossOriginResourcePolicy::CrossOrigin; return CrossOriginResourcePolicy::Invalid; diff --git a/src/bun.js/bindings/webcore/HTTPParsers.h b/src/bun.js/bindings/webcore/HTTPParsers.h index 0bc922a04..bf56caccb 100644 --- a/src/bun.js/bindings/webcore/HTTPParsers.h +++ b/src/bun.js/bindings/webcore/HTTPParsers.h @@ -30,6 +30,7 @@ #pragma once +#include <wtf/text/StringImpl.h> #include <wtf/HashSet.h> #include <wtf/WallTime.h> #include <wtf/text/StringHash.h> @@ -69,6 +70,9 @@ enum class CrossOriginResourcePolicy : uint8_t { Invalid }; +enum class RangeAllowWhitespace : bool { No, + Yes }; + bool isValidReasonPhrase(const String&); bool isValidHTTPHeaderValue(const String&); bool isValidAcceptHeaderValue(const String&); @@ -103,8 +107,8 @@ bool isPriviledgedNoCORSRequestHeaderName(const String&); bool isForbiddenResponseHeaderName(const String&); bool isForbiddenMethod(const String&); bool isSimpleHeader(const String& name, const String& value); -bool isCrossOriginSafeHeader(HTTPHeaderName, const HTTPHeaderSet&); -bool isCrossOriginSafeHeader(const String&, const HTTPHeaderSet&); +// bool isCrossOriginSafeHeader(HTTPHeaderName, const HTTPHeaderSet&); +// bool isCrossOriginSafeHeader(const String&, const HTTPHeaderSet&); bool isCrossOriginSafeRequestHeader(HTTPHeaderName, const String&); String normalizeHTTPMethod(const String&); @@ -112,67 +116,59 @@ bool isSafeMethod(const String&); WEBCORE_EXPORT CrossOriginResourcePolicy parseCrossOriginResourcePolicyHeader(StringView); +// -1 could be set to one of the return parameters to indicate the value is not specified. +WEBCORE_EXPORT bool parseRange(StringView, RangeAllowWhitespace, long long& rangeStart, long long& rangeEnd); + inline bool isHTTPSpace(UChar character) { return character <= ' ' && (character == ' ' || character == '\n' || character == '\t' || character == '\r'); } -// Strip leading and trailing whitespace as defined in https://fetch.spec.whatwg.org/#concept-header-value-normalize. -inline String stripLeadingAndTrailingHTTPSpaces(const String& string) -{ - return string.stripLeadingAndTrailingCharacters(isHTTPSpace); -} - -inline StringView stripLeadingAndTrailingHTTPSpaces(StringView string) -{ - return string.stripLeadingAndTrailingMatchedCharacters(isHTTPSpace); -} - -template<class HashType> -bool addToAccessControlAllowList(const String& string, unsigned start, unsigned end, HashSet<String, HashType>& set) -{ - StringImpl* stringImpl = string.impl(); - if (!stringImpl) - return true; - - // Skip white space from start. - while (start <= end && isHTTPSpace((*stringImpl)[start])) - ++start; - - // only white space - if (start > end) - return true; - - // Skip white space from end. - while (end && isHTTPSpace((*stringImpl)[end])) - --end; - - auto token = string.substring(start, end - start + 1); - if (!isValidHTTPToken(token)) - return false; - - set.add(WTFMove(token)); - return true; -} - -template<class HashType = DefaultHash<String>> -std::optional<HashSet<String, HashType>> parseAccessControlAllowList(const String& string) -{ - HashSet<String, HashType> set; - unsigned start = 0; - size_t end; - while ((end = string.find(',', start)) != notFound) { - if (start != end) { - if (!addToAccessControlAllowList(string, start, end - 1, set)) - return {}; - } - start = end + 1; - } - if (start != string.length()) { - if (!addToAccessControlAllowList(string, start, string.length() - 1, set)) - return {}; - } - return set; -} +// template<class HashType> +// bool addToAccessControlAllowList(const String& string, unsigned start, unsigned end, HashSet<String, HashType>& set) +// { +// StringImpl* stringImpl = string.impl(); +// if (!stringImpl) +// return true; + +// // Skip white space from start. +// while (start <= end && isJSONOrHTTPWhitespace((*stringImpl)[start])) +// ++start; + +// // only white space +// if (start > end) +// return true; + +// // Skip white space from end. +// while (end && isJSONOrHTTPWhitespace((*stringImpl)[end])) +// --end; + +// auto token = string.substring(start, end - start + 1); +// if (!isValidHTTPToken(token)) +// return false; + +// set.add(WTFMove(token)); +// return true; +// } + +// template<class HashType = DefaultHash<String>> +// std::optional<HashSet<String, HashType>> parseAccessControlAllowList(const String& string) +// { +// HashSet<String, HashType> set; +// unsigned start = 0; +// size_t end; +// while ((end = string.find(',', start)) != notFound) { +// if (start != end) { +// if (!addToAccessControlAllowList(string, start, end - 1, set)) +// return {}; +// } +// start = end + 1; +// } +// if (start != string.length()) { +// if (!addToAccessControlAllowList(string, start, string.length() - 1, set)) +// return {}; +// } +// return set; +// } } diff --git a/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp b/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp index 00f385e07..d5ae21304 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp +++ b/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp @@ -44,7 +44,7 @@ String identifierToString(JSGlobalObject& lexicalGlobalObject, const Identifier& static inline bool throwIfInvalidByteString(JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, const String& string) { - if (UNLIKELY(!string.isAllLatin1())) { + if (UNLIKELY(!string.containsOnlyLatin1())) { throwTypeError(&lexicalGlobalObject, scope); return true; } diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.cpp b/src/bun.js/bindings/webcore/JSTextEncoder.cpp index 5d764619b..3029028fe 100644 --- a/src/bun.js/bindings/webcore/JSTextEncoder.cpp +++ b/src/bun.js/bindings/webcore/JSTextEncoder.cpp @@ -216,9 +216,9 @@ template<> void JSTextEncoderDOMConstructor::initializeProperties(VM& vm, JSDOMG constexpr JSC::DFG::AbstractHeapKind heapKinds[4] = { JSC::DFG::HeapObjectCount }; -// This is the equivalent of DataView.set -constexpr JSC::DFG::AbstractHeapKind encodeIntoRead[4] = { JSC::DFG::MiscFields, JSC::DFG::TypedArrayProperties, JSC::DFG::Absolute }; -constexpr JSC::DFG::AbstractHeapKind encodeIntoWrite[4] = { JSC::DFG::TypedArrayProperties, JSC::DFG::Absolute }; +// TODO: figure out why the test fails after JSC upgrade and re-enable this! +// constexpr JSC::DFG::AbstractHeapKind encodeIntoRead[4] = { JSC::DFG::Heap, JSC::DFG::MiscFields, JSC::DFG::TypedArrayProperties, JSC::DFG::Absolute }; +// constexpr JSC::DFG::AbstractHeapKind encodeIntoWrite[4] = { JSC::DFG::SideState, JSC::DFG::Absolute, JSC::DFG::JSCell_structureID, JSC::DFG::HeapObjectCount }; static const JSC::DOMJIT::Signature DOMJITSignatureForJSTextEncoderEncodeWithoutTypeCheck( jsTextEncoderEncodeWithoutTypeCheck, @@ -230,10 +230,9 @@ static const JSC::DOMJIT::Signature DOMJITSignatureForJSTextEncoderEncodeWithout static const JSC::DOMJIT::Signature DOMJITSignatureForJSTextEncoderEncodeIntoWithoutTypeCheck( jsTextEncoderPrototypeFunction_encodeIntoWithoutTypeCheck, JSTextEncoder::info(), - // this is slightly incorrect - // there could be cases where the object returned by encodeInto will appear to be reused - // it impacts HeapObjectCount - JSC::DOMJIT::Effect::forReadWriteKinds(encodeIntoRead, encodeIntoWrite), + + JSC::DOMJIT::Effect {}, + // JSC::DOMJIT::Effect::forReadWriteKinds(encodeIntoRead, encodeIntoWrite), DOMJIT::IDLResultTypeFilter<IDLObject>::value, DOMJIT::IDLArgumentTypeFilter<IDLDOMString>::value, DOMJIT::IDLArgumentTypeFilter<IDLUint8Array>::value); diff --git a/src/bun.js/bindings/webcore/ParsedContentType.cpp b/src/bun.js/bindings/webcore/ParsedContentType.cpp index 04b30cf9b..c4773b3ee 100644 --- a/src/bun.js/bindings/webcore/ParsedContentType.cpp +++ b/src/bun.js/bindings/webcore/ParsedContentType.cpp @@ -40,7 +40,7 @@ namespace WebCore { static void skipSpaces(StringView input, unsigned& startIndex) { - while (startIndex < input.length() && isHTTPSpace(input[startIndex])) + while (startIndex < input.length() && isJSONOrHTTPWhitespace(input[startIndex])) ++startIndex; } @@ -78,7 +78,7 @@ static StringView parseToken(StringView input, unsigned& startIndex, CharacterMe while (input[tokenEnd - 1] == ' ') --tokenEnd; } else { - while (isHTTPSpace(input[tokenEnd - 1])) + while (isJSONOrHTTPWhitespace(input[tokenEnd - 1])) --tokenEnd; } } @@ -328,7 +328,7 @@ bool ParsedContentType::parseContentType(Mode mode) std::optional<ParsedContentType> ParsedContentType::create(const String& contentType, Mode mode) { - ParsedContentType parsedContentType(mode == Mode::Rfc2045 ? contentType : stripLeadingAndTrailingHTTPSpaces(contentType)); + ParsedContentType parsedContentType(mode == Mode::Rfc2045 ? contentType : contentType.trim(isJSONOrHTTPWhitespace<UChar>)); if (!parsedContentType.parseContentType(mode)) return std::nullopt; return { WTFMove(parsedContentType) }; @@ -368,9 +368,9 @@ void ParsedContentType::setContentType(String&& contentRange, Mode mode) { m_mimeType = WTFMove(contentRange); if (mode == Mode::MimeSniff) - m_mimeType = stripLeadingAndTrailingHTTPSpaces(StringView(m_mimeType)).convertToASCIILowercase(); + m_mimeType = StringView(m_mimeType).trim(isJSONOrHTTPWhitespace<UChar>).convertToASCIILowercase(); else - m_mimeType = m_mimeType.stripWhiteSpace(); + m_mimeType = m_mimeType.trim(deprecatedIsSpaceOrNewline); } static bool containsNonQuoteStringTokenCharacters(const String& input) diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.cpp b/src/bun.js/bindings/webcore/ReadableStreamSink.cpp index ff2f1ebe3..d79e7d358 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/ReadableStreamSink.cpp @@ -48,7 +48,7 @@ void ReadableStreamToSharedBufferSink::enqueue(const BufferSource& buffer) return; if (m_callback) { - Span<const uint8_t> chunk { buffer.data(), buffer.length() }; + std::span<const uint8_t> chunk { buffer.data(), buffer.length() }; m_callback(&chunk); } } diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.h b/src/bun.js/bindings/webcore/ReadableStreamSink.h index fee988422..7db31e38a 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamSink.h +++ b/src/bun.js/bindings/webcore/ReadableStreamSink.h @@ -23,13 +23,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - #pragma once #include "ExceptionOr.h" #include <wtf/Function.h> #include <wtf/RefCounted.h> -#include <wtf/Span.h> +#include <span> namespace WebCore { @@ -47,10 +46,10 @@ public: class ReadableStreamToSharedBufferSink final : public ReadableStreamSink { public: - using Callback = Function<void(ExceptionOr<Span<const uint8_t>*>&&)>; + using Callback = Function<void(ExceptionOr<std::span<const uint8_t>*>&&)>; static Ref<ReadableStreamToSharedBufferSink> create(Callback&& callback) { return adoptRef(*new ReadableStreamToSharedBufferSink(WTFMove(callback))); } void pipeFrom(ReadableStream&); - void clearCallback() { m_callback = { }; } + void clearCallback() { m_callback = {}; } private: explicit ReadableStreamToSharedBufferSink(Callback&&); diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp index 176e805b8..e80bc9493 100644 --- a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp +++ b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp @@ -2528,7 +2528,7 @@ public: Vector<std::unique_ptr<DetachedRTCDataChannel>>&& detachedRTCDataChannels #endif , - ArrayBufferContentsArray* arrayBufferContentsArray, const Span<uint8_t>& buffer, const Vector<String>& blobURLs, const Vector<String> blobFilePaths, ArrayBufferContentsArray* sharedBuffers + ArrayBufferContentsArray* arrayBufferContentsArray, const std::span<uint8_t>& buffer, const Vector<String>& blobURLs, const Vector<String> blobFilePaths, ArrayBufferContentsArray* sharedBuffers #if ENABLE(WEBASSEMBLY) , WasmModuleArray* wasmModules, WasmMemoryHandleArray* wasmMemoryHandles @@ -2541,7 +2541,7 @@ public: { if (!buffer.size()) return std::make_pair(jsNull(), SerializationReturnCode::UnspecifiedError); - CloneDeserializer deserializer(lexicalGlobalObject, globalObject, arrayBufferContentsArray, Span<uint8_t> { buffer.begin(), buffer.end() }, blobURLs, blobFilePaths, sharedBuffers + CloneDeserializer deserializer(lexicalGlobalObject, globalObject, arrayBufferContentsArray, std::span<uint8_t> { buffer.begin(), buffer.end() }, blobURLs, blobFilePaths, sharedBuffers #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , WTFMove(detachedOffscreenCanvases) @@ -2675,7 +2675,7 @@ private: // m_version = 0xFFFFFFFF; // } - CloneDeserializer(JSGlobalObject* lexicalGlobalObject, JSGlobalObject* globalObject, ArrayBufferContentsArray* arrayBufferContents, const Span<uint8_t>& buffer + CloneDeserializer(JSGlobalObject* lexicalGlobalObject, JSGlobalObject* globalObject, ArrayBufferContentsArray* arrayBufferContents, const std::span<uint8_t>& buffer #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , Vector<std::unique_ptr<DetachedOffscreenCanvas>>&& detachedOffscreenCanvases = {} @@ -2781,7 +2781,7 @@ private: // m_version = 0xFFFFFFFF; // } - CloneDeserializer(JSGlobalObject* lexicalGlobalObject, JSGlobalObject* globalObject, ArrayBufferContentsArray* arrayBufferContents, const Span<uint8_t>& buffer, const Vector<String>& blobURLs, const Vector<String> blobFilePaths, ArrayBufferContentsArray* sharedBuffers + CloneDeserializer(JSGlobalObject* lexicalGlobalObject, JSGlobalObject* globalObject, ArrayBufferContentsArray* arrayBufferContents, const std::span<uint8_t>& buffer, const Vector<String>& blobURLs, const Vector<String> blobFilePaths, ArrayBufferContentsArray* sharedBuffers #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , Vector<std::unique_ptr<DetachedOffscreenCanvas>>&& detachedOffscreenCanvases @@ -5406,7 +5406,7 @@ JSC::JSValue SerializedScriptValue::fromArrayBuffer(JSC::JSGlobalObject& domGlob auto* data = static_cast<uint8_t*>(arrayBuffer->data()) + byteOffset; auto size = std::min(arrayBuffer->byteLength(), maxByteLength); - auto span = Span<uint8_t> { data, size }; + auto span = std::span<uint8_t> { data, size }; auto result = CloneDeserializer::deserialize(&domGlobal, globalObject, nullptr, span, blobURLs, blobFiles, nullptr #if ENABLE(WEBASSEMBLY) diff --git a/src/bun.js/bindings/webcore/SharedBuffer.cpp b/src/bun.js/bindings/webcore/SharedBuffer.cpp index 6ade267de..32b19626b 100644 --- a/src/bun.js/bindings/webcore/SharedBuffer.cpp +++ b/src/bun.js/bindings/webcore/SharedBuffer.cpp @@ -261,14 +261,14 @@ Ref<FragmentedSharedBuffer> FragmentedSharedBuffer::copy() const return clone; } -void FragmentedSharedBuffer::forEachSegment(const Function<void(const Span<const uint8_t>&)>& apply) const +void FragmentedSharedBuffer::forEachSegment(const Function<void(const std::span<const uint8_t>&)>& apply) const { auto segments = m_segments; for (auto& segment : segments) segment.segment->iterate(apply); } -void DataSegment::iterate(const Function<void(const Span<const uint8_t>&)>& apply) const +void DataSegment::iterate(const Function<void(const std::span<const uint8_t>&)>& apply) const { #if USE(FOUNDATION) if (auto* data = std::get_if<RetainPtr<CFDataRef>>(&m_immutableData)) @@ -284,7 +284,7 @@ void FragmentedSharedBuffer::forEachSegmentAsSharedBuffer(const Function<void(Re apply(SharedBuffer::create(segment.segment.copyRef())); } -bool FragmentedSharedBuffer::startsWith(const Span<const uint8_t>& prefix) const +bool FragmentedSharedBuffer::startsWith(const std::span<const uint8_t>& prefix) const { if (prefix.empty()) return true; diff --git a/src/bun.js/bindings/webcore/SharedBuffer.h b/src/bun.js/bindings/webcore/SharedBuffer.h index 5c2e70486..9cffa0bad 100644 --- a/src/bun.js/bindings/webcore/SharedBuffer.h +++ b/src/bun.js/bindings/webcore/SharedBuffer.h @@ -32,7 +32,7 @@ #include <wtf/FileSystem.h> #include <wtf/Forward.h> #include <wtf/Function.h> -#include <wtf/Span.h> +#include <span> #include <wtf/ThreadSafeRefCounted.h> #include <wtf/TypeCasts.h> #include <wtf/Vector.h> @@ -102,9 +102,9 @@ public: WEBCORE_EXPORT bool containsMappedFileData() const; private: - void iterate(const Function<void(const Span<const uint8_t> &)> &apply) const; + void iterate(const Function<void(const std::span<const uint8_t> &)> &apply) const; #if USE(FOUNDATION) - void iterate(CFDataRef, const Function<void(const Span<const uint8_t> &)> &apply) const; + void iterate(CFDataRef, const Function<void(const std::span<const uint8_t> &)> &apply) const; #endif explicit DataSegment(Vector<uint8_t> &&data) @@ -197,8 +197,8 @@ public: WEBCORE_EXPORT void copyTo(void *destination, size_t length) const; WEBCORE_EXPORT void copyTo(void *destination, size_t offset, size_t length) const; - WEBCORE_EXPORT void forEachSegment(const Function<void(const Span<const uint8_t> &)> &) const; - WEBCORE_EXPORT bool startsWith(const Span<const uint8_t> &prefix) const; + WEBCORE_EXPORT void forEachSegment(const Function<void(const std::span<const uint8_t> &)> &) const; + WEBCORE_EXPORT bool startsWith(const std::span<const uint8_t> &prefix) const; WEBCORE_EXPORT void forEachSegmentAsSharedBuffer(const Function<void(Ref<SharedBuffer> &&)> &) const; using DataSegment = WebCore::DataSegment; // To keep backward compatibility when using FragmentedSharedBuffer::DataSegment @@ -253,7 +253,7 @@ private: friend class SharedBufferBuilder; WEBCORE_EXPORT void append(const FragmentedSharedBuffer &); WEBCORE_EXPORT void append(const uint8_t *, size_t); - void append(Span<const uint8_t> value) { append(value.data(), value.size()); } + void append(std::span<const uint8_t> value) { append(value.data(), value.size()); } void append(const char *data, size_t length) { append(reinterpret_cast<const uint8_t *>(data), length); } WEBCORE_EXPORT void append(Vector<uint8_t> &&); #if USE(FOUNDATION) @@ -296,7 +296,7 @@ public: WEBCORE_EXPORT const uint8_t *data() const; const char *dataAsCharPtr() const { return reinterpret_cast<const char *>(data()); } - Span<const uint8_t> dataAsSpanForContiguousData() const { return Span<const uint8_t>(data(), isContiguous() ? size() : 0); } + std::span<const uint8_t> dataAsSpanForContiguousData() const { return std::span<const uint8_t>(data(), isContiguous() ? size() : 0); } WTF::Persistence::Decoder decoder() const; enum class MayUseFileMapping : bool { No, diff --git a/src/js/builtins/EventSource.ts b/src/js/builtins/EventSource.ts index 64179bc0d..a26c8d4ce 100644 --- a/src/js/builtins/EventSource.ts +++ b/src/js/builtins/EventSource.ts @@ -135,7 +135,7 @@ export function getEventSource() { id = line.substring(3).trim(); } else if (line.startsWith("retry:")) { retry = parseInt(line.substring(6).trim(), 10); - if (isNaN(retry)) { + if (retry !== retry) { retry = -1; } } @@ -278,7 +278,7 @@ export function getEventSource() { header_name.localeCompare("content-length", undefined, { sensitivity: "accent" }) === 0; if (is_content_length) { content_length = parseInt(header.substring(header_name_idx + 1).trim(), 10); - if (isNaN(content_length) || content_length <= 0) { + if (content_length !== content_length || content_length <= 0) { self.dispatchEvent( new ErrorEvent("error", { error: new Error(`EventSource's Content-Length is invalid. Aborting the connection.`), diff --git a/src/js/builtins/ImportMetaObject.ts b/src/js/builtins/ImportMetaObject.ts index 934a37881..1f26695fc 100644 --- a/src/js/builtins/ImportMetaObject.ts +++ b/src/js/builtins/ImportMetaObject.ts @@ -70,8 +70,10 @@ export function loadCJS2ESM(this: ImportMetaObject, resolvedSpecifier: string) { entry.dependencies = dependencies; // All dependencies resolved, set instantiate and satisfy field directly. - entry.instantiate = Promise.resolve(entry); - entry.satisfy = Promise.resolve(entry); + entry.instantiate = Promise.$resolve(entry); + entry.satisfy = Promise.$resolve(entry); + entry.isSatisfied = true; + key = queue.shift(); while (key && (loader.registry.$get(key)?.state ?? $ModuleFetch) >= $ModuleLink) { key = queue.shift(); diff --git a/src/js/builtins/JSBufferPrototype.ts b/src/js/builtins/JSBufferPrototype.ts index f5d6a7bfb..a77d6be67 100644 --- a/src/js/builtins/JSBufferPrototype.ts +++ b/src/js/builtins/JSBufferPrototype.ts @@ -465,7 +465,7 @@ export function slice(this: BufferExt, start, end) { // Use Math.trunc() to convert offset to an integer value that can be larger // than an Int32. Hence, don't use offset | 0 or similar techniques. offset = $trunc(offset); - if (offset === 0 || isNaN(offset)) { + if (offset === 0 || offset !== offset) { return 0; } else if (offset < 0) { offset += length; diff --git a/src/js/builtins/ReadableByteStreamInternals.ts b/src/js/builtins/ReadableByteStreamInternals.ts index f44c385b4..1f1853ef4 100644 --- a/src/js/builtins/ReadableByteStreamInternals.ts +++ b/src/js/builtins/ReadableByteStreamInternals.ts @@ -41,7 +41,7 @@ export function privateInitializeReadableByteStreamController(this, stream, unde $putByIdDirectPrivate(this, "closeRequested", false); let hwm = $toNumber(highWaterMark); - if (isNaN(hwm) || hwm < 0) throw new RangeError("highWaterMark value is negative or not a number"); + if (hwm !== hwm || hwm < 0) throw new RangeError("highWaterMark value is negative or not a number"); $putByIdDirectPrivate(this, "strategyHWM", hwm); let autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize; @@ -372,7 +372,7 @@ export function readableByteStreamControllerRespondWithNewView(controller, view) export function readableByteStreamControllerRespond(controller, bytesWritten) { bytesWritten = $toNumber(bytesWritten); - if (isNaN(bytesWritten) || bytesWritten === Infinity || bytesWritten < 0) + if (bytesWritten !== bytesWritten || bytesWritten === Infinity || bytesWritten < 0) throw new RangeError("bytesWritten has an incorrect value"); $assert($getByIdDirectPrivate(controller, "pendingPullIntos").isNotEmpty()); diff --git a/src/js/builtins/ReadableStreamBYOBReader.ts b/src/js/builtins/ReadableStreamBYOBReader.ts index 5ebfddb19..62a04d8a3 100644 --- a/src/js/builtins/ReadableStreamBYOBReader.ts +++ b/src/js/builtins/ReadableStreamBYOBReader.ts @@ -76,5 +76,5 @@ export function closed(this) { if (!$isReadableStreamBYOBReader(this)) return Promise.$reject($makeGetterTypeError("ReadableStreamBYOBReader", "closed")); - return $getByIdDirectPrivate(this, "closedPromiseCapability").$promise; + return $getByIdDirectPrivate(this, "closedPromiseCapability").promise; } diff --git a/src/js/builtins/ReadableStreamDefaultReader.ts b/src/js/builtins/ReadableStreamDefaultReader.ts index a5654d834..b4e0c2bd3 100644 --- a/src/js/builtins/ReadableStreamDefaultReader.ts +++ b/src/js/builtins/ReadableStreamDefaultReader.ts @@ -181,5 +181,5 @@ export function closed(this) { if (!$isReadableStreamDefaultReader(this)) return Promise.$reject($makeGetterTypeError("ReadableStreamDefaultReader", "closed")); - return $getByIdDirectPrivate(this, "closedPromiseCapability").$promise; + return $getByIdDirectPrivate(this, "closedPromiseCapability").promise; } diff --git a/src/js/builtins/ReadableStreamInternals.ts b/src/js/builtins/ReadableStreamInternals.ts index 3bcf4f399..58fa4524a 100644 --- a/src/js/builtins/ReadableStreamInternals.ts +++ b/src/js/builtins/ReadableStreamInternals.ts @@ -34,12 +34,12 @@ export function readableStreamReaderGenericInitialize(reader, stream) { $putByIdDirectPrivate(reader, "closedPromiseCapability", $newPromiseCapability(Promise)); else if ($getByIdDirectPrivate(stream, "state") === $streamClosed) $putByIdDirectPrivate(reader, "closedPromiseCapability", { - $promise: Promise.$resolve(), + promise: Promise.$resolve(), }); else { $assert($getByIdDirectPrivate(stream, "state") === $streamErrored); $putByIdDirectPrivate(reader, "closedPromiseCapability", { - $promise: $newHandledRejectedPromise($getByIdDirectPrivate(stream, "storedError")), + promise: $newHandledRejectedPromise($getByIdDirectPrivate(stream, "storedError")), }); } } @@ -76,7 +76,7 @@ export function readableStreamPipeTo(stream, sink) { const reader = new ReadableStreamDefaultReader(stream); - $getByIdDirectPrivate(reader, "closedPromiseCapability").$promise.$then( + $getByIdDirectPrivate(reader, "closedPromiseCapability").promise.$then( () => {}, e => { sink.error(e); @@ -249,7 +249,7 @@ export function readableStreamPipeToWritableStream( pipeState.shuttingDown = false; pipeState.promiseCapability = $newPromiseCapability(Promise); pipeState.pendingReadPromiseCapability = $newPromiseCapability(Promise); - pipeState.pendingReadPromiseCapability.$resolve.$call(); + pipeState.pendingReadPromiseCapability.resolve.$call(); pipeState.pendingWritePromise = Promise.$resolve(); if (signal !== undefined) { @@ -278,19 +278,19 @@ export function readableStreamPipeToWritableStream( shouldWait = false; return; } - promiseCapability.$resolve.$call(); + promiseCapability.resolve.$call(); }; let handleRejectedPromise = e => { - promiseCapability.$reject.$call(undefined, e); + promiseCapability.reject.$call(undefined, e); }; promiseDestination.$then(handleResolvedPromise, handleRejectedPromise); promiseSource.$then(handleResolvedPromise, handleRejectedPromise); - return promiseCapability.$promise; + return promiseCapability.promise; }, reason, ); }; - if ($whenSignalAborted(signal, algorithm)) return pipeState.promiseCapability.$promise; + if ($whenSignalAborted(signal, algorithm)) return pipeState.promiseCapability.promise; } $pipeToErrorsMustBePropagatedForward(pipeState); @@ -300,7 +300,7 @@ export function readableStreamPipeToWritableStream( $pipeToLoop(pipeState); - return pipeState.promiseCapability.$promise; + return pipeState.promiseCapability.promise; } export function pipeToLoop(pipeState) { @@ -315,36 +315,36 @@ export function pipeToDoReadWrite(pipeState) { $assert(!pipeState.shuttingDown); pipeState.pendingReadPromiseCapability = $newPromiseCapability(Promise); - $getByIdDirectPrivate(pipeState.writer, "readyPromise").$promise.$then( + $getByIdDirectPrivate(pipeState.writer, "readyPromise").promise.$then( () => { if (pipeState.shuttingDown) { - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, false); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, false); return; } $readableStreamDefaultReaderRead(pipeState.reader).$then( result => { const canWrite = !result.done && $getByIdDirectPrivate(pipeState.writer, "stream") !== undefined; - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, canWrite); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, canWrite); if (!canWrite) return; pipeState.pendingWritePromise = $writableStreamDefaultWriterWrite(pipeState.writer, result.value); }, e => { - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, false); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, false); }, ); }, e => { - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, false); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, false); }, ); - return pipeState.pendingReadPromiseCapability.$promise; + return pipeState.pendingReadPromiseCapability.promise; } export function pipeToErrorsMustBePropagatedForward(pipeState) { const action = () => { - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, false); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, false); const error = $getByIdDirectPrivate(pipeState.source, "storedError"); if (!pipeState.preventAbort) { $pipeToShutdownWithAction(pipeState, () => $writableStreamAbort(pipeState.destination, error), error); @@ -358,7 +358,7 @@ export function pipeToErrorsMustBePropagatedForward(pipeState) { return; } - $getByIdDirectPrivate(pipeState.reader, "closedPromiseCapability").$promise.$then(undefined, action); + $getByIdDirectPrivate(pipeState.reader, "closedPromiseCapability").promise.$then(undefined, action); } export function pipeToErrorsMustBePropagatedBackward(pipeState) { @@ -374,12 +374,12 @@ export function pipeToErrorsMustBePropagatedBackward(pipeState) { action(); return; } - $getByIdDirectPrivate(pipeState.writer, "closedPromise").$promise.$then(undefined, action); + $getByIdDirectPrivate(pipeState.writer, "closedPromise").promise.$then(undefined, action); } export function pipeToClosingMustBePropagatedForward(pipeState) { const action = () => { - pipeState.pendingReadPromiseCapability.$resolve.$call(undefined, false); + pipeState.pendingReadPromiseCapability.resolve.$call(undefined, false); // const error = $getByIdDirectPrivate(pipeState.source, "storedError"); if (!pipeState.preventClose) { $pipeToShutdownWithAction(pipeState, () => @@ -393,7 +393,7 @@ export function pipeToClosingMustBePropagatedForward(pipeState) { action(); return; } - $getByIdDirectPrivate(pipeState.reader, "closedPromiseCapability").$promise.$then(action, undefined); + $getByIdDirectPrivate(pipeState.reader, "closedPromiseCapability").promise.$then(action, undefined); } export function pipeToClosingMustBePropagatedBackward(pipeState) { @@ -437,7 +437,7 @@ export function pipeToShutdownWithAction(pipeState, action) { $getByIdDirectPrivate(pipeState.destination, "state") === "writable" && !$writableStreamCloseQueuedOrInFlight(pipeState.destination) ) { - pipeState.pendingReadPromiseCapability.$promise.$then( + pipeState.pendingReadPromiseCapability.promise.$then( () => { pipeState.pendingWritePromise.$then(finalize, finalize); }, @@ -465,7 +465,7 @@ export function pipeToShutdown(pipeState) { $getByIdDirectPrivate(pipeState.destination, "state") === "writable" && !$writableStreamCloseQueuedOrInFlight(pipeState.destination) ) { - pipeState.pendingReadPromiseCapability.$promise.$then( + pipeState.pendingReadPromiseCapability.promise.$then( () => { pipeState.pendingWritePromise.$then(finalize, finalize); }, @@ -483,8 +483,8 @@ export function pipeToFinalize(pipeState) { // Instead of removing the abort algorithm as per spec, we make it a no-op which is equivalent. pipeState.finalized = true; - if (arguments.length > 1) pipeState.promiseCapability.$reject.$call(undefined, arguments[1]); - else pipeState.promiseCapability.$resolve.$call(); + if (arguments.length > 1) pipeState.promiseCapability.reject.$call(undefined, arguments[1]); + else pipeState.promiseCapability.resolve.$call(); } export function readableStreamTee(stream, shouldClone) { @@ -522,12 +522,12 @@ export function readableStreamTee(stream, shouldClone) { const branch1 = new $ReadableStream(branch1Source); const branch2 = new $ReadableStream(branch2Source); - $getByIdDirectPrivate(reader, "closedPromiseCapability").$promise.$then(undefined, function (e) { + $getByIdDirectPrivate(reader, "closedPromiseCapability").promise.$then(undefined, function (e) { if (teeState.closedOrErrored) return; $readableStreamDefaultControllerError(branch1.$readableStreamController, e); $readableStreamDefaultControllerError(branch2.$readableStreamController, e); teeState.closedOrErrored = true; - if (!teeState.canceled1 || !teeState.canceled2) teeState.cancelPromiseCapability.$resolve.$call(); + if (!teeState.canceled1 || !teeState.canceled2) teeState.cancelPromiseCapability.resolve.$call(); }); // Additional fields compared to the spec, as they are needed within pull/cancel functions. @@ -546,7 +546,7 @@ export function readableStreamTeePullFunction(teeState, reader, shouldClone) { if (!teeState.canceled1) $readableStreamDefaultControllerClose(teeState.branch1.$readableStreamController); if (!teeState.canceled2) $readableStreamDefaultControllerClose(teeState.branch2.$readableStreamController); teeState.closedOrErrored = true; - if (!teeState.canceled1 || !teeState.canceled2) teeState.cancelPromiseCapability.$resolve.$call(); + if (!teeState.canceled1 || !teeState.canceled2) teeState.cancelPromiseCapability.resolve.$call(); } if (teeState.closedOrErrored) return; if (!teeState.canceled1) @@ -570,7 +570,7 @@ export function readableStreamTeeBranch1CancelFunction(teeState, stream) { teeState.cancelPromiseCapability.$reject, ); } - return teeState.cancelPromiseCapability.$promise; + return teeState.cancelPromiseCapability.promise; }; } @@ -584,7 +584,7 @@ export function readableStreamTeeBranch2CancelFunction(teeState, stream) { teeState.cancelPromiseCapability.$reject, ); } - return teeState.cancelPromiseCapability.$promise; + return teeState.cancelPromiseCapability.promise; }; } @@ -1059,7 +1059,7 @@ export function createTextStream(highWaterMark) { calledDone = true; const result = sink.finishInternal(); - $fulfillPromise(capability.$promise, result); + $fulfillPromise(capability.promise, result); return result; }, @@ -1143,7 +1143,7 @@ export function initializeArrayStream(underlyingSource, highWaterMark) { function fulfill() { calledDone = true; - closingPromise.$resolve.$call(undefined, array); + closingPromise.resolve.$call(undefined, array); return array; } @@ -1252,8 +1252,8 @@ export function readableStreamError(stream, error) { for (var request = requests.shift(); request; request = requests.shift()) $rejectPromise(request, error); } - $getByIdDirectPrivate(reader, "closedPromiseCapability").$reject.$call(undefined, error); - const promise = $getByIdDirectPrivate(reader, "closedPromiseCapability").$promise; + $getByIdDirectPrivate(reader, "closedPromiseCapability").reject.$call(undefined, error); + const promise = $getByIdDirectPrivate(reader, "closedPromiseCapability").promise; $markPromiseAsHandled(promise); } @@ -1395,7 +1395,7 @@ export function readableStreamClose(stream) { } } - $getByIdDirectPrivate($getByIdDirectPrivate(stream, "reader"), "closedPromiseCapability").$resolve.$call(); + $getByIdDirectPrivate($getByIdDirectPrivate(stream, "reader"), "closedPromiseCapability").resolve.$call(); } export function readableStreamFulfillReadRequest(stream, chunk, done) { @@ -1465,16 +1465,16 @@ export function readableStreamReaderGenericRelease(reader) { $assert($getByIdDirectPrivate($getByIdDirectPrivate(reader, "ownerReadableStream"), "reader") === reader); if ($getByIdDirectPrivate($getByIdDirectPrivate(reader, "ownerReadableStream"), "state") === $streamReadable) - $getByIdDirectPrivate(reader, "closedPromiseCapability").$reject.$call( + $getByIdDirectPrivate(reader, "closedPromiseCapability").reject.$call( undefined, $makeTypeError("releasing lock of reader whose stream is still in readable state"), ); else $putByIdDirectPrivate(reader, "closedPromiseCapability", { - $promise: $newHandledRejectedPromise($makeTypeError("reader released lock")), + promise: $newHandledRejectedPromise($makeTypeError("reader released lock")), }); - const promise = $getByIdDirectPrivate(reader, "closedPromiseCapability").$promise; + const promise = $getByIdDirectPrivate(reader, "closedPromiseCapability").promise; $markPromiseAsHandled(promise); $putByIdDirectPrivate($getByIdDirectPrivate(reader, "ownerReadableStream"), "reader", undefined); $putByIdDirectPrivate(reader, "ownerReadableStream", undefined); @@ -1668,9 +1668,9 @@ export function readableStreamIntoText(stream) { const [textStream, closer] = $createTextStream($getByIdDirectPrivate(stream, "highWaterMark")); const prom = $readStreamIntoSink(stream, textStream, false); if (prom && $isPromise(prom)) { - return Promise.$resolve(prom).$then(closer.$promise); + return Promise.$resolve(prom).$then(closer.promise); } - return closer.$promise; + return closer.promise; } export function readableStreamToArrayBufferDirect(stream, underlyingSource) { @@ -1692,7 +1692,7 @@ export function readableStreamToArrayBufferDirect(stream, underlyingSource) { close(); } - $fulfillPromise(capability.$promise, sink.end()); + $fulfillPromise(capability.promise, sink.end()); } }, end() { @@ -1701,7 +1701,7 @@ export function readableStreamToArrayBufferDirect(stream, underlyingSource) { if (close) { close(); } - $fulfillPromise(capability.$promise, sink.end()); + $fulfillPromise(capability.promise, sink.end()); } }, flush() { @@ -1722,7 +1722,7 @@ export function readableStreamToArrayBufferDirect(stream, underlyingSource) { })(controller, promise, pull); } - return capability.$promise; + return capability.promise; } catch (e) { didError = true; $readableStreamError(stream, e); @@ -1750,7 +1750,7 @@ export async function readableStreamToTextDirect(stream, underlyingSource) { reader = undefined; stream = undefined; - return capability.$promise; + return capability.promise; } export async function readableStreamToArrayDirect(stream, underlyingSource) { @@ -1770,7 +1770,7 @@ export async function readableStreamToArrayDirect(stream, underlyingSource) { } catch (e) {} reader = undefined; - return Promise.$resolve(capability.$promise); + return Promise.$resolve(capability.promise); } catch (e) { throw e; } finally { diff --git a/src/js/builtins/StreamInternals.ts b/src/js/builtins/StreamInternals.ts index 7bb262951..34b681f1e 100644 --- a/src/js/builtins/StreamInternals.ts +++ b/src/js/builtins/StreamInternals.ts @@ -81,7 +81,7 @@ export function validateAndNormalizeQueuingStrategy(size, highWaterMark) { const newHighWaterMark = $toNumber(highWaterMark); - if (isNaN(newHighWaterMark) || newHighWaterMark < 0) + if (newHighWaterMark !== newHighWaterMark || newHighWaterMark < 0) throw new RangeError("highWaterMark value is negative or not a number"); return { size: size, highWaterMark: newHighWaterMark }; @@ -241,7 +241,7 @@ export function extractHighWaterMark(strategy, defaultHWM) { if (highWaterMark === undefined) return defaultHWM; - if (isNaN(highWaterMark) || highWaterMark < 0) + if (highWaterMark !== highWaterMark || highWaterMark < 0) throw new RangeError("highWaterMark value is negative or not a number"); return $toNumber(highWaterMark); diff --git a/src/js/builtins/TransformStream.ts b/src/js/builtins/TransformStream.ts index 2a124d4e1..f9d80b7cb 100644 --- a/src/js/builtins/TransformStream.ts +++ b/src/js/builtins/TransformStream.ts @@ -68,7 +68,7 @@ export function initializeTransformStream(this) { const startPromiseCapability = $newPromiseCapability(Promise); $initializeTransformStream( this, - startPromiseCapability.$promise, + startPromiseCapability.promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, @@ -82,13 +82,13 @@ export function initializeTransformStream(this) { startAlgorithm().$then( () => { // FIXME: We probably need to resolve start promise with the result of the start algorithm. - startPromiseCapability.$resolve.$call(); + startPromiseCapability.resolve.$call(); }, error => { - startPromiseCapability.$reject.$call(undefined, error); + startPromiseCapability.reject.$call(undefined, error); }, ); - } else startPromiseCapability.$resolve.$call(); + } else startPromiseCapability.resolve.$call(); return this; } diff --git a/src/js/builtins/TransformStreamInternals.ts b/src/js/builtins/TransformStreamInternals.ts index 9da403e71..103b0651f 100644 --- a/src/js/builtins/TransformStreamInternals.ts +++ b/src/js/builtins/TransformStreamInternals.ts @@ -57,7 +57,7 @@ export function createTransformStream( const startPromiseCapability = $newPromiseCapability(Promise); $initializeTransformStream( stream, - startPromiseCapability.$promise, + startPromiseCapability.promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, @@ -69,10 +69,10 @@ export function createTransformStream( startAlgorithm().$then( () => { - startPromiseCapability.$resolve.$call(); + startPromiseCapability.resolve.$call(); }, error => { - startPromiseCapability.$reject.$call(undefined, error); + startPromiseCapability.reject.$call(undefined, error); }, ); @@ -158,7 +158,7 @@ export function transformStreamSetBackpressure(stream, backpressure) { $assert($getByIdDirectPrivate(stream, "backpressure") !== backpressure); const backpressureChangePromise = $getByIdDirectPrivate(stream, "backpressureChangePromise"); - if (backpressureChangePromise !== undefined) backpressureChangePromise.$resolve.$call(); + if (backpressureChangePromise !== undefined) backpressureChangePromise.resolve.$call(); $putByIdDirectPrivate(stream, "backpressureChangePromise", $newPromiseCapability(Promise)); $putByIdDirectPrivate(stream, "backpressure", backpressure); @@ -245,10 +245,10 @@ export function transformStreamDefaultControllerPerformTransform(controller, chu }, r => { $transformStreamError($getByIdDirectPrivate(controller, "stream"), r); - promiseCapability.$reject.$call(undefined, r); + promiseCapability.reject.$call(undefined, r); }, ); - return promiseCapability.$promise; + return promiseCapability.promise; } export function transformStreamDefaultControllerTerminate(controller) { @@ -275,11 +275,11 @@ export function transformStreamDefaultSinkWriteAlgorithm(stream, chunk) { const backpressureChangePromise = $getByIdDirectPrivate(stream, "backpressureChangePromise"); $assert(backpressureChangePromise !== undefined); - backpressureChangePromise.$promise.$then( + backpressureChangePromise.promise.$then( () => { const state = $getByIdDirectPrivate(writable, "state"); if (state === "erroring") { - promiseCapability.$reject.$call(undefined, $getByIdDirectPrivate(writable, "storedError")); + promiseCapability.reject.$call(undefined, $getByIdDirectPrivate(writable, "storedError")); return; } @@ -289,16 +289,16 @@ export function transformStreamDefaultSinkWriteAlgorithm(stream, chunk) { promiseCapability.$resolve(); }, e => { - promiseCapability.$reject.$call(undefined, e); + promiseCapability.reject.$call(undefined, e); }, ); }, e => { - promiseCapability.$reject.$call(undefined, e); + promiseCapability.reject.$call(undefined, e); }, ); - return promiseCapability.$promise; + return promiseCapability.promise; } return $transformStreamDefaultControllerPerformTransform(controller, chunk); } @@ -322,7 +322,7 @@ export function transformStreamDefaultSinkCloseAlgorithm(stream) { flushPromise.$then( () => { if ($getByIdDirectPrivate(readable, "state") === $streamErrored) { - promiseCapability.$reject.$call(undefined, $getByIdDirectPrivate(readable, "storedError")); + promiseCapability.reject.$call(undefined, $getByIdDirectPrivate(readable, "storedError")); return; } @@ -333,10 +333,10 @@ export function transformStreamDefaultSinkCloseAlgorithm(stream) { }, r => { $transformStreamError($getByIdDirectPrivate(controller, "stream"), r); - promiseCapability.$reject.$call(undefined, $getByIdDirectPrivate(readable, "storedError")); + promiseCapability.reject.$call(undefined, $getByIdDirectPrivate(readable, "storedError")); }, ); - return promiseCapability.$promise; + return promiseCapability.promise; } export function transformStreamDefaultSourcePullAlgorithm(stream) { @@ -345,5 +345,5 @@ export function transformStreamDefaultSourcePullAlgorithm(stream) { $transformStreamSetBackpressure(stream, false); - return $getByIdDirectPrivate(stream, "backpressureChangePromise").$promise; + return $getByIdDirectPrivate(stream, "backpressureChangePromise").promise; } diff --git a/src/js/builtins/WritableStreamDefaultWriter.ts b/src/js/builtins/WritableStreamDefaultWriter.ts index 50b2cd13f..ff3f38f00 100644 --- a/src/js/builtins/WritableStreamDefaultWriter.ts +++ b/src/js/builtins/WritableStreamDefaultWriter.ts @@ -41,7 +41,7 @@ export function closed() { if (!$isWritableStreamDefaultWriter(this)) return Promise.$reject($makeGetterTypeError("WritableStreamDefaultWriter", "closed")); - return $getByIdDirectPrivate(this, "closedPromise").$promise; + return $getByIdDirectPrivate(this, "closedPromise").promise; } $getter; @@ -58,7 +58,7 @@ export function ready() { if (!$isWritableStreamDefaultWriter(this)) return Promise.$reject($makeThisTypeError("WritableStreamDefaultWriter", "ready")); - return $getByIdDirectPrivate(this, "readyPromise").$promise; + return $getByIdDirectPrivate(this, "readyPromise").promise; } export function abort(reason) { diff --git a/src/js/builtins/WritableStreamInternals.ts b/src/js/builtins/WritableStreamInternals.ts index 2008dab1c..e14c5dee3 100644 --- a/src/js/builtins/WritableStreamInternals.ts +++ b/src/js/builtins/WritableStreamInternals.ts @@ -47,7 +47,7 @@ export function createWritableStream( highWaterMark, sizeAlgorithm, ) { - $assert(typeof highWaterMark === "number" && !isNaN(highWaterMark) && highWaterMark >= 0); + $assert(typeof highWaterMark === "number" && highWaterMark === highWaterMark && highWaterMark >= 0); const internalStream = {}; $initializeWritableStreamSlots(internalStream, {}); @@ -162,20 +162,20 @@ export function setUpWritableStreamDefaultWriter(writer, stream) { const state = $getByIdDirectPrivate(stream, "state"); if (state === "writable") { if ($writableStreamCloseQueuedOrInFlight(stream) || !$getByIdDirectPrivate(stream, "backpressure")) - readyPromiseCapability.$resolve.$call(); + readyPromiseCapability.resolve.$call(); } else if (state === "erroring") { - readyPromiseCapability.$reject.$call(undefined, $getByIdDirectPrivate(stream, "storedError")); - $markPromiseAsHandled(readyPromiseCapability.$promise); + readyPromiseCapability.reject.$call(undefined, $getByIdDirectPrivate(stream, "storedError")); + $markPromiseAsHandled(readyPromiseCapability.promise); } else if (state === "closed") { - readyPromiseCapability.$resolve.$call(); - closedPromiseCapability.$resolve.$call(); + readyPromiseCapability.resolve.$call(); + closedPromiseCapability.resolve.$call(); } else { $assert(state === "errored"); const storedError = $getByIdDirectPrivate(stream, "storedError"); - readyPromiseCapability.$reject.$call(undefined, storedError); - $markPromiseAsHandled(readyPromiseCapability.$promise); - closedPromiseCapability.$reject.$call(undefined, storedError); - $markPromiseAsHandled(closedPromiseCapability.$promise); + readyPromiseCapability.reject.$call(undefined, storedError); + $markPromiseAsHandled(readyPromiseCapability.promise); + closedPromiseCapability.reject.$call(undefined, storedError); + $markPromiseAsHandled(closedPromiseCapability.promise); } } @@ -184,7 +184,7 @@ export function writableStreamAbort(stream, reason) { if (state === "closed" || state === "errored") return Promise.$resolve(); const pendingAbortRequest = $getByIdDirectPrivate(stream, "pendingAbortRequest"); - if (pendingAbortRequest !== undefined) return pendingAbortRequest.promise.$promise; + if (pendingAbortRequest !== undefined) return pendingAbortRequest.promise.promise; $assert(state === "writable" || state === "erroring"); let wasAlreadyErroring = false; @@ -201,7 +201,7 @@ export function writableStreamAbort(stream, reason) { }); if (!wasAlreadyErroring) $writableStreamStartErroring(stream, reason); - return abortPromiseCapability.$promise; + return abortPromiseCapability.promise; } export function writableStreamClose(stream) { @@ -217,11 +217,11 @@ export function writableStreamClose(stream) { const writer = $getByIdDirectPrivate(stream, "writer"); if (writer !== undefined && $getByIdDirectPrivate(stream, "backpressure") && state === "writable") - $getByIdDirectPrivate(writer, "readyPromise").$resolve.$call(); + $getByIdDirectPrivate(writer, "readyPromise").resolve.$call(); $writableStreamDefaultControllerClose($getByIdDirectPrivate(stream, "controller")); - return closePromiseCapability.$promise; + return closePromiseCapability.promise; } export function writableStreamAddWriteRequest(stream) { @@ -231,7 +231,7 @@ export function writableStreamAddWriteRequest(stream) { const writePromiseCapability = $newPromiseCapability(Promise); const writeRequests = $getByIdDirectPrivate(stream, "writeRequests"); writeRequests.push(writePromiseCapability); - return writePromiseCapability.$promise; + return writePromiseCapability.promise; } export function writableStreamCloseQueuedOrInFlight(stream) { @@ -264,7 +264,7 @@ export function writableStreamFinishErroring(stream) { const storedError = $getByIdDirectPrivate(stream, "storedError"); const requests = $getByIdDirectPrivate(stream, "writeRequests"); for (var request = requests.shift(); request; request = requests.shift()) - request.$reject.$call(undefined, storedError); + request.reject.$call(undefined, storedError); // TODO: is this still necessary? $putByIdDirectPrivate(stream, "writeRequests", $createFIFO()); @@ -277,7 +277,7 @@ export function writableStreamFinishErroring(stream) { $putByIdDirectPrivate(stream, "pendingAbortRequest", undefined); if (abortRequest.wasAlreadyErroring) { - abortRequest.promise.$reject.$call(undefined, storedError); + abortRequest.promise.reject.$call(undefined, storedError); $writableStreamRejectCloseAndClosedPromiseIfNeeded(stream); return; } @@ -286,11 +286,11 @@ export function writableStreamFinishErroring(stream) { .$call(undefined, abortRequest.reason) .$then( () => { - abortRequest.promise.$resolve.$call(); + abortRequest.promise.resolve.$call(); $writableStreamRejectCloseAndClosedPromiseIfNeeded(stream); }, reason => { - abortRequest.promise.$reject.$call(undefined, reason); + abortRequest.promise.reject.$call(undefined, reason); $writableStreamRejectCloseAndClosedPromiseIfNeeded(stream); }, ); @@ -298,7 +298,7 @@ export function writableStreamFinishErroring(stream) { export function writableStreamFinishInFlightClose(stream) { const inFlightCloseRequest = $getByIdDirectPrivate(stream, "inFlightCloseRequest"); - inFlightCloseRequest.$resolve.$call(); + inFlightCloseRequest.resolve.$call(); $putByIdDirectPrivate(stream, "inFlightCloseRequest", undefined); @@ -309,7 +309,7 @@ export function writableStreamFinishInFlightClose(stream) { $putByIdDirectPrivate(stream, "storedError", undefined); const abortRequest = $getByIdDirectPrivate(stream, "pendingAbortRequest"); if (abortRequest !== undefined) { - abortRequest.promise.$resolve.$call(); + abortRequest.promise.resolve.$call(); $putByIdDirectPrivate(stream, "pendingAbortRequest", undefined); } } @@ -317,7 +317,7 @@ export function writableStreamFinishInFlightClose(stream) { $putByIdDirectPrivate(stream, "state", "closed"); const writer = $getByIdDirectPrivate(stream, "writer"); - if (writer !== undefined) $getByIdDirectPrivate(writer, "closedPromise").$resolve.$call(); + if (writer !== undefined) $getByIdDirectPrivate(writer, "closedPromise").resolve.$call(); $assert($getByIdDirectPrivate(stream, "pendingAbortRequest") === undefined); $assert($getByIdDirectPrivate(stream, "storedError") === undefined); @@ -326,7 +326,7 @@ export function writableStreamFinishInFlightClose(stream) { export function writableStreamFinishInFlightCloseWithError(stream, error) { const inFlightCloseRequest = $getByIdDirectPrivate(stream, "inFlightCloseRequest"); $assert(inFlightCloseRequest !== undefined); - inFlightCloseRequest.$reject.$call(undefined, error); + inFlightCloseRequest.reject.$call(undefined, error); $putByIdDirectPrivate(stream, "inFlightCloseRequest", undefined); @@ -335,7 +335,7 @@ export function writableStreamFinishInFlightCloseWithError(stream, error) { const abortRequest = $getByIdDirectPrivate(stream, "pendingAbortRequest"); if (abortRequest !== undefined) { - abortRequest.promise.$reject.$call(undefined, error); + abortRequest.promise.reject.$call(undefined, error); $putByIdDirectPrivate(stream, "pendingAbortRequest", undefined); } @@ -345,7 +345,7 @@ export function writableStreamFinishInFlightCloseWithError(stream, error) { export function writableStreamFinishInFlightWrite(stream) { const inFlightWriteRequest = $getByIdDirectPrivate(stream, "inFlightWriteRequest"); $assert(inFlightWriteRequest !== undefined); - inFlightWriteRequest.$resolve.$call(); + inFlightWriteRequest.resolve.$call(); $putByIdDirectPrivate(stream, "inFlightWriteRequest", undefined); } @@ -353,7 +353,7 @@ export function writableStreamFinishInFlightWrite(stream) { export function writableStreamFinishInFlightWriteWithError(stream, error) { const inFlightWriteRequest = $getByIdDirectPrivate(stream, "inFlightWriteRequest"); $assert(inFlightWriteRequest !== undefined); - inFlightWriteRequest.$reject.$call(undefined, error); + inFlightWriteRequest.reject.$call(undefined, error); $putByIdDirectPrivate(stream, "inFlightWriteRequest", undefined); @@ -396,15 +396,15 @@ export function writableStreamRejectCloseAndClosedPromiseIfNeeded(stream) { const closeRequest = $getByIdDirectPrivate(stream, "closeRequest"); if (closeRequest !== undefined) { $assert($getByIdDirectPrivate(stream, "inFlightCloseRequest") === undefined); - closeRequest.$reject.$call(undefined, storedError); + closeRequest.reject.$call(undefined, storedError); $putByIdDirectPrivate(stream, "closeRequest", undefined); } const writer = $getByIdDirectPrivate(stream, "writer"); if (writer !== undefined) { const closedPromise = $getByIdDirectPrivate(writer, "closedPromise"); - closedPromise.$reject.$call(undefined, storedError); - $markPromiseAsHandled(closedPromise.$promise); + closedPromise.reject.$call(undefined, storedError); + $markPromiseAsHandled(closedPromise.promise); } } @@ -432,7 +432,7 @@ export function writableStreamUpdateBackpressure(stream, backpressure) { const writer = $getByIdDirectPrivate(stream, "writer"); if (writer !== undefined && backpressure !== $getByIdDirectPrivate(stream, "backpressure")) { if (backpressure) $putByIdDirectPrivate(writer, "readyPromise", $newPromiseCapability(Promise)); - else $getByIdDirectPrivate(writer, "readyPromise").$resolve.$call(); + else $getByIdDirectPrivate(writer, "readyPromise").resolve.$call(); } $putByIdDirectPrivate(stream, "backpressure", backpressure); } @@ -465,29 +465,29 @@ export function writableStreamDefaultWriterCloseWithErrorPropagation(writer) { export function writableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) { let closedPromiseCapability = $getByIdDirectPrivate(writer, "closedPromise"); - let closedPromise = closedPromiseCapability.$promise; + let closedPromise = closedPromiseCapability.promise; if (($getPromiseInternalField(closedPromise, $promiseFieldFlags) & $promiseStateMask) !== $promiseStatePending) { closedPromiseCapability = $newPromiseCapability(Promise); - closedPromise = closedPromiseCapability.$promise; + closedPromise = closedPromiseCapability.promise; $putByIdDirectPrivate(writer, "closedPromise", closedPromiseCapability); } - closedPromiseCapability.$reject.$call(undefined, error); + closedPromiseCapability.reject.$call(undefined, error); $markPromiseAsHandled(closedPromise); } export function writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { let readyPromiseCapability = $getByIdDirectPrivate(writer, "readyPromise"); - let readyPromise = readyPromiseCapability.$promise; + let readyPromise = readyPromiseCapability.promise; if (($getPromiseInternalField(readyPromise, $promiseFieldFlags) & $promiseStateMask) !== $promiseStatePending) { readyPromiseCapability = $newPromiseCapability(Promise); - readyPromise = readyPromiseCapability.$promise; + readyPromise = readyPromiseCapability.promise; $putByIdDirectPrivate(writer, "readyPromise", readyPromiseCapability); } - readyPromiseCapability.$reject.$call(undefined, error); + readyPromiseCapability.reject.$call(undefined, error); $markPromiseAsHandled(readyPromise); } diff --git a/src/js/builtins/codegen/replacements.ts b/src/js/builtins/codegen/replacements.ts index 05c81b901..87157a587 100644 --- a/src/js/builtins/codegen/replacements.ts +++ b/src/js/builtins/codegen/replacements.ts @@ -45,7 +45,6 @@ export const globalsToPrefix = [ "WritableStreamDefaultController", "WritableStreamDefaultWriter", "isFinite", - "isNaN", "undefined", ]; diff --git a/src/js/out/WebCoreJSBuiltins.cpp b/src/js/out/WebCoreJSBuiltins.cpp index 395d2d8bd..76a242bf7 100644 --- a/src/js/out/WebCoreJSBuiltins.cpp +++ b/src/js/out/WebCoreJSBuiltins.cpp @@ -16,7 +16,7 @@ const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind = const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; const int s_bundlerPluginRunSetupFunctionCodeLength = 2165; static const JSC::Intrinsic s_bundlerPluginRunSetupFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunSetupFunctionCode = "(function (J,_){\"use strict\";var D=new Map,F=new Map;function H(q,h,E){if(!q||!@isObject(q))@throwTypeError('Expected an object with \"filter\" RegExp');if(!h||!@isCallable(h))@throwTypeError(\"callback must be a function\");var{filter:w,namespace:z=\"file\"}=q;if(!w)@throwTypeError('Expected an object with \"filter\" RegExp');if(!@isRegExpObject(w))@throwTypeError(\"filter must be a RegExp\");if(z&&typeof z!==\"string\")@throwTypeError(\"namespace must be a string\");if((z\?.length\?\?0)===0)z=\"file\";if(!/^([/@a-zA-Z0-9_\\\\-]+)$/.test(z))@throwTypeError(\"namespace can only contain $a-zA-Z0-9_\\\\-\");var A=E.@get(z);if(!A)E.@set(z,[[w,h]]);else @arrayPush(A,[w,h])}function K(q,h){H(q,h,D)}function M(q,h){H(q,h,F)}const I=()=>{var q=!1,h=!1;for(var[E,w]of D.entries())for(var[z]of w)this.addFilter(z,E,1),q=!0;for(var[E,w]of F.entries())for(var[z]of w)this.addFilter(z,E,0),h=!0;if(h){var A=this.onResolve;if(!A)this.onResolve=F;else for(var[E,w]of F.entries()){var C=A.@get(E);if(!C)A.@set(E,w);else A.@set(E,C.concat(w))}}if(q){var G=this.onLoad;if(!G)this.onLoad=D;else for(var[E,w]of D.entries()){var C=G.@get(E);if(!C)G.@set(E,w);else G.@set(E,C.concat(w))}}return q||h};var B=J({config:_,onDispose:()=>@throwTypeError(`@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1`),onEnd:()=>@throwTypeError(`@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1`),onLoad:K,onResolve:M,onStart:()=>@throwTypeError(`@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1`),resolve:()=>@throwTypeError(`@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1`),initialOptions:{..._,bundle:!0,entryPoints:_.entrypoints\?\?_.entryPoints\?\?[],minify:typeof _.minify===\"boolean\"\?_.minify:!1,minifyIdentifiers:_.minify===!0||_.minify\?.identifiers,minifyWhitespace:_.minify===!0||_.minify\?.whitespace,minifySyntax:_.minify===!0||_.minify\?.syntax,outbase:_.root,platform:_.target===\"bun\"\?\"node\":_.target},esbuild:{}});if(B&&@isPromise(B))if(@getPromiseInternalField(B,@promiseFieldFlags)&@promiseStateFulfilled)B=@getPromiseInternalField(B,@promiseFieldReactionsOrResult);else return B.@then(I);return I()})\n"; +const char* const s_bundlerPluginRunSetupFunctionCode = "(function (J,_){\"use strict\";var D=new Map,F=new Map;function H(q,h,E){if(!q||!@isObject(q))@throwTypeError('Expected an object with \"filter\" RegExp');if(!h||!@isCallable(h))@throwTypeError(\"callback must be a function\");var{filter:w,namespace:z=\"file\"}=q;if(!w)@throwTypeError('Expected an object with \"filter\" RegExp');if(!@isRegExpObject(w))@throwTypeError(\"filter must be a RegExp\");if(z&&typeof z!==\"string\")@throwTypeError(\"namespace must be a string\");if((z\?.length\?\?0)===0)z=\"file\";if(!/^([/@a-zA-Z0-9_\\\\-]+)$/.test(z))@throwTypeError(\"namespace can only contain $a-zA-Z0-9_\\\\-\");var A=E.@get(z);if(!A)E.@set(z,[[w,h]]);else @arrayPush(A,[w,h])}function K(q,h){H(q,h,D)}function M(q,h){H(q,h,F)}const I=()=>{var q=!1,h=!1;for(var[E,w]of D.entries())for(var[z]of w)this.addFilter(z,E,1),q=!0;for(var[E,w]of F.entries())for(var[z]of w)this.addFilter(z,E,0),h=!0;if(h){var A=this.onResolve;if(!A)this.onResolve=F;else for(var[E,w]of F.entries()){var C=A.@get(E);if(!C)A.@set(E,w);else A.@set(E,C.concat(w))}}if(q){var G=this.onLoad;if(!G)this.onLoad=D;else for(var[E,w]of D.entries()){var C=G.@get(E);if(!C)G.@set(E,w);else G.@set(E,C.concat(w))}}return q||h};var B=J({config:_,onDispose:()=>@throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),onEnd:()=>@throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),onLoad:K,onResolve:M,onStart:()=>@throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),resolve:()=>@throwTypeError(\"@{@2} is not implemented yet. See https://github.com/oven-sh/bun/issues/@1\"),initialOptions:{..._,bundle:!0,entryPoints:_.entrypoints\?\?_.entryPoints\?\?[],minify:typeof _.minify===\"boolean\"\?_.minify:!1,minifyIdentifiers:_.minify===!0||_.minify\?.identifiers,minifyWhitespace:_.minify===!0||_.minify\?.whitespace,minifySyntax:_.minify===!0||_.minify\?.syntax,outbase:_.root,platform:_.target===\"bun\"\?\"node\":_.target},esbuild:{}});if(B&&@isPromise(B))if(@getPromiseInternalField(B,@promiseFieldFlags)&@promiseStateFulfilled)B=@getPromiseInternalField(B,@promiseFieldReactionsOrResult);else return B.@then(I);return I()})\n"; // runOnResolvePlugins const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -106,9 +106,9 @@ const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCod const JSC::ConstructAbility s_writableStreamInternalsCreateWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsCreateWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsCreateWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsCreateWritableStreamCodeLength = 278; +const int s_writableStreamInternalsCreateWritableStreamCodeLength = 273; static const JSC::Intrinsic s_writableStreamInternalsCreateWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsCreateWritableStreamCode = "(function (p,N,_,f,u,j){\"use strict\";@assert(typeof u===\"number\"&&!@isNaN(u)&&u>=0);const d={};@initializeWritableStreamSlots(d,{});const q=new @WritableStreamDefaultController;return @setUpWritableStreamDefaultController(d,q,p,N,_,f,u,j),@createWritableStreamFromInternal(d)})\n"; +const char* const s_writableStreamInternalsCreateWritableStreamCode = "(function (j,p,q,u,d,v){\"use strict\";@assert(typeof d===\"number\"&&d===d&&d>=0);const f={};@initializeWritableStreamSlots(f,{});const x=new @WritableStreamDefaultController;return @setUpWritableStreamDefaultController(f,x,j,p,q,u,d,v),@createWritableStreamFromInternal(f)})\n"; // createInternalWritableStreamFromUnderlyingSink const JSC::ConstructAbility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -154,33 +154,33 @@ const char* const s_writableStreamInternalsIsWritableStreamLockedCode = "(functi const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 887; +const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 878; static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode = "(function (g,n){\"use strict\";if(@isWritableStreamLocked(n))@throwTypeError(\"WritableStream is locked\");@putByIdDirectPrivate(g,\"stream\",n),@putByIdDirectPrivate(n,\"writer\",g);const v=@newPromiseCapability(@Promise),h=@newPromiseCapability(@Promise);@putByIdDirectPrivate(g,\"readyPromise\",v),@putByIdDirectPrivate(g,\"closedPromise\",h);const B=@getByIdDirectPrivate(n,\"state\");if(B===\"writable\"){if(@writableStreamCloseQueuedOrInFlight(n)||!@getByIdDirectPrivate(n,\"backpressure\"))v.@resolve.@call()}else if(B===\"erroring\")v.@reject.@call(@undefined,@getByIdDirectPrivate(n,\"storedError\")),@markPromiseAsHandled(v.@promise);else if(B===\"closed\")v.@resolve.@call(),h.@resolve.@call();else{@assert(B===\"errored\");const _=@getByIdDirectPrivate(n,\"storedError\");v.@reject.@call(@undefined,_),@markPromiseAsHandled(v.@promise),h.@reject.@call(@undefined,_),@markPromiseAsHandled(h.@promise)}})\n"; +const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode = "(function (g,n){\"use strict\";if(@isWritableStreamLocked(n))@throwTypeError(\"WritableStream is locked\");@putByIdDirectPrivate(g,\"stream\",n),@putByIdDirectPrivate(n,\"writer\",g);const B=@newPromiseCapability(@Promise),h=@newPromiseCapability(@Promise);@putByIdDirectPrivate(g,\"readyPromise\",B),@putByIdDirectPrivate(g,\"closedPromise\",h);const k=@getByIdDirectPrivate(n,\"state\");if(k===\"writable\"){if(@writableStreamCloseQueuedOrInFlight(n)||!@getByIdDirectPrivate(n,\"backpressure\"))B.resolve.@call()}else if(k===\"erroring\")B.reject.@call(@undefined,@getByIdDirectPrivate(n,\"storedError\")),@markPromiseAsHandled(B.promise);else if(k===\"closed\")B.resolve.@call(),h.resolve.@call();else{@assert(k===\"errored\");const u=@getByIdDirectPrivate(n,\"storedError\");B.reject.@call(@undefined,u),@markPromiseAsHandled(B.promise),h.reject.@call(@undefined,u),@markPromiseAsHandled(h.promise)}})\n"; // writableStreamAbort const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAbortCodeLength = 501; +const int s_writableStreamInternalsWritableStreamAbortCodeLength = 499; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAbortCode = "(function (h,B){\"use strict\";const c=@getByIdDirectPrivate(h,\"state\");if(c===\"closed\"||c===\"errored\")return @Promise.@resolve();const f=@getByIdDirectPrivate(h,\"pendingAbortRequest\");if(f!==@undefined)return f.promise.@promise;@assert(c===\"writable\"||c===\"erroring\");let _=!1;if(c===\"erroring\")_=!0,B=@undefined;const j=@newPromiseCapability(@Promise);if(@putByIdDirectPrivate(h,\"pendingAbortRequest\",{promise:j,reason:B,wasAlreadyErroring:_}),!_)@writableStreamStartErroring(h,B);return j.@promise})\n"; +const char* const s_writableStreamInternalsWritableStreamAbortCode = "(function (h,B){\"use strict\";const c=@getByIdDirectPrivate(h,\"state\");if(c===\"closed\"||c===\"errored\")return @Promise.@resolve();const f=@getByIdDirectPrivate(h,\"pendingAbortRequest\");if(f!==@undefined)return f.promise.promise;@assert(c===\"writable\"||c===\"erroring\");let _=!1;if(c===\"erroring\")_=!0,B=@undefined;const j=@newPromiseCapability(@Promise);if(@putByIdDirectPrivate(h,\"pendingAbortRequest\",{promise:j,reason:B,wasAlreadyErroring:_}),!_)@writableStreamStartErroring(h,B);return j.promise})\n"; // writableStreamClose const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseCodeLength = 642; +const int s_writableStreamInternalsWritableStreamCloseCodeLength = 640; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseCode = "(function (n){\"use strict\";const _=@getByIdDirectPrivate(n,\"state\");if(_===\"closed\"||_===\"errored\")return @Promise.@reject(@makeTypeError(\"Cannot close a writable stream that is closed or errored\"));@assert(_===\"writable\"||_===\"erroring\"),@assert(!@writableStreamCloseQueuedOrInFlight(n));const u=@newPromiseCapability(@Promise);@putByIdDirectPrivate(n,\"closeRequest\",u);const d=@getByIdDirectPrivate(n,\"writer\");if(d!==@undefined&&@getByIdDirectPrivate(n,\"backpressure\")&&_===\"writable\")@getByIdDirectPrivate(d,\"readyPromise\").@resolve.@call();return @writableStreamDefaultControllerClose(@getByIdDirectPrivate(n,\"controller\")),u.@promise})\n"; +const char* const s_writableStreamInternalsWritableStreamCloseCode = "(function (n){\"use strict\";const _=@getByIdDirectPrivate(n,\"state\");if(_===\"closed\"||_===\"errored\")return @Promise.@reject(@makeTypeError(\"Cannot close a writable stream that is closed or errored\"));@assert(_===\"writable\"||_===\"erroring\"),@assert(!@writableStreamCloseQueuedOrInFlight(n));const d=@newPromiseCapability(@Promise);@putByIdDirectPrivate(n,\"closeRequest\",d);const h=@getByIdDirectPrivate(n,\"writer\");if(h!==@undefined&&@getByIdDirectPrivate(n,\"backpressure\")&&_===\"writable\")@getByIdDirectPrivate(h,\"readyPromise\").resolve.@call();return @writableStreamDefaultControllerClose(@getByIdDirectPrivate(n,\"controller\")),d.promise})\n"; // writableStreamAddWriteRequest const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAddWriteRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 227; +const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 226; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAddWriteRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode = "(function (c){\"use strict\";@assert(@isWritableStreamLocked(c)),@assert(@getByIdDirectPrivate(c,\"state\")===\"writable\");const d=@newPromiseCapability(@Promise);return @getByIdDirectPrivate(c,\"writeRequests\").push(d),d.@promise})\n"; +const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode = "(function (c){\"use strict\";@assert(@isWritableStreamLocked(c)),@assert(@getByIdDirectPrivate(c,\"state\")===\"writable\");const _=@newPromiseCapability(@Promise);return @getByIdDirectPrivate(c,\"writeRequests\").push(_),_.promise})\n"; // writableStreamCloseQueuedOrInFlight const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -202,41 +202,41 @@ const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode = const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishErroringCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1058; +const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1054; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishErroringCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishErroringCode = "(function (i){\"use strict\";@assert(@getByIdDirectPrivate(i,\"state\")===\"erroring\"),@assert(!@writableStreamHasOperationMarkedInFlight(i)),@putByIdDirectPrivate(i,\"state\",\"errored\");const h=@getByIdDirectPrivate(i,\"controller\");@getByIdDirectPrivate(h,\"errorSteps\").@call();const A=@getByIdDirectPrivate(i,\"storedError\"),B=@getByIdDirectPrivate(i,\"writeRequests\");for(var p=B.shift();p;p=B.shift())p.@reject.@call(@undefined,A);@putByIdDirectPrivate(i,\"writeRequests\",@createFIFO());const _=@getByIdDirectPrivate(i,\"pendingAbortRequest\");if(_===@undefined){@writableStreamRejectCloseAndClosedPromiseIfNeeded(i);return}if(@putByIdDirectPrivate(i,\"pendingAbortRequest\",@undefined),_.wasAlreadyErroring){_.promise.@reject.@call(@undefined,A),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i);return}@getByIdDirectPrivate(h,\"abortSteps\").@call(@undefined,_.reason).@then(()=>{_.promise.@resolve.@call(),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i)},(I)=>{_.promise.@reject.@call(@undefined,I),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i)})})\n"; +const char* const s_writableStreamInternalsWritableStreamFinishErroringCode = "(function (i){\"use strict\";@assert(@getByIdDirectPrivate(i,\"state\")===\"erroring\"),@assert(!@writableStreamHasOperationMarkedInFlight(i)),@putByIdDirectPrivate(i,\"state\",\"errored\");const d=@getByIdDirectPrivate(i,\"controller\");@getByIdDirectPrivate(d,\"errorSteps\").@call();const h=@getByIdDirectPrivate(i,\"storedError\"),j=@getByIdDirectPrivate(i,\"writeRequests\");for(var f=j.shift();f;f=j.shift())f.reject.@call(@undefined,h);@putByIdDirectPrivate(i,\"writeRequests\",@createFIFO());const _=@getByIdDirectPrivate(i,\"pendingAbortRequest\");if(_===@undefined){@writableStreamRejectCloseAndClosedPromiseIfNeeded(i);return}if(@putByIdDirectPrivate(i,\"pendingAbortRequest\",@undefined),_.wasAlreadyErroring){_.promise.reject.@call(@undefined,h),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i);return}@getByIdDirectPrivate(d,\"abortSteps\").@call(@undefined,_.reason).@then(()=>{_.promise.resolve.@call(),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i)},(v)=>{_.promise.reject.@call(@undefined,v),@writableStreamRejectCloseAndClosedPromiseIfNeeded(i)})})\n"; // writableStreamFinishInFlightClose const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 751; +const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 748; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode = "(function (d){\"use strict\";@getByIdDirectPrivate(d,\"inFlightCloseRequest\").@resolve.@call(),@putByIdDirectPrivate(d,\"inFlightCloseRequest\",@undefined);const i=@getByIdDirectPrivate(d,\"state\");if(@assert(i===\"writable\"||i===\"erroring\"),i===\"erroring\"){@putByIdDirectPrivate(d,\"storedError\",@undefined);const _=@getByIdDirectPrivate(d,\"pendingAbortRequest\");if(_!==@undefined)_.promise.@resolve.@call(),@putByIdDirectPrivate(d,\"pendingAbortRequest\",@undefined)}@putByIdDirectPrivate(d,\"state\",\"closed\");const n=@getByIdDirectPrivate(d,\"writer\");if(n!==@undefined)@getByIdDirectPrivate(n,\"closedPromise\").@resolve.@call();@assert(@getByIdDirectPrivate(d,\"pendingAbortRequest\")===@undefined),@assert(@getByIdDirectPrivate(d,\"storedError\")===@undefined)})\n"; +const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode = "(function (_){\"use strict\";@getByIdDirectPrivate(_,\"inFlightCloseRequest\").resolve.@call(),@putByIdDirectPrivate(_,\"inFlightCloseRequest\",@undefined);const d=@getByIdDirectPrivate(_,\"state\");if(@assert(d===\"writable\"||d===\"erroring\"),d===\"erroring\"){@putByIdDirectPrivate(_,\"storedError\",@undefined);const n=@getByIdDirectPrivate(_,\"pendingAbortRequest\");if(n!==@undefined)n.promise.resolve.@call(),@putByIdDirectPrivate(_,\"pendingAbortRequest\",@undefined)}@putByIdDirectPrivate(_,\"state\",\"closed\");const i=@getByIdDirectPrivate(_,\"writer\");if(i!==@undefined)@getByIdDirectPrivate(i,\"closedPromise\").resolve.@call();@assert(@getByIdDirectPrivate(_,\"pendingAbortRequest\")===@undefined),@assert(@getByIdDirectPrivate(_,\"storedError\")===@undefined)})\n"; // writableStreamFinishInFlightCloseWithError const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 488; +const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 486; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode = "(function (_,c){\"use strict\";const d=@getByIdDirectPrivate(_,\"inFlightCloseRequest\");@assert(d!==@undefined),d.@reject.@call(@undefined,c),@putByIdDirectPrivate(_,\"inFlightCloseRequest\",@undefined);const n=@getByIdDirectPrivate(_,\"state\");@assert(n===\"writable\"||n===\"erroring\");const p=@getByIdDirectPrivate(_,\"pendingAbortRequest\");if(p!==@undefined)p.promise.@reject.@call(@undefined,c),@putByIdDirectPrivate(_,\"pendingAbortRequest\",@undefined);@writableStreamDealWithRejection(_,c)})\n"; +const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode = "(function (c,d){\"use strict\";const p=@getByIdDirectPrivate(c,\"inFlightCloseRequest\");@assert(p!==@undefined),p.reject.@call(@undefined,d),@putByIdDirectPrivate(c,\"inFlightCloseRequest\",@undefined);const _=@getByIdDirectPrivate(c,\"state\");@assert(_===\"writable\"||_===\"erroring\");const f=@getByIdDirectPrivate(c,\"pendingAbortRequest\");if(f!==@undefined)f.promise.reject.@call(@undefined,d),@putByIdDirectPrivate(c,\"pendingAbortRequest\",@undefined);@writableStreamDealWithRejection(c,d)})\n"; // writableStreamFinishInFlightWrite const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 187; +const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 186; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode = "(function (d){\"use strict\";const c=@getByIdDirectPrivate(d,\"inFlightWriteRequest\");@assert(c!==@undefined),c.@resolve.@call(),@putByIdDirectPrivate(d,\"inFlightWriteRequest\",@undefined)})\n"; +const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode = "(function (d){\"use strict\";const b=@getByIdDirectPrivate(d,\"inFlightWriteRequest\");@assert(b!==@undefined),b.resolve.@call(),@putByIdDirectPrivate(d,\"inFlightWriteRequest\",@undefined)})\n"; // writableStreamFinishInFlightWriteWithError const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 319; +const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 318; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode = "(function (_,c){\"use strict\";const d=@getByIdDirectPrivate(_,\"inFlightWriteRequest\");@assert(d!==@undefined),d.@reject.@call(@undefined,c),@putByIdDirectPrivate(_,\"inFlightWriteRequest\",@undefined);const p=@getByIdDirectPrivate(_,\"state\");@assert(p===\"writable\"||p===\"erroring\"),@writableStreamDealWithRejection(_,c)})\n"; +const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode = "(function (c,b){\"use strict\";const d=@getByIdDirectPrivate(c,\"inFlightWriteRequest\");@assert(d!==@undefined),d.reject.@call(@undefined,b),@putByIdDirectPrivate(c,\"inFlightWriteRequest\",@undefined);const f=@getByIdDirectPrivate(c,\"state\");@assert(f===\"writable\"||f===\"erroring\"),@writableStreamDealWithRejection(c,b)})\n"; // writableStreamHasOperationMarkedInFlight const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -266,9 +266,9 @@ const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestIn const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 516; +const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 513; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode = "(function (i){\"use strict\";@assert(@getByIdDirectPrivate(i,\"state\")===\"errored\");const h=@getByIdDirectPrivate(i,\"storedError\"),n=@getByIdDirectPrivate(i,\"closeRequest\");if(n!==@undefined)@assert(@getByIdDirectPrivate(i,\"inFlightCloseRequest\")===@undefined),n.@reject.@call(@undefined,h),@putByIdDirectPrivate(i,\"closeRequest\",@undefined);const B=@getByIdDirectPrivate(i,\"writer\");if(B!==@undefined){const b=@getByIdDirectPrivate(B,\"closedPromise\");b.@reject.@call(@undefined,h),@markPromiseAsHandled(b.@promise)}})\n"; +const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode = "(function (n){\"use strict\";@assert(@getByIdDirectPrivate(n,\"state\")===\"errored\");const _=@getByIdDirectPrivate(n,\"storedError\"),h=@getByIdDirectPrivate(n,\"closeRequest\");if(h!==@undefined)@assert(@getByIdDirectPrivate(n,\"inFlightCloseRequest\")===@undefined),h.reject.@call(@undefined,_),@putByIdDirectPrivate(n,\"closeRequest\",@undefined);const i=@getByIdDirectPrivate(n,\"writer\");if(i!==@undefined){const p=@getByIdDirectPrivate(i,\"closedPromise\");p.reject.@call(@undefined,_),@markPromiseAsHandled(p.promise)}})\n"; // writableStreamStartErroring const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -282,9 +282,9 @@ const char* const s_writableStreamInternalsWritableStreamStartErroringCode = "(f const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 422; +const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 421; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamUpdateBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode = "(function (n,d){\"use strict\";@assert(@getByIdDirectPrivate(n,\"state\")===\"writable\"),@assert(!@writableStreamCloseQueuedOrInFlight(n));const h=@getByIdDirectPrivate(n,\"writer\");if(h!==@undefined&&d!==@getByIdDirectPrivate(n,\"backpressure\"))if(d)@putByIdDirectPrivate(h,\"readyPromise\",@newPromiseCapability(@Promise));else @getByIdDirectPrivate(h,\"readyPromise\").@resolve.@call();@putByIdDirectPrivate(n,\"backpressure\",d)})\n"; +const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode = "(function (n,_){\"use strict\";@assert(@getByIdDirectPrivate(n,\"state\")===\"writable\"),@assert(!@writableStreamCloseQueuedOrInFlight(n));const d=@getByIdDirectPrivate(n,\"writer\");if(d!==@undefined&&_!==@getByIdDirectPrivate(n,\"backpressure\"))if(_)@putByIdDirectPrivate(d,\"readyPromise\",@newPromiseCapability(@Promise));else @getByIdDirectPrivate(d,\"readyPromise\").resolve.@call();@putByIdDirectPrivate(n,\"backpressure\",_)})\n"; // writableStreamDefaultWriterAbort const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -314,17 +314,17 @@ const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithE const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 329; +const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 326; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode = "(function (h,u){\"use strict\";let _=@getByIdDirectPrivate(h,\"closedPromise\"),n=_.@promise;if((@getPromiseInternalField(n,@promiseFieldFlags)&@promiseStateMask)!==@promiseStatePending)_=@newPromiseCapability(@Promise),n=_.@promise,@putByIdDirectPrivate(h,\"closedPromise\",_);_.@reject.@call(@undefined,u),@markPromiseAsHandled(n)})\n"; +const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode = "(function (h,n){\"use strict\";let _=@getByIdDirectPrivate(h,\"closedPromise\"),f=_.promise;if((@getPromiseInternalField(f,@promiseFieldFlags)&@promiseStateMask)!==@promiseStatePending)_=@newPromiseCapability(@Promise),f=_.promise,@putByIdDirectPrivate(h,\"closedPromise\",_);_.reject.@call(@undefined,n),@markPromiseAsHandled(f)})\n"; // writableStreamDefaultWriterEnsureReadyPromiseRejected const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 327; +const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 324; static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode = "(function (h,n){\"use strict\";let c=@getByIdDirectPrivate(h,\"readyPromise\"),g=c.@promise;if((@getPromiseInternalField(g,@promiseFieldFlags)&@promiseStateMask)!==@promiseStatePending)c=@newPromiseCapability(@Promise),g=c.@promise,@putByIdDirectPrivate(h,\"readyPromise\",c);c.@reject.@call(@undefined,n),@markPromiseAsHandled(g)})\n"; +const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode = "(function (h,n){\"use strict\";let _=@getByIdDirectPrivate(h,\"readyPromise\"),g=_.promise;if((@getPromiseInternalField(g,@promiseFieldFlags)&@promiseStateMask)!==@promiseStatePending)_=@newPromiseCapability(@Promise),g=_.promise,@putByIdDirectPrivate(h,\"readyPromise\",_);_.reject.@call(@undefined,n),@markPromiseAsHandled(g)})\n"; // writableStreamDefaultWriterGetDesiredSize const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -500,9 +500,9 @@ const char* const s_transformStreamInternalsIsTransformStreamDefaultControllerCo const JSC::ConstructAbility s_transformStreamInternalsCreateTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsCreateTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsCreateTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsCreateTransformStreamCodeLength = 513; +const int s_transformStreamInternalsCreateTransformStreamCodeLength = 510; static const JSC::Intrinsic s_transformStreamInternalsCreateTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsCreateTransformStreamCode = "(function (D,E,F,_,j,c,q){\"use strict\";if(_===@undefined)_=1;if(j===@undefined)j=()=>1;if(c===@undefined)c=0;if(q===@undefined)q=()=>1;@assert(_>=0),@assert(c>=0);const B={};@putByIdDirectPrivate(B,\"TransformStream\",!0);const v=new @TransformStream(B),x=@newPromiseCapability(@Promise);@initializeTransformStream(v,x.@promise,_,j,c,q);const G=new @TransformStreamDefaultController;return @setUpTransformStreamDefaultController(v,G,E,F),D().@then(()=>{x.@resolve.@call()},(I)=>{x.@reject.@call(@undefined,I)}),v})\n"; +const char* const s_transformStreamInternalsCreateTransformStreamCode = "(function (D,E,F,_,j,c,q){\"use strict\";if(_===@undefined)_=1;if(j===@undefined)j=()=>1;if(c===@undefined)c=0;if(q===@undefined)q=()=>1;@assert(_>=0),@assert(c>=0);const B={};@putByIdDirectPrivate(B,\"TransformStream\",!0);const v=new @TransformStream(B),x=@newPromiseCapability(@Promise);@initializeTransformStream(v,x.promise,_,j,c,q);const G=new @TransformStreamDefaultController;return @setUpTransformStreamDefaultController(v,G,E,F),D().@then(()=>{x.resolve.@call()},(I)=>{x.reject.@call(@undefined,I)}),v})\n"; // initializeTransformStream const JSC::ConstructAbility s_transformStreamInternalsInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -532,9 +532,9 @@ const char* const s_transformStreamInternalsTransformStreamErrorWritableAndUnblo const JSC::ConstructAbility s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamSetBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength = 309; +const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength = 308; static const JSC::Intrinsic s_transformStreamInternalsTransformStreamSetBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode = "(function (_,d){\"use strict\";@assert(@getByIdDirectPrivate(_,\"backpressure\")!==d);const f=@getByIdDirectPrivate(_,\"backpressureChangePromise\");if(f!==@undefined)f.@resolve.@call();@putByIdDirectPrivate(_,\"backpressureChangePromise\",@newPromiseCapability(@Promise)),@putByIdDirectPrivate(_,\"backpressure\",d)})\n"; +const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode = "(function (_,d){\"use strict\";@assert(@getByIdDirectPrivate(_,\"backpressure\")!==d);const i=@getByIdDirectPrivate(_,\"backpressureChangePromise\");if(i!==@undefined)i.resolve.@call();@putByIdDirectPrivate(_,\"backpressureChangePromise\",@newPromiseCapability(@Promise)),@putByIdDirectPrivate(_,\"backpressure\",d)})\n"; // setUpTransformStreamDefaultController const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -580,9 +580,9 @@ const char* const s_transformStreamInternalsTransformStreamDefaultControllerErro const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength = 277; +const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength = 275; static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode = "(function (d,g){\"use strict\";const _=@newPromiseCapability(@Promise);return @getByIdDirectPrivate(d,\"transformAlgorithm\").@call(@undefined,g).@then(()=>{_.@resolve()},(f)=>{@transformStreamError(@getByIdDirectPrivate(d,\"stream\"),f),_.@reject.@call(@undefined,f)}),_.@promise})\n"; +const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode = "(function (d,g){\"use strict\";const _=@newPromiseCapability(@Promise);return @getByIdDirectPrivate(d,\"transformAlgorithm\").@call(@undefined,g).@then(()=>{_.@resolve()},(f)=>{@transformStreamError(@getByIdDirectPrivate(d,\"stream\"),f),_.reject.@call(@undefined,f)}),_.promise})\n"; // transformStreamDefaultControllerTerminate const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -596,9 +596,9 @@ const char* const s_transformStreamInternalsTransformStreamDefaultControllerTerm const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength = 764; +const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength = 759; static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode = "(function (d,j){\"use strict\";const f=@getByIdDirectPrivate(d,\"internalWritable\");@assert(@getByIdDirectPrivate(f,\"state\")===\"writable\");const q=@getByIdDirectPrivate(d,\"controller\");if(@getByIdDirectPrivate(d,\"backpressure\")){const _=@newPromiseCapability(@Promise),x=@getByIdDirectPrivate(d,\"backpressureChangePromise\");return @assert(x!==@undefined),x.@promise.@then(()=>{const v=@getByIdDirectPrivate(f,\"state\");if(v===\"erroring\"){_.@reject.@call(@undefined,@getByIdDirectPrivate(f,\"storedError\"));return}@assert(v===\"writable\"),@transformStreamDefaultControllerPerformTransform(q,j).@then(()=>{_.@resolve()},(z)=>{_.@reject.@call(@undefined,z)})},(v)=>{_.@reject.@call(@undefined,v)}),_.@promise}return @transformStreamDefaultControllerPerformTransform(q,j)})\n"; +const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode = "(function (d,q){\"use strict\";const j=@getByIdDirectPrivate(d,\"internalWritable\");@assert(@getByIdDirectPrivate(j,\"state\")===\"writable\");const v=@getByIdDirectPrivate(d,\"controller\");if(@getByIdDirectPrivate(d,\"backpressure\")){const _=@newPromiseCapability(@Promise),x=@getByIdDirectPrivate(d,\"backpressureChangePromise\");return @assert(x!==@undefined),x.promise.@then(()=>{const f=@getByIdDirectPrivate(j,\"state\");if(f===\"erroring\"){_.reject.@call(@undefined,@getByIdDirectPrivate(j,\"storedError\"));return}@assert(f===\"writable\"),@transformStreamDefaultControllerPerformTransform(v,q).@then(()=>{_.@resolve()},(z)=>{_.reject.@call(@undefined,z)})},(f)=>{_.reject.@call(@undefined,f)}),_.promise}return @transformStreamDefaultControllerPerformTransform(v,q)})\n"; // transformStreamDefaultSinkAbortAlgorithm const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -612,17 +612,17 @@ const char* const s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgor const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength = 789; +const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength = 786; static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode = "(function (f){\"use strict\";const _=@getByIdDirectPrivate(f,\"readable\"),q=@getByIdDirectPrivate(f,\"controller\"),j=@getByIdDirectPrivate(_,\"readableStreamController\"),k=@getByIdDirectPrivate(q,\"flushAlgorithm\");@assert(k!==@undefined);const u=@getByIdDirectPrivate(q,\"flushAlgorithm\").@call();@transformStreamDefaultControllerClearAlgorithms(q);const I=@newPromiseCapability(@Promise);return u.@then(()=>{if(@getByIdDirectPrivate(_,\"state\")===@streamErrored){I.@reject.@call(@undefined,@getByIdDirectPrivate(_,\"storedError\"));return}if(@readableStreamDefaultControllerCanCloseOrEnqueue(j))@readableStreamDefaultControllerClose(j);I.@resolve()},(v)=>{@transformStreamError(@getByIdDirectPrivate(q,\"stream\"),v),I.@reject.@call(@undefined,@getByIdDirectPrivate(_,\"storedError\"))}),I.@promise})\n"; +const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode = "(function (j){\"use strict\";const _=@getByIdDirectPrivate(j,\"readable\"),I=@getByIdDirectPrivate(j,\"controller\"),k=@getByIdDirectPrivate(_,\"readableStreamController\"),q=@getByIdDirectPrivate(I,\"flushAlgorithm\");@assert(q!==@undefined);const u=@getByIdDirectPrivate(I,\"flushAlgorithm\").@call();@transformStreamDefaultControllerClearAlgorithms(I);const S=@newPromiseCapability(@Promise);return u.@then(()=>{if(@getByIdDirectPrivate(_,\"state\")===@streamErrored){S.reject.@call(@undefined,@getByIdDirectPrivate(_,\"storedError\"));return}if(@readableStreamDefaultControllerCanCloseOrEnqueue(k))@readableStreamDefaultControllerClose(k);S.@resolve()},(v)=>{@transformStreamError(@getByIdDirectPrivate(I,\"stream\"),v),S.reject.@call(@undefined,@getByIdDirectPrivate(_,\"storedError\"))}),S.promise})\n"; // transformStreamDefaultSourcePullAlgorithm const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength = 260; +const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength = 259; static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode = "(function (i){\"use strict\";return @assert(@getByIdDirectPrivate(i,\"backpressure\")),@assert(@getByIdDirectPrivate(i,\"backpressureChangePromise\")!==@undefined),@transformStreamSetBackpressure(i,!1),@getByIdDirectPrivate(i,\"backpressureChangePromise\").@promise})\n"; +const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode = "(function (i){\"use strict\";return @assert(@getByIdDirectPrivate(i,\"backpressure\")),@assert(@getByIdDirectPrivate(i,\"backpressureChangePromise\")!==@undefined),@transformStreamSetBackpressure(i,!1),@getByIdDirectPrivate(i,\"backpressureChangePromise\").promise})\n"; #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ @@ -672,9 +672,9 @@ WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) const JSC::ConstructAbility s_transformStreamInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_transformStreamInitializeTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_transformStreamInitializeTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInitializeTransformStreamCodeLength = 1304; +const int s_transformStreamInitializeTransformStreamCodeLength = 1300; static const JSC::Intrinsic s_transformStreamInitializeTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInitializeTransformStreamCode = "(function (){\"use strict\";let _=arguments[0];if(@isObject(_)&&@getByIdDirectPrivate(_,\"TransformStream\"))return this;let j=arguments[1],q=arguments[2];if(_===@undefined)_=null;if(q===@undefined)q={};if(j===@undefined)j={};let u={};if(_!==null){if(\"start\"in _){if(u.start=_.start,typeof u.start!==\"function\")@throwTypeError(\"transformer.start should be a function\")}if(\"transform\"in _){if(u.transform=_.transform,typeof u.transform!==\"function\")@throwTypeError(\"transformer.transform should be a function\")}if(\"flush\"in _){if(u.flush=_.flush,typeof u.flush!==\"function\")@throwTypeError(\"transformer.flush should be a function\")}if(\"readableType\"in _)@throwRangeError(\"TransformStream transformer has a readableType\");if(\"writableType\"in _)@throwRangeError(\"TransformStream transformer has a writableType\")}const x=@extractHighWaterMark(q,0),B=@extractSizeAlgorithm(q),E=@extractHighWaterMark(j,1),F=@extractSizeAlgorithm(j),v=@newPromiseCapability(@Promise);if(@initializeTransformStream(this,v.@promise,E,F,x,B),@setUpTransformStreamDefaultControllerFromTransformer(this,_,u),(\"start\"in u)){const G=@getByIdDirectPrivate(this,\"controller\");(()=>@promiseInvokeOrNoopMethodNoCatch(_,u.start,[G]))().@then(()=>{v.@resolve.@call()},(I)=>{v.@reject.@call(@undefined,I)})}else v.@resolve.@call();return this})\n"; +const char* const s_transformStreamInitializeTransformStreamCode = "(function (){\"use strict\";let _=arguments[0];if(@isObject(_)&&@getByIdDirectPrivate(_,\"TransformStream\"))return this;let u=arguments[1],U=arguments[2];if(_===@undefined)_=null;if(U===@undefined)U={};if(u===@undefined)u={};let j={};if(_!==null){if(\"start\"in _){if(j.start=_.start,typeof j.start!==\"function\")@throwTypeError(\"transformer.start should be a function\")}if(\"transform\"in _){if(j.transform=_.transform,typeof j.transform!==\"function\")@throwTypeError(\"transformer.transform should be a function\")}if(\"flush\"in _){if(j.flush=_.flush,typeof j.flush!==\"function\")@throwTypeError(\"transformer.flush should be a function\")}if(\"readableType\"in _)@throwRangeError(\"TransformStream transformer has a readableType\");if(\"writableType\"in _)@throwRangeError(\"TransformStream transformer has a writableType\")}const v=@extractHighWaterMark(U,0),x=@extractSizeAlgorithm(U),B=@extractHighWaterMark(u,1),E=@extractSizeAlgorithm(u),q=@newPromiseCapability(@Promise);if(@initializeTransformStream(this,q.promise,B,E,v,x),@setUpTransformStreamDefaultControllerFromTransformer(this,_,j),(\"start\"in j)){const F=@getByIdDirectPrivate(this,\"controller\");(()=>@promiseInvokeOrNoopMethodNoCatch(_,j.start,[F]))().@then(()=>{q.resolve.@call()},(G)=>{q.reject.@call(@undefined,G)})}else q.resolve.@call();return this})\n"; // readable const JSC::ConstructAbility s_transformStreamReadableCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1236,9 +1236,9 @@ const char* const s_jsBufferPrototypeToJSONCode = "(function (){\"use strict\";r const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeSliceCodeLength = 260; +const int s_jsBufferPrototypeSliceCodeLength = 256; static const JSC::Intrinsic s_jsBufferPrototypeSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeSliceCode = "(function (w,m){\"use strict\";var{buffer:x,byteOffset:z,byteLength:p}=this;function q(c,k){if(c=@trunc(c),c===0||@isNaN(c))return 0;else if(c<0)return c+=k,c>0\?c:0;else return c<k\?c:k}var i=q(w,p),v=m!==@undefined\?q(m,p):p;return new @Buffer(x,z+i,v>i\?v-i:0)})\n"; +const char* const s_jsBufferPrototypeSliceCode = "(function (v,m){\"use strict\";var{buffer:w,byteOffset:x,byteLength:p}=this;function q(c,k){if(c=@trunc(c),c===0||c!==c)return 0;else if(c<0)return c+=k,c>0\?c:0;else return c<k\?c:k}var i=q(v,p),u=m!==@undefined\?q(m,p):p;return new @Buffer(w,x+i,u>i\?u-i:0)})\n"; // parent const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1362,9 +1362,9 @@ WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength = 585; +const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength = 583; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode = "(function (_,i){\"use strict\";if(@putByIdDirectPrivate(_,\"ownerReadableStream\",i),@putByIdDirectPrivate(i,\"reader\",_),@getByIdDirectPrivate(i,\"state\")===@streamReadable)@putByIdDirectPrivate(_,\"closedPromiseCapability\",@newPromiseCapability(@Promise));else if(@getByIdDirectPrivate(i,\"state\")===@streamClosed)@putByIdDirectPrivate(_,\"closedPromiseCapability\",{@promise:@Promise.@resolve()});else @assert(@getByIdDirectPrivate(i,\"state\")===@streamErrored),@putByIdDirectPrivate(_,\"closedPromiseCapability\",{@promise:@newHandledRejectedPromise(@getByIdDirectPrivate(i,\"storedError\"))})})\n"; +const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode = "(function (l,i){\"use strict\";if(@putByIdDirectPrivate(l,\"ownerReadableStream\",i),@putByIdDirectPrivate(i,\"reader\",l),@getByIdDirectPrivate(i,\"state\")===@streamReadable)@putByIdDirectPrivate(l,\"closedPromiseCapability\",@newPromiseCapability(@Promise));else if(@getByIdDirectPrivate(i,\"state\")===@streamClosed)@putByIdDirectPrivate(l,\"closedPromiseCapability\",{promise:@Promise.@resolve()});else @assert(@getByIdDirectPrivate(i,\"state\")===@streamErrored),@putByIdDirectPrivate(l,\"closedPromiseCapability\",{promise:@newHandledRejectedPromise(@getByIdDirectPrivate(i,\"storedError\"))})})\n"; // privateInitializeReadableStreamDefaultController const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1386,9 +1386,9 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorC const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToCodeLength = 427; +const int s_readableStreamInternalsReadableStreamPipeToCodeLength = 426; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToCode = "(function (g,c){\"use strict\";@assert(@isReadableStream(g));const h=new @ReadableStreamDefaultReader(g);@getByIdDirectPrivate(h,\"closedPromiseCapability\").@promise.@then(()=>{},(_)=>{c.error(_)});function y(){@readableStreamDefaultReaderRead(h).@then(function(_){if(_.done){c.close();return}try{c.enqueue(_.value)}catch(S){c.error(\"ReadableStream chunk enqueueing in the sink failed\");return}y()},function(_){c.error(_)})}y()})\n"; +const char* const s_readableStreamInternalsReadableStreamPipeToCode = "(function (S,y){\"use strict\";@assert(@isReadableStream(S));const _=new @ReadableStreamDefaultReader(S);@getByIdDirectPrivate(_,\"closedPromiseCapability\").promise.@then(()=>{},(h)=>{y.error(h)});function b(){@readableStreamDefaultReaderRead(_).@then(function(h){if(h.done){y.close();return}try{y.enqueue(h.value)}catch(c){y.error(\"ReadableStream chunk enqueueing in the sink failed\");return}b()},function(h){y.error(h)})}b()})\n"; // acquireReadableStreamDefaultReader const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1426,9 +1426,9 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartC const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength = 1631; +const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength = 1625; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode = "(function (f,E,z,B,F,D){\"use strict\";if(@assert(@isReadableStream(f)),@assert(@isWritableStream(E)),@assert(!@isReadableStreamLocked(f)),@assert(!@isWritableStreamLocked(E)),@assert(D===@undefined||@isAbortSignal(D)),@getByIdDirectPrivate(f,\"underlyingByteSource\")!==@undefined)return @Promise.@reject(\"Piping to a readable bytestream is not supported\");let _={source:f,destination:E,preventAbort:B,preventCancel:F,preventClose:z,signal:D};if(_.reader=@acquireReadableStreamDefaultReader(f),_.writer=@acquireWritableStreamDefaultWriter(E),@putByIdDirectPrivate(f,\"disturbed\",!0),_.finalized=!1,_.shuttingDown=!1,_.promiseCapability=@newPromiseCapability(@Promise),_.pendingReadPromiseCapability=@newPromiseCapability(@Promise),_.pendingReadPromiseCapability.@resolve.@call(),_.pendingWritePromise=@Promise.@resolve(),D!==@undefined){const G=(T)=>{if(_.finalized)return;@pipeToShutdownWithAction(_,()=>{const H=!_.preventAbort&&@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"\?@writableStreamAbort(_.destination,T):@Promise.@resolve(),I=!_.preventCancel&&@getByIdDirectPrivate(_.source,\"state\")===@streamReadable\?@readableStreamCancel(_.source,T):@Promise.@resolve();let k=@newPromiseCapability(@Promise),q=!0,w=()=>{if(q){q=!1;return}k.@resolve.@call()},x=(J)=>{k.@reject.@call(@undefined,J)};return H.@then(w,x),I.@then(w,x),k.@promise},T)};if(@whenSignalAborted(D,G))return _.promiseCapability.@promise}return @pipeToErrorsMustBePropagatedForward(_),@pipeToErrorsMustBePropagatedBackward(_),@pipeToClosingMustBePropagatedForward(_),@pipeToClosingMustBePropagatedBackward(_),@pipeToLoop(_),_.promiseCapability.@promise})\n"; +const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode = "(function (E,k,F,G,H,f){\"use strict\";if(@assert(@isReadableStream(E)),@assert(@isWritableStream(k)),@assert(!@isReadableStreamLocked(E)),@assert(!@isWritableStreamLocked(k)),@assert(f===@undefined||@isAbortSignal(f)),@getByIdDirectPrivate(E,\"underlyingByteSource\")!==@undefined)return @Promise.@reject(\"Piping to a readable bytestream is not supported\");let _={source:E,destination:k,preventAbort:G,preventCancel:H,preventClose:F,signal:f};if(_.reader=@acquireReadableStreamDefaultReader(E),_.writer=@acquireWritableStreamDefaultWriter(k),@putByIdDirectPrivate(E,\"disturbed\",!0),_.finalized=!1,_.shuttingDown=!1,_.promiseCapability=@newPromiseCapability(@Promise),_.pendingReadPromiseCapability=@newPromiseCapability(@Promise),_.pendingReadPromiseCapability.resolve.@call(),_.pendingWritePromise=@Promise.@resolve(),f!==@undefined){const I=(q)=>{if(_.finalized)return;@pipeToShutdownWithAction(_,()=>{const J=!_.preventAbort&&@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"\?@writableStreamAbort(_.destination,q):@Promise.@resolve(),K=!_.preventCancel&&@getByIdDirectPrivate(_.source,\"state\")===@streamReadable\?@readableStreamCancel(_.source,q):@Promise.@resolve();let w=@newPromiseCapability(@Promise),x=!0,z=()=>{if(x){x=!1;return}w.resolve.@call()},B=(L)=>{w.reject.@call(@undefined,L)};return J.@then(z,B),K.@then(z,B),w.promise},q)};if(@whenSignalAborted(f,I))return _.promiseCapability.promise}return @pipeToErrorsMustBePropagatedForward(_),@pipeToErrorsMustBePropagatedBackward(_),@pipeToClosingMustBePropagatedForward(_),@pipeToClosingMustBePropagatedBackward(_),@pipeToLoop(_),_.promiseCapability.promise})\n"; // pipeToLoop const JSC::ConstructAbility s_readableStreamInternalsPipeToLoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1442,33 +1442,33 @@ const char* const s_readableStreamInternalsPipeToLoopCode = "(function (c){\"use const JSC::ConstructAbility s_readableStreamInternalsPipeToDoReadWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToDoReadWriteCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToDoReadWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToDoReadWriteCodeLength = 731; +const int s_readableStreamInternalsPipeToDoReadWriteCodeLength = 725; static const JSC::Intrinsic s_readableStreamInternalsPipeToDoReadWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToDoReadWriteCode = "(function (_){\"use strict\";return @assert(!_.shuttingDown),_.pendingReadPromiseCapability=@newPromiseCapability(@Promise),@getByIdDirectPrivate(_.writer,\"readyPromise\").@promise.@then(()=>{if(_.shuttingDown){_.pendingReadPromiseCapability.@resolve.@call(@undefined,!1);return}@readableStreamDefaultReaderRead(_.reader).@then((m)=>{const d=!m.done&&@getByIdDirectPrivate(_.writer,\"stream\")!==@undefined;if(_.pendingReadPromiseCapability.@resolve.@call(@undefined,d),!d)return;_.pendingWritePromise=@writableStreamDefaultWriterWrite(_.writer,m.value)},(m)=>{_.pendingReadPromiseCapability.@resolve.@call(@undefined,!1)})},(m)=>{_.pendingReadPromiseCapability.@resolve.@call(@undefined,!1)}),_.pendingReadPromiseCapability.@promise})\n"; +const char* const s_readableStreamInternalsPipeToDoReadWriteCode = "(function (d){\"use strict\";return @assert(!d.shuttingDown),d.pendingReadPromiseCapability=@newPromiseCapability(@Promise),@getByIdDirectPrivate(d.writer,\"readyPromise\").promise.@then(()=>{if(d.shuttingDown){d.pendingReadPromiseCapability.resolve.@call(@undefined,!1);return}@readableStreamDefaultReaderRead(d.reader).@then((m)=>{const g=!m.done&&@getByIdDirectPrivate(d.writer,\"stream\")!==@undefined;if(d.pendingReadPromiseCapability.resolve.@call(@undefined,g),!g)return;d.pendingWritePromise=@writableStreamDefaultWriterWrite(d.writer,m.value)},(m)=>{d.pendingReadPromiseCapability.resolve.@call(@undefined,!1)})},(m)=>{d.pendingReadPromiseCapability.resolve.@call(@undefined,!1)}),d.pendingReadPromiseCapability.promise})\n"; // pipeToErrorsMustBePropagatedForward const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 438; +const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 436; static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode = "(function (_){\"use strict\";const d=()=>{_.pendingReadPromiseCapability.@resolve.@call(@undefined,!1);const b=@getByIdDirectPrivate(_.source,\"storedError\");if(!_.preventAbort){@pipeToShutdownWithAction(_,()=>@writableStreamAbort(_.destination,b),b);return}@pipeToShutdown(_,b)};if(@getByIdDirectPrivate(_.source,\"state\")===@streamErrored){d();return}@getByIdDirectPrivate(_.reader,\"closedPromiseCapability\").@promise.@then(@undefined,d)})\n"; +const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode = "(function (s){\"use strict\";const _=()=>{s.pendingReadPromiseCapability.resolve.@call(@undefined,!1);const g=@getByIdDirectPrivate(s.source,\"storedError\");if(!s.preventAbort){@pipeToShutdownWithAction(s,()=>@writableStreamAbort(s.destination,g),g);return}@pipeToShutdown(s,g)};if(@getByIdDirectPrivate(s.source,\"state\")===@streamErrored){_();return}@getByIdDirectPrivate(s.reader,\"closedPromiseCapability\").promise.@then(@undefined,_)})\n"; // pipeToErrorsMustBePropagatedBackward const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength = 369; +const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength = 368; static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode = "(function (m){\"use strict\";const y=()=>{const h=@getByIdDirectPrivate(m.destination,\"storedError\");if(!m.preventCancel){@pipeToShutdownWithAction(m,()=>@readableStreamCancel(m.source,h),h);return}@pipeToShutdown(m,h)};if(@getByIdDirectPrivate(m.destination,\"state\")===\"errored\"){y();return}@getByIdDirectPrivate(m.writer,\"closedPromise\").@promise.@then(@undefined,y)})\n"; +const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode = "(function (m){\"use strict\";const h=()=>{const d=@getByIdDirectPrivate(m.destination,\"storedError\");if(!m.preventCancel){@pipeToShutdownWithAction(m,()=>@readableStreamCancel(m.source,d),d);return}@pipeToShutdown(m,d)};if(@getByIdDirectPrivate(m.destination,\"state\")===\"errored\"){h();return}@getByIdDirectPrivate(m.writer,\"closedPromise\").promise.@then(@undefined,h)})\n"; // pipeToClosingMustBePropagatedForward const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 405; +const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 403; static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode = "(function (d){\"use strict\";const m=()=>{if(d.pendingReadPromiseCapability.@resolve.@call(@undefined,!1),!d.preventClose){@pipeToShutdownWithAction(d,()=>@writableStreamDefaultWriterCloseWithErrorPropagation(d.writer));return}@pipeToShutdown(d)};if(@getByIdDirectPrivate(d.source,\"state\")===@streamClosed){m();return}@getByIdDirectPrivate(d.reader,\"closedPromiseCapability\").@promise.@then(m,@undefined)})\n"; +const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode = "(function (_){\"use strict\";const r=()=>{if(_.pendingReadPromiseCapability.resolve.@call(@undefined,!1),!_.preventClose){@pipeToShutdownWithAction(_,()=>@writableStreamDefaultWriterCloseWithErrorPropagation(_.writer));return}@pipeToShutdown(_)};if(@getByIdDirectPrivate(_.source,\"state\")===@streamClosed){r();return}@getByIdDirectPrivate(_.reader,\"closedPromiseCapability\").promise.@then(r,@undefined)})\n"; // pipeToClosingMustBePropagatedBackward const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1482,57 +1482,57 @@ const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackward const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownWithActionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownWithActionCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownWithActionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength = 458; +const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength = 457; static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownWithActionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownWithActionCode = "(function (_,d){\"use strict\";if(_.shuttingDown)return;_.shuttingDown=!0;const g=arguments.length>2,h=arguments[2],m=()=>{d().@then(()=>{if(g)@pipeToFinalize(_,h);else @pipeToFinalize(_)},(j)=>{@pipeToFinalize(_,j)})};if(@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"&&!@writableStreamCloseQueuedOrInFlight(_.destination)){_.pendingReadPromiseCapability.@promise.@then(()=>{_.pendingWritePromise.@then(m,m)},(b)=>@pipeToFinalize(_,b));return}m()})\n"; +const char* const s_readableStreamInternalsPipeToShutdownWithActionCode = "(function (_,u){\"use strict\";if(_.shuttingDown)return;_.shuttingDown=!0;const b=arguments.length>2,g=arguments[2],d=()=>{u().@then(()=>{if(b)@pipeToFinalize(_,g);else @pipeToFinalize(_)},(h)=>{@pipeToFinalize(_,h)})};if(@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"&&!@writableStreamCloseQueuedOrInFlight(_.destination)){_.pendingReadPromiseCapability.promise.@then(()=>{_.pendingWritePromise.@then(d,d)},(m)=>@pipeToFinalize(_,m));return}d()})\n"; // pipeToShutdown const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownCodeLength = 411; +const int s_readableStreamInternalsPipeToShutdownCodeLength = 410; static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownCode = "(function (_){\"use strict\";if(_.shuttingDown)return;_.shuttingDown=!0;const m=arguments.length>1,u=arguments[1],d=()=>{if(m)@pipeToFinalize(_,u);else @pipeToFinalize(_)};if(@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"&&!@writableStreamCloseQueuedOrInFlight(_.destination)){_.pendingReadPromiseCapability.@promise.@then(()=>{_.pendingWritePromise.@then(d,d)},(I)=>@pipeToFinalize(_,I));return}d()})\n"; +const char* const s_readableStreamInternalsPipeToShutdownCode = "(function (_){\"use strict\";if(_.shuttingDown)return;_.shuttingDown=!0;const d=arguments.length>1,m=arguments[1],c=()=>{if(d)@pipeToFinalize(_,m);else @pipeToFinalize(_)};if(@getByIdDirectPrivate(_.destination,\"state\")===\"writable\"&&!@writableStreamCloseQueuedOrInFlight(_.destination)){_.pendingReadPromiseCapability.promise.@then(()=>{_.pendingWritePromise.@then(c,c)},(u)=>@pipeToFinalize(_,u));return}c()})\n"; // pipeToFinalize const JSC::ConstructAbility s_readableStreamInternalsPipeToFinalizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsPipeToFinalizeCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsPipeToFinalizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToFinalizeCodeLength = 259; +const int s_readableStreamInternalsPipeToFinalizeCodeLength = 257; static const JSC::Intrinsic s_readableStreamInternalsPipeToFinalizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToFinalizeCode = "(function (s){\"use strict\";if(@writableStreamDefaultWriterRelease(s.writer),@readableStreamReaderGenericRelease(s.reader),s.finalized=!0,arguments.length>1)s.promiseCapability.@reject.@call(@undefined,arguments[1]);else s.promiseCapability.@resolve.@call()})\n"; +const char* const s_readableStreamInternalsPipeToFinalizeCode = "(function (l){\"use strict\";if(@writableStreamDefaultWriterRelease(l.writer),@readableStreamReaderGenericRelease(l.reader),l.finalized=!0,arguments.length>1)l.promiseCapability.reject.@call(@undefined,arguments[1]);else l.promiseCapability.resolve.@call()})\n"; // readableStreamTee const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeCodeLength = 1104; +const int s_readableStreamInternalsReadableStreamTeeCodeLength = 1102; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeCode = "(function (_,q){\"use strict\";@assert(@isReadableStream(_)),@assert(typeof q===\"boolean\");var v=@getByIdDirectPrivate(_,\"start\");if(v)@putByIdDirectPrivate(_,\"start\",@undefined),v();const w=new @ReadableStreamDefaultReader(_),i={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:@undefined,reason2:@undefined};i.cancelPromiseCapability=@newPromiseCapability(@Promise);const x=@readableStreamTeePullFunction(i,w,q),f={};@putByIdDirectPrivate(f,\"pull\",x),@putByIdDirectPrivate(f,\"cancel\",@readableStreamTeeBranch1CancelFunction(i,_));const g={};@putByIdDirectPrivate(g,\"pull\",x),@putByIdDirectPrivate(g,\"cancel\",@readableStreamTeeBranch2CancelFunction(i,_));const j=new @ReadableStream(f),k=new @ReadableStream(g);return @getByIdDirectPrivate(w,\"closedPromiseCapability\").@promise.@then(@undefined,function(y){if(i.closedOrErrored)return;if(@readableStreamDefaultControllerError(j.@readableStreamController,y),@readableStreamDefaultControllerError(k.@readableStreamController,y),i.closedOrErrored=!0,!i.canceled1||!i.canceled2)i.cancelPromiseCapability.@resolve.@call()}),i.branch1=j,i.branch2=k,[j,k]})\n"; +const char* const s_readableStreamInternalsReadableStreamTeeCode = "(function (i,q){\"use strict\";@assert(@isReadableStream(i)),@assert(typeof q===\"boolean\");var v=@getByIdDirectPrivate(i,\"start\");if(v)@putByIdDirectPrivate(i,\"start\",@undefined),v();const w=new @ReadableStreamDefaultReader(i),_={closedOrErrored:!1,canceled1:!1,canceled2:!1,reason1:@undefined,reason2:@undefined};_.cancelPromiseCapability=@newPromiseCapability(@Promise);const x=@readableStreamTeePullFunction(_,w,q),f={};@putByIdDirectPrivate(f,\"pull\",x),@putByIdDirectPrivate(f,\"cancel\",@readableStreamTeeBranch1CancelFunction(_,i));const g={};@putByIdDirectPrivate(g,\"pull\",x),@putByIdDirectPrivate(g,\"cancel\",@readableStreamTeeBranch2CancelFunction(_,i));const j=new @ReadableStream(f),k=new @ReadableStream(g);return @getByIdDirectPrivate(w,\"closedPromiseCapability\").promise.@then(@undefined,function(y){if(_.closedOrErrored)return;if(@readableStreamDefaultControllerError(j.@readableStreamController,y),@readableStreamDefaultControllerError(k.@readableStreamController,y),_.closedOrErrored=!0,!_.canceled1||!_.canceled2)_.cancelPromiseCapability.resolve.@call()}),_.branch1=j,_.branch2=k,[j,k]})\n"; // readableStreamTeePullFunction const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeePullFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength = 764; +const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength = 763; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeePullFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode = "(function (i,f,m){\"use strict\";return function(){@Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(f),function(_){if(@assert(@isObject(_)),@assert(typeof _.done===\"boolean\"),_.done&&!i.closedOrErrored){if(!i.canceled1)@readableStreamDefaultControllerClose(i.branch1.@readableStreamController);if(!i.canceled2)@readableStreamDefaultControllerClose(i.branch2.@readableStreamController);if(i.closedOrErrored=!0,!i.canceled1||!i.canceled2)i.cancelPromiseCapability.@resolve.@call()}if(i.closedOrErrored)return;if(!i.canceled1)@readableStreamDefaultControllerEnqueue(i.branch1.@readableStreamController,_.value);if(!i.canceled2)@readableStreamDefaultControllerEnqueue(i.branch2.@readableStreamController,m\?@structuredCloneForStream(_.value):_.value)})}})\n"; +const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode = "(function (_,c,f){\"use strict\";return function(){@Promise.prototype.@then.@call(@readableStreamDefaultReaderRead(c),function(i){if(@assert(@isObject(i)),@assert(typeof i.done===\"boolean\"),i.done&&!_.closedOrErrored){if(!_.canceled1)@readableStreamDefaultControllerClose(_.branch1.@readableStreamController);if(!_.canceled2)@readableStreamDefaultControllerClose(_.branch2.@readableStreamController);if(_.closedOrErrored=!0,!_.canceled1||!_.canceled2)_.cancelPromiseCapability.resolve.@call()}if(_.closedOrErrored)return;if(!_.canceled1)@readableStreamDefaultControllerEnqueue(_.branch1.@readableStreamController,i.value);if(!_.canceled2)@readableStreamDefaultControllerEnqueue(_.branch2.@readableStreamController,f\?@structuredCloneForStream(i.value):i.value)})}})\n"; // readableStreamTeeBranch1CancelFunction const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength = 258; +const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength = 257; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode = "(function (c,d){\"use strict\";return function(i){if(c.canceled1=!0,c.reason1=i,c.canceled2)@readableStreamCancel(d,[c.reason1,c.reason2]).@then(c.cancelPromiseCapability.@resolve,c.cancelPromiseCapability.@reject);return c.cancelPromiseCapability.@promise}})\n"; +const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode = "(function (d,i){\"use strict\";return function(n){if(d.canceled1=!0,d.reason1=n,d.canceled2)@readableStreamCancel(i,[d.reason1,d.reason2]).@then(d.cancelPromiseCapability.@resolve,d.cancelPromiseCapability.@reject);return d.cancelPromiseCapability.promise}})\n"; // readableStreamTeeBranch2CancelFunction const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength = 258; +const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength = 257; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode = "(function (c,d){\"use strict\";return function(i){if(c.canceled2=!0,c.reason2=i,c.canceled1)@readableStreamCancel(d,[c.reason1,c.reason2]).@then(c.cancelPromiseCapability.@resolve,c.cancelPromiseCapability.@reject);return c.cancelPromiseCapability.@promise}})\n"; +const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode = "(function (d,i){\"use strict\";return function(n){if(d.canceled2=!0,d.reason2=n,d.canceled1)@readableStreamCancel(i,[d.reason1,d.reason2]).@then(d.cancelPromiseCapability.@resolve,d.cancelPromiseCapability.@reject);return d.cancelPromiseCapability.promise}})\n"; // isReadableStream const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1642,9 +1642,9 @@ const char* const s_readableStreamInternalsOnFlushDirectStreamCode = "(function const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsCreateTextStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsCreateTextStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsCreateTextStreamCodeLength = 984; +const int s_readableStreamInternalsCreateTextStreamCodeLength = 983; static const JSC::Intrinsic s_readableStreamInternalsCreateTextStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsCreateTextStreamCode = "(function (G){\"use strict\";var q,v=[],x=!1,z=!1,j=\"\",C=@toLength(0),F=@newPromiseCapability(@Promise),A=!1;return q={start(){},write(_){if(typeof _===\"string\"){var w=@toLength(_.length);if(w>0)j+=_,x=!0,C+=w;return w}if(!_||!(@ArrayBuffer.@isView(_)||_ instanceof @ArrayBuffer))@throwTypeError(\"Expected text, ArrayBuffer or ArrayBufferView\");const E=@toLength(_.byteLength);if(E>0)if(z=!0,j.length>0)@arrayPush(v,j,_),j=\"\";else @arrayPush(v,_);return C+=E,E},flush(){return 0},end(){if(A)return\"\";return q.fulfill()},fulfill(){A=!0;const _=q.finishInternal();return @fulfillPromise(F.@promise,_),_},finishInternal(){if(!x&&!z)return\"\";if(x&&!z)return j;if(z&&!x)return new globalThis.TextDecoder().decode(@Bun.concatArrayBuffers(v));var _=new @Bun.ArrayBufferSink;_.start({highWaterMark:C,asUint8Array:!0});for(let w of v)_.write(w);if(v.length=0,j.length>0)_.write(j),j=\"\";return new globalThis.TextDecoder().decode(_.end())},close(){try{if(!A)A=!0,q.fulfill()}catch(_){}}},[q,F]})\n"; +const char* const s_readableStreamInternalsCreateTextStreamCode = "(function (G){\"use strict\";var q,v=[],x=!1,z=!1,j=\"\",C=@toLength(0),F=@newPromiseCapability(@Promise),A=!1;return q={start(){},write(_){if(typeof _===\"string\"){var w=@toLength(_.length);if(w>0)j+=_,x=!0,C+=w;return w}if(!_||!(@ArrayBuffer.@isView(_)||_ instanceof @ArrayBuffer))@throwTypeError(\"Expected text, ArrayBuffer or ArrayBufferView\");const E=@toLength(_.byteLength);if(E>0)if(z=!0,j.length>0)@arrayPush(v,j,_),j=\"\";else @arrayPush(v,_);return C+=E,E},flush(){return 0},end(){if(A)return\"\";return q.fulfill()},fulfill(){A=!0;const _=q.finishInternal();return @fulfillPromise(F.promise,_),_},finishInternal(){if(!x&&!z)return\"\";if(x&&!z)return j;if(z&&!x)return new globalThis.TextDecoder().decode(@Bun.concatArrayBuffers(v));var _=new @Bun.ArrayBufferSink;_.start({highWaterMark:C,asUint8Array:!0});for(let w of v)_.write(w);if(v.length=0,j.length>0)_.write(j),j=\"\";return new globalThis.TextDecoder().decode(_.end())},close(){try{if(!A)A=!0,q.fulfill()}catch(_){}}},[q,F]})\n"; // initializeTextStream const JSC::ConstructAbility s_readableStreamInternalsInitializeTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1658,9 +1658,9 @@ const char* const s_readableStreamInternalsInitializeTextStreamCode = "(function const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeArrayStreamCodeLength = 797; +const int s_readableStreamInternalsInitializeArrayStreamCodeLength = 796; static const JSC::Intrinsic s_readableStreamInternalsInitializeArrayStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeArrayStreamCode = "(function (m,v){\"use strict\";var _=[],b=@newPromiseCapability(@Promise),t=!1;function d(){return t=!0,b.@resolve.@call(@undefined,_),_}var j={start(){},write(p){return @arrayPush(_,p),p.byteLength||p.length},flush(){return 0},end(){if(t)return[];return d()},close(){if(!t)d()}},q={@underlyingSource:m,@pull:@onPullDirectStream,@controlledReadableStream:this,@sink:j,close:@onCloseDirectStream,write:j.write,error:@handleDirectStreamError,end:@onCloseDirectStream,@close:@onCloseDirectStream,flush:@onFlushDirectStream,_pendingRead:@undefined,_deferClose:0,_deferFlush:0,_deferCloseReason:@undefined,_handleError:@undefined};return @putByIdDirectPrivate(this,\"readableStreamController\",q),@putByIdDirectPrivate(this,\"underlyingSource\",@undefined),@putByIdDirectPrivate(this,\"start\",@undefined),b})\n"; +const char* const s_readableStreamInternalsInitializeArrayStreamCode = "(function (v,x){\"use strict\";var _=[],b=@newPromiseCapability(@Promise),p=!1;function j(){return p=!0,b.resolve.@call(@undefined,_),_}var q={start(){},write(t){return @arrayPush(_,t),t.byteLength||t.length},flush(){return 0},end(){if(p)return[];return j()},close(){if(!p)j()}},w={@underlyingSource:v,@pull:@onPullDirectStream,@controlledReadableStream:this,@sink:q,close:@onCloseDirectStream,write:q.write,error:@handleDirectStreamError,end:@onCloseDirectStream,@close:@onCloseDirectStream,flush:@onFlushDirectStream,_pendingRead:@undefined,_deferClose:0,_deferFlush:0,_deferCloseReason:@undefined,_handleError:@undefined};return @putByIdDirectPrivate(this,\"readableStreamController\",w),@putByIdDirectPrivate(this,\"underlyingSource\",@undefined),@putByIdDirectPrivate(this,\"start\",@undefined),b})\n"; // initializeArrayBufferStream const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1674,9 +1674,9 @@ const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode = "(f const JSC::ConstructAbility s_readableStreamInternalsReadableStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamErrorCodeLength = 840; +const int s_readableStreamInternalsReadableStreamErrorCodeLength = 838; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamErrorCode = "(function (c,f){\"use strict\";@assert(@isReadableStream(c)),@assert(@getByIdDirectPrivate(c,\"state\")===@streamReadable),@putByIdDirectPrivate(c,\"state\",@streamErrored),@putByIdDirectPrivate(c,\"storedError\",f);const _=@getByIdDirectPrivate(c,\"reader\");if(!_)return;if(@isReadableStreamDefaultReader(_)){const n=@getByIdDirectPrivate(_,\"readRequests\");@putByIdDirectPrivate(_,\"readRequests\",@createFIFO());for(var i=n.shift();i;i=n.shift())@rejectPromise(i,f)}else{@assert(@isReadableStreamBYOBReader(_));const n=@getByIdDirectPrivate(_,\"readIntoRequests\");@putByIdDirectPrivate(_,\"readIntoRequests\",@createFIFO());for(var i=n.shift();i;i=n.shift())@rejectPromise(i,f)}@getByIdDirectPrivate(_,\"closedPromiseCapability\").@reject.@call(@undefined,f);const h=@getByIdDirectPrivate(_,\"closedPromiseCapability\").@promise;@markPromiseAsHandled(h)})\n"; +const char* const s_readableStreamInternalsReadableStreamErrorCode = "(function (n,f){\"use strict\";@assert(@isReadableStream(n)),@assert(@getByIdDirectPrivate(n,\"state\")===@streamReadable),@putByIdDirectPrivate(n,\"state\",@streamErrored),@putByIdDirectPrivate(n,\"storedError\",f);const _=@getByIdDirectPrivate(n,\"reader\");if(!_)return;if(@isReadableStreamDefaultReader(_)){const c=@getByIdDirectPrivate(_,\"readRequests\");@putByIdDirectPrivate(_,\"readRequests\",@createFIFO());for(var i=c.shift();i;i=c.shift())@rejectPromise(i,f)}else{@assert(@isReadableStreamBYOBReader(_));const c=@getByIdDirectPrivate(_,\"readIntoRequests\");@putByIdDirectPrivate(_,\"readIntoRequests\",@createFIFO());for(var i=c.shift();i;i=c.shift())@rejectPromise(i,f)}@getByIdDirectPrivate(_,\"closedPromiseCapability\").reject.@call(@undefined,f);const h=@getByIdDirectPrivate(_,\"closedPromiseCapability\").promise;@markPromiseAsHandled(h)})\n"; // readableStreamDefaultControllerShouldCallPull const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1754,9 +1754,9 @@ const char* const s_readableStreamInternalsReadableStreamDefaultControllerCloseC const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamCloseCodeLength = 617; +const int s_readableStreamInternalsReadableStreamCloseCodeLength = 616; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamCloseCode = "(function (_){\"use strict\";if(@assert(@getByIdDirectPrivate(_,\"state\")===@streamReadable),@putByIdDirectPrivate(_,\"state\",@streamClosed),!@getByIdDirectPrivate(_,\"reader\"))return;if(@isReadableStreamDefaultReader(@getByIdDirectPrivate(_,\"reader\"))){const i=@getByIdDirectPrivate(@getByIdDirectPrivate(_,\"reader\"),\"readRequests\");if(i.isNotEmpty()){@putByIdDirectPrivate(@getByIdDirectPrivate(_,\"reader\"),\"readRequests\",@createFIFO());for(var d=i.shift();d;d=i.shift())@fulfillPromise(d,{value:@undefined,done:!0})}}@getByIdDirectPrivate(@getByIdDirectPrivate(_,\"reader\"),\"closedPromiseCapability\").@resolve.@call()})\n"; +const char* const s_readableStreamInternalsReadableStreamCloseCode = "(function (d){\"use strict\";if(@assert(@getByIdDirectPrivate(d,\"state\")===@streamReadable),@putByIdDirectPrivate(d,\"state\",@streamClosed),!@getByIdDirectPrivate(d,\"reader\"))return;if(@isReadableStreamDefaultReader(@getByIdDirectPrivate(d,\"reader\"))){const _=@getByIdDirectPrivate(@getByIdDirectPrivate(d,\"reader\"),\"readRequests\");if(_.isNotEmpty()){@putByIdDirectPrivate(@getByIdDirectPrivate(d,\"reader\"),\"readRequests\",@createFIFO());for(var i=_.shift();i;i=_.shift())@fulfillPromise(i,{value:@undefined,done:!0})}}@getByIdDirectPrivate(@getByIdDirectPrivate(d,\"reader\"),\"closedPromiseCapability\").resolve.@call()})\n"; // readableStreamFulfillReadRequest const JSC::ConstructAbility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1802,9 +1802,9 @@ const char* const s_readableStreamInternalsIsReadableStreamDisturbedCode = "(fun const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength = 813; +const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength = 810; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode = "(function (_){\"use strict\";if(@assert(!!@getByIdDirectPrivate(_,\"ownerReadableStream\")),@assert(@getByIdDirectPrivate(@getByIdDirectPrivate(_,\"ownerReadableStream\"),\"reader\")===_),@getByIdDirectPrivate(@getByIdDirectPrivate(_,\"ownerReadableStream\"),\"state\")===@streamReadable)@getByIdDirectPrivate(_,\"closedPromiseCapability\").@reject.@call(@undefined,@makeTypeError(\"releasing lock of reader whose stream is still in readable state\"));else @putByIdDirectPrivate(_,\"closedPromiseCapability\",{@promise:@newHandledRejectedPromise(@makeTypeError(\"reader released lock\"))});const c=@getByIdDirectPrivate(_,\"closedPromiseCapability\").@promise;@markPromiseAsHandled(c),@putByIdDirectPrivate(@getByIdDirectPrivate(_,\"ownerReadableStream\"),\"reader\",@undefined),@putByIdDirectPrivate(_,\"ownerReadableStream\",@undefined)})\n"; +const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode = "(function (s){\"use strict\";if(@assert(!!@getByIdDirectPrivate(s,\"ownerReadableStream\")),@assert(@getByIdDirectPrivate(@getByIdDirectPrivate(s,\"ownerReadableStream\"),\"reader\")===s),@getByIdDirectPrivate(@getByIdDirectPrivate(s,\"ownerReadableStream\"),\"state\")===@streamReadable)@getByIdDirectPrivate(s,\"closedPromiseCapability\").reject.@call(@undefined,@makeTypeError(\"releasing lock of reader whose stream is still in readable state\"));else @putByIdDirectPrivate(s,\"closedPromiseCapability\",{promise:@newHandledRejectedPromise(@makeTypeError(\"reader released lock\"))});const t=@getByIdDirectPrivate(s,\"closedPromiseCapability\").promise;@markPromiseAsHandled(t),@putByIdDirectPrivate(@getByIdDirectPrivate(s,\"ownerReadableStream\"),\"reader\",@undefined),@putByIdDirectPrivate(s,\"ownerReadableStream\",@undefined)})\n"; // readableStreamDefaultControllerCanCloseOrEnqueue const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1834,33 +1834,33 @@ const char* const s_readableStreamInternalsReadableStreamIntoArrayCode = "(funct const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoTextCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoTextCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoTextCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamIntoTextCodeLength = 214; +const int s_readableStreamInternalsReadableStreamIntoTextCodeLength = 212; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamIntoTextCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamIntoTextCode = "(function (_){\"use strict\";const[h,d]=@createTextStream(@getByIdDirectPrivate(_,\"highWaterMark\")),i=@readStreamIntoSink(_,h,!1);if(i&&@isPromise(i))return @Promise.@resolve(i).@then(d.@promise);return d.@promise})\n"; +const char* const s_readableStreamInternalsReadableStreamIntoTextCode = "(function (h){\"use strict\";const[_,T]=@createTextStream(@getByIdDirectPrivate(h,\"highWaterMark\")),i=@readStreamIntoSink(h,_,!1);if(i&&@isPromise(i))return @Promise.@resolve(i).@then(T.promise);return T.promise})\n"; // readableStreamToArrayBufferDirect const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength = 727; +const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength = 724; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode = "(function (O,A){\"use strict\";var j=new @Bun.ArrayBufferSink;@putByIdDirectPrivate(O,\"underlyingSource\",@undefined);var B=@getByIdDirectPrivate(O,\"highWaterMark\");j.start(B\?{highWaterMark:B}:{});var w=@newPromiseCapability(@Promise),q=!1,x=A.pull,v=A.close,z={start(){},close(_){if(!q){if(q=!0,v)v();@fulfillPromise(w.@promise,j.end())}},end(){if(!q){if(q=!0,v)v();@fulfillPromise(w.@promise,j.end())}},flush(){return 0},write:j.write.bind(j)},C=!1;try{const _=x(z);if(_&&@isObject(_)&&@isPromise(_))return async function(D,F,G){while(!q)await G(D);return await F}(z,promise,x);return w.@promise}catch(_){return C=!0,@readableStreamError(O,_),@Promise.@reject(_)}finally{if(!C&&O)@readableStreamClose(O);z=v=j=x=O=@undefined}})\n"; +const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode = "(function (j,B){\"use strict\";var q=new @Bun.ArrayBufferSink;@putByIdDirectPrivate(j,\"underlyingSource\",@undefined);var C=@getByIdDirectPrivate(j,\"highWaterMark\");q.start(C\?{highWaterMark:C}:{});var x=@newPromiseCapability(@Promise),v=!1,z=B.pull,w=B.close,A={start(){},close(_){if(!v){if(v=!0,w)w();@fulfillPromise(x.promise,q.end())}},end(){if(!v){if(v=!0,w)w();@fulfillPromise(x.promise,q.end())}},flush(){return 0},write:q.write.bind(q)},D=!1;try{const _=z(A);if(_&&@isObject(_)&&@isPromise(_))return async function(F,G,H){while(!v)await H(F);return await G}(A,promise,z);return x.promise}catch(_){return D=!0,@readableStreamError(j,_),@Promise.@reject(_)}finally{if(!D&&j)@readableStreamClose(j);A=w=q=z=j=@undefined}})\n"; // readableStreamToTextDirect const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToTextDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToTextDirectCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToTextDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength = 278; +const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength = 277; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToTextDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToTextDirectCode = "(async function (_,h){\"use strict\";const j=@initializeTextStream.@call(_,h,@undefined);var f=_.getReader();while(@getByIdDirectPrivate(_,\"state\")===@streamReadable){var k=await f.read();if(k.done)break}try{f.releaseLock()}catch(p){}return f=@undefined,_=@undefined,j.@promise})\n"; +const char* const s_readableStreamInternalsReadableStreamToTextDirectCode = "(async function (f,j){\"use strict\";const k=@initializeTextStream.@call(f,j,@undefined);var h=f.getReader();while(@getByIdDirectPrivate(f,\"state\")===@streamReadable){var q=await h.read();if(q.done)break}try{h.releaseLock()}catch(v){}return h=@undefined,f=@undefined,k.promise})\n"; // readableStreamToArrayDirect const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength = 354; +const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength = 353; static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode = "(async function (f,j){\"use strict\";const p=@initializeArrayStream.@call(f,j,@undefined);j=@undefined;var _=f.getReader();try{while(@getByIdDirectPrivate(f,\"state\")===@streamReadable){var q=await _.read();if(q.done)break}try{_.releaseLock()}catch(k){}return _=@undefined,@Promise.@resolve(p.@promise)}catch(k){throw k}finally{f=@undefined,_=@undefined}})\n"; +const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode = "(async function (_,j){\"use strict\";const q=@initializeArrayStream.@call(_,j,@undefined);j=@undefined;var f=_.getReader();try{while(@getByIdDirectPrivate(_,\"state\")===@streamReadable){var v=await f.read();if(v.done)break}try{f.releaseLock()}catch(k){}return f=@undefined,@Promise.@resolve(q.promise)}catch(k){throw k}finally{_=@undefined,f=@undefined}})\n"; // readableStreamDefineLazyIterators const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -1992,9 +1992,9 @@ const char* const s_readableStreamBYOBReaderReleaseLockCode = "(function (){\"us const JSC::ConstructAbility s_readableStreamBYOBReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamBYOBReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamBYOBReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderClosedCodeLength = 219; +const int s_readableStreamBYOBReaderClosedCodeLength = 218; static const JSC::Intrinsic s_readableStreamBYOBReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderClosedCode = "(function (){\"use strict\";if(!@isReadableStreamBYOBReader(this))return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamBYOBReader\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromiseCapability\").@promise})\n"; +const char* const s_readableStreamBYOBReaderClosedCode = "(function (){\"use strict\";if(!@isReadableStreamBYOBReader(this))return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamBYOBReader\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromiseCapability\").promise})\n"; #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ @@ -2076,9 +2076,9 @@ const char* const s_readableStreamDefaultReaderReleaseLockCode = "(function (){\ const JSC::ConstructAbility s_readableStreamDefaultReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableStreamDefaultReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableStreamDefaultReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderClosedCodeLength = 225; +const int s_readableStreamDefaultReaderClosedCodeLength = 224; static const JSC::Intrinsic s_readableStreamDefaultReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderClosedCode = "(function (){\"use strict\";if(!@isReadableStreamDefaultReader(this))return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamDefaultReader\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromiseCapability\").@promise})\n"; +const char* const s_readableStreamDefaultReaderClosedCode = "(function (){\"use strict\";if(!@isReadableStreamDefaultReader(this))return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamDefaultReader\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromiseCapability\").promise})\n"; #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ @@ -2150,9 +2150,9 @@ const char* const s_streamInternalsPromiseInvokeOrFallbackOrNoopCode = "(functio const JSC::ConstructAbility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength = 263; +const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength = 259; static const JSC::Intrinsic s_streamInternalsValidateAndNormalizeQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode = "(function (d,l){\"use strict\";if(d!==@undefined&&typeof d!==\"function\")@throwTypeError(\"size parameter must be a function\");const f=@toNumber(l);if(@isNaN(f)||f<0)@throwRangeError(\"highWaterMark value is negative or not a number\");return{size:d,highWaterMark:f}})\n"; +const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode = "(function (c,d){\"use strict\";if(c!==@undefined&&typeof c!==\"function\")@throwTypeError(\"size parameter must be a function\");const u=@toNumber(d);if(u!==u||u<0)@throwRangeError(\"highWaterMark value is negative or not a number\");return{size:c,highWaterMark:u}})\n"; // createFIFO const JSC::ConstructAbility s_streamInternalsCreateFIFOCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2214,9 +2214,9 @@ const char* const s_streamInternalsExtractSizeAlgorithmCode = "(function (p){\"u const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractHighWaterMarkCodeLength = 188; +const int s_streamInternalsExtractHighWaterMarkCodeLength = 184; static const JSC::Intrinsic s_streamInternalsExtractHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractHighWaterMarkCode = "(function (b,c){\"use strict\";const o=b.highWaterMark;if(o===@undefined)return c;if(@isNaN(o)||o<0)@throwRangeError(\"highWaterMark value is negative or not a number\");return @toNumber(o)})\n"; +const char* const s_streamInternalsExtractHighWaterMarkCode = "(function (n,p){\"use strict\";const c=n.highWaterMark;if(c===@undefined)return p;if(c!==c||c<0)@throwRangeError(\"highWaterMark value is negative or not a number\");return @toNumber(c)})\n"; // extractHighWaterMarkFromQueuingStrategyInit const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2256,9 +2256,9 @@ WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) const JSC::ConstructAbility s_importMetaObjectLoadCJS2ESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_importMetaObjectLoadCJS2ESMCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_importMetaObjectLoadCJS2ESMCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectLoadCJS2ESMCodeLength = 1387; +const int s_importMetaObjectLoadCJS2ESMCodeLength = 1406; static const JSC::Intrinsic s_importMetaObjectLoadCJS2ESMCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectLoadCJS2ESMCode = "(function (B){\"use strict\";var D=@Loader,H=@createFIFO(),_=B;while(_){var w=D.registry.@get(_);if((w\?.state\?\?0)<=@ModuleFetch)@fulfillModuleSync(_),w=D.registry.@get(_);var W=@getPromiseInternalField(w.fetch,@promiseFieldReactionsOrResult),x=D.parseModule(_,W),z=w.module;if(x&&@isPromise(x)){var J=@getPromiseInternalField(x,@promiseFieldReactionsOrResult),X=@getPromiseInternalField(x,@promiseFieldFlags),Q=X&@promiseStateMask;if(Q===@promiseStatePending||J&&@isPromise(J))@throwTypeError(`require() async module \"${_}\" is unsupported. use \"await import()\" instead.`);else if(Q===@promiseStateRejected){if(!J\?.message)@throwTypeError(`${J+\"\"\?J:\"An error occurred\"} occurred while parsing module \\\"${_}\\\"`);throw J}w.module=z=J}else if(x&&!z)w.module=z=x;@setStateToMax(w,@ModuleLink);var Y=z.dependenciesMap,I=D.requestedModules(z),T=@newArrayWithSize(I.length);for(var F=0,Z=I.length;F<Z;++F){var G=I[F],U=G[0]===\"/\"\?G:D.resolve(G,_),L=D.ensureRegistered(U);if(L.state<@ModuleLink)H.push(U);@putByValDirect(T,F,L),Y.@set(G,L)}w.dependencies=T,w.instantiate=@Promise.resolve(w),w.satisfy=@Promise.resolve(w),_=H.shift();while(_&&(D.registry.@get(_)\?.state\?\?@ModuleFetch)>=@ModuleLink)_=H.shift()}var V=D.linkAndEvaluateModule(B,@undefined);if(V&&@isPromise(V))@throwTypeError(`require() async module \\\"${B}\\\" is unsupported. use \"await import()\" instead.`);return D.registry.@get(B)})\n"; +const char* const s_importMetaObjectLoadCJS2ESMCode = "(function (z){\"use strict\";var J=@Loader,G=@createFIFO(),D=z;while(D){var _=J.registry.@get(D);if((_\?.state\?\?0)<=@ModuleFetch)@fulfillModuleSync(D),_=J.registry.@get(D);var V=@getPromiseInternalField(_.fetch,@promiseFieldReactionsOrResult),w=J.parseModule(D,V),x=_.module;if(w&&@isPromise(w)){var h=@getPromiseInternalField(w,@promiseFieldReactionsOrResult),W=@getPromiseInternalField(w,@promiseFieldFlags),L=W&@promiseStateMask;if(L===@promiseStatePending||h&&@isPromise(h))@throwTypeError(`require() async module \"${D}\" is unsupported. use \"await import()\" instead.`);else if(L===@promiseStateRejected){if(!h\?.message)@throwTypeError(`${h+\"\"\?h:\"An error occurred\"} occurred while parsing module \\\"${D}\\\"`);throw h}_.module=x=h}else if(w&&!x)_.module=x=w;@setStateToMax(_,@ModuleLink);var X=x.dependenciesMap,H=J.requestedModules(x),Q=@newArrayWithSize(H.length);for(var B=0,Y=H.length;B<Y;++B){var F=H[B],T=F[0]===\"/\"\?F:J.resolve(F,D),I=J.ensureRegistered(T);if(I.state<@ModuleLink)G.push(T);@putByValDirect(Q,B,I),X.@set(F,I)}_.dependencies=Q,_.instantiate=@Promise.@resolve(_),_.satisfy=@Promise.@resolve(_),_.isSatisfied=!0,D=G.shift();while(D&&(J.registry.@get(D)\?.state\?\?@ModuleFetch)>=@ModuleLink)D=G.shift()}var U=J.linkAndEvaluateModule(z,@undefined);if(U&&@isPromise(U))@throwTypeError(`require() async module \\\"${z}\\\" is unsupported. use \"await import()\" instead.`);return J.registry.@get(z)})\n"; // requireESM const JSC::ConstructAbility s_importMetaObjectRequireESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2398,9 +2398,9 @@ const char* const s_writableStreamDefaultWriterInitializeWritableStreamDefaultWr const JSC::ConstructAbility s_writableStreamDefaultWriterClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamDefaultWriterClosedCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamDefaultWriterClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterClosedCodeLength = 215; +const int s_writableStreamDefaultWriterClosedCodeLength = 214; static const JSC::Intrinsic s_writableStreamDefaultWriterClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterClosedCode = "(function (){\"use strict\";if(!@isWritableStreamDefaultWriter(this))return @Promise.@reject(@makeGetterTypeError(\"WritableStreamDefaultWriter\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromise\").@promise})\n"; +const char* const s_writableStreamDefaultWriterClosedCode = "(function (){\"use strict\";if(!@isWritableStreamDefaultWriter(this))return @Promise.@reject(@makeGetterTypeError(\"WritableStreamDefaultWriter\",\"closed\"));return @getByIdDirectPrivate(this,\"closedPromise\").promise})\n"; // desiredSize const JSC::ConstructAbility s_writableStreamDefaultWriterDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2414,9 +2414,9 @@ const char* const s_writableStreamDefaultWriterDesiredSizeCode = "(function (){\ const JSC::ConstructAbility s_writableStreamDefaultWriterReadyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_writableStreamDefaultWriterReadyCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_writableStreamDefaultWriterReadyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterReadyCodeLength = 211; +const int s_writableStreamDefaultWriterReadyCodeLength = 210; static const JSC::Intrinsic s_writableStreamDefaultWriterReadyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterReadyCode = "(function (){\"use strict\";if(!@isWritableStreamDefaultWriter(this))return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\",\"ready\"));return @getByIdDirectPrivate(this,\"readyPromise\").@promise})\n"; +const char* const s_writableStreamDefaultWriterReadyCode = "(function (){\"use strict\";if(!@isWritableStreamDefaultWriter(this))return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\",\"ready\"));return @getByIdDirectPrivate(this,\"readyPromise\").promise})\n"; // abort const JSC::ConstructAbility s_writableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2668,9 +2668,9 @@ WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENE const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 1654; +const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 1650; static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode = "(function (b,p,R){\"use strict\";if(!@isReadableStream(b))@throwTypeError(\"ReadableByteStreamController needs a ReadableStream\");if(@getByIdDirectPrivate(b,\"readableStreamController\")!==null)@throwTypeError(\"ReadableStream already has a controller\");@putByIdDirectPrivate(this,\"controlledReadableStream\",b),@putByIdDirectPrivate(this,\"underlyingByteSource\",p),@putByIdDirectPrivate(this,\"pullAgain\",!1),@putByIdDirectPrivate(this,\"pulling\",!1),@readableByteStreamControllerClearPendingPullIntos(this),@putByIdDirectPrivate(this,\"queue\",@newQueue()),@putByIdDirectPrivate(this,\"started\",0),@putByIdDirectPrivate(this,\"closeRequested\",!1);let f=@toNumber(R);if(@isNaN(f)||f<0)@throwRangeError(\"highWaterMark value is negative or not a number\");@putByIdDirectPrivate(this,\"strategyHWM\",f);let _=p.autoAllocateChunkSize;if(_!==@undefined){if(_=@toNumber(_),_<=0||_===@Infinity||_===-@Infinity)@throwRangeError(\"autoAllocateChunkSize value is negative or equal to positive or negative infinity\")}@putByIdDirectPrivate(this,\"autoAllocateChunkSize\",_),@putByIdDirectPrivate(this,\"pendingPullIntos\",@createFIFO());const v=this;return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(v,\"underlyingByteSource\"),\"start\",[v]).@then(()=>{@putByIdDirectPrivate(v,\"started\",1),@assert(!@getByIdDirectPrivate(v,\"pulling\")),@assert(!@getByIdDirectPrivate(v,\"pullAgain\")),@readableByteStreamControllerCallPullIfNeeded(v)},(d)=>{if(@getByIdDirectPrivate(b,\"state\")===@streamReadable)@readableByteStreamControllerError(v,d)}),@putByIdDirectPrivate(this,\"cancel\",@readableByteStreamControllerCancel),@putByIdDirectPrivate(this,\"pull\",@readableByteStreamControllerPull),this})\n"; +const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode = "(function (R,D,E){\"use strict\";if(!@isReadableStream(R))@throwTypeError(\"ReadableByteStreamController needs a ReadableStream\");if(@getByIdDirectPrivate(R,\"readableStreamController\")!==null)@throwTypeError(\"ReadableStream already has a controller\");@putByIdDirectPrivate(this,\"controlledReadableStream\",R),@putByIdDirectPrivate(this,\"underlyingByteSource\",D),@putByIdDirectPrivate(this,\"pullAgain\",!1),@putByIdDirectPrivate(this,\"pulling\",!1),@readableByteStreamControllerClearPendingPullIntos(this),@putByIdDirectPrivate(this,\"queue\",@newQueue()),@putByIdDirectPrivate(this,\"started\",0),@putByIdDirectPrivate(this,\"closeRequested\",!1);let v=@toNumber(E);if(v!==v||v<0)@throwRangeError(\"highWaterMark value is negative or not a number\");@putByIdDirectPrivate(this,\"strategyHWM\",v);let _=D.autoAllocateChunkSize;if(_!==@undefined){if(_=@toNumber(_),_<=0||_===@Infinity||_===-@Infinity)@throwRangeError(\"autoAllocateChunkSize value is negative or equal to positive or negative infinity\")}@putByIdDirectPrivate(this,\"autoAllocateChunkSize\",_),@putByIdDirectPrivate(this,\"pendingPullIntos\",@createFIFO());const p=this;return @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(p,\"underlyingByteSource\"),\"start\",[p]).@then(()=>{@putByIdDirectPrivate(p,\"started\",1),@assert(!@getByIdDirectPrivate(p,\"pulling\")),@assert(!@getByIdDirectPrivate(p,\"pullAgain\")),@readableByteStreamControllerCallPullIfNeeded(p)},(I)=>{if(@getByIdDirectPrivate(R,\"state\")===@streamReadable)@readableByteStreamControllerError(p,I)}),@putByIdDirectPrivate(this,\"cancel\",@readableByteStreamControllerCancel),@putByIdDirectPrivate(this,\"pull\",@readableByteStreamControllerPull),this})\n"; // readableStreamByteStreamControllerStart const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2844,9 +2844,9 @@ const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespo const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength = 251; +const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength = 247; static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode = "(function (I,u){\"use strict\";if(u=@toNumber(u),@isNaN(u)||u===@Infinity||u<0)@throwRangeError(\"bytesWritten has an incorrect value\");@assert(@getByIdDirectPrivate(I,\"pendingPullIntos\").isNotEmpty()),@readableByteStreamControllerRespondInternal(I,u)})\n"; +const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode = "(function (u,_){\"use strict\";if(_=@toNumber(_),_!==_||_===@Infinity||_<0)@throwRangeError(\"bytesWritten has an incorrect value\");@assert(@getByIdDirectPrivate(u,\"pendingPullIntos\").isNotEmpty()),@readableByteStreamControllerRespondInternal(u,_)})\n"; // readableByteStreamControllerRespondInternal const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; @@ -2992,9 +2992,9 @@ WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENE const JSC::ConstructAbility s_eventSourceGetEventSourceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_eventSourceGetEventSourceCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_eventSourceGetEventSourceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_eventSourceGetEventSourceCodeLength = 5477; +const int s_eventSourceGetEventSourceCodeLength = 5469; static const JSC::Intrinsic s_eventSourceGetEventSourceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_eventSourceGetEventSourceCode = "(function (){\"use strict\";class F extends EventTarget{#B;#$;#J;#K;#L;#M=!1;#A=null;#j=\"\";#O=\"\";#Q=\"\";#U=!0;#F=0;#G=0;#X=0;#w=null;static#V(j){j.#H()}static#Y(j,A){const w=j.data,B=w.#Q\?`Last-Event-ID: ${w.#Q}\\r\\n`:\"\",K=`GET ${A.pathname}${A.search} HTTP/1.1\\r\\nHost: bun\\r\\nContent-type: text/event-stream\\r\\nContent-length: 0\\r\\n${B}\\r\\n`,G=j.write(K);if(G!==K.length)w.#O=K.substring(G)}static#Z(j,A,w){for(;;){if(w>=A.length)return;let B=-1,K=A.indexOf(\"\\r\\n\",w);const G=K+2;if(K>0)if(j.#F===0){const J=parseInt(A.substring(w,K),16);if(J===0){j.#$=2,j.#A\?.end();return}B=G+J}else B=A.length;else{if(j.#j.length===0){j.#j+=A.substring(w);return}B=A.length}let M=A.substring(G,B);w=B+2;let Z=0,L=M.indexOf(\"\\n\\n\");if(L==-1){j.#j+=A.substring(G);return}if(j.#j.length)j.#j+=M,M=j.#j,j.#j=\"\";let X=!0;while(X){const J=M.substring(Z,L);let Y,O=\"\",Q,W=0,V=-1;for(;;){let z=J.indexOf(\"\\n\",W);if(z===-1){if(W>=J.length)break;z=J.length}const U=J.substring(W,z);if(U.startsWith(\"data:\"))if(O.length)O+=`\\n${U.substring(5).trim()}`;else O=U.substring(5).trim();else if(U.startsWith(\"event:\"))Y=U.substring(6).trim();else if(U.startsWith(\"id:\"))Q=U.substring(3).trim();else if(U.startsWith(\"retry:\")){if(V=parseInt(U.substring(6).trim(),10),@isNaN(V))V=-1}W=z+1}if(j.#Q=Q||\"\",V>=0)j.#X=V;if(O||Q||Y)j.dispatchEvent(new MessageEvent(Y||\"message\",{data:O||\"\",origin:j.#B.origin,source:j,lastEventId:Q}));if(M.length===L+2){X=!1;break}const H=M.indexOf(\"\\n\\n\",L+1);if(H===-1)break;Z=L,L=H}}}static#z={open(j){const A=j.data;if(A.#A=j,!A.#M)F.#Y(j,A.#B)},handshake(j,A,w){const B=j.data;if(A)F.#Y(j,B.#B);else B.#$=2,B.dispatchEvent(new ErrorEvent(\"error\",{error:w})),j.end()},data(j,A){const w=j.data;switch(w.#$){case 0:{let B=A.toString();const K=B.indexOf(\"\\r\\n\\r\\n\");if(K===-1){w.#j+=B;return}if(w.#j.length)w.#j+=B,B=w.#j,w.#j=\"\";const G=B.substring(0,K),M=G.indexOf(\"\\r\\n\");if(M===-1){w.#$=2,w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Invalid HTTP request\")})),j.end();return}const Z=G.substring(0,M);if(Z!==\"HTTP/1.1 200 OK\"){w.#$=2,w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(Z)})),j.end();return}let L=M+1,X=!1,J=-1;for(;;){let O=G.indexOf(\"\\r\\n\",L);if(O===-1){if(L>=G.length){if(!X)w.#$=2,w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's response has no MIME type and \"text/event-stream\" is required. Aborting the connection.`)})),j.end();return}O=G.length}const Q=G.substring(L+1,O),W=Q.indexOf(\":\"),V=Q.substring(0,W),H=V.localeCompare(\"content-type\",@undefined,{sensitivity:\"accent\"})===0;if(L=O+1,H)if(Q.endsWith(\" text/event-stream\"))X=!0;else{w.#$=2,w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's response has a MIME type that is not \"text/event-stream\". Aborting the connection.`)})),j.end();return}else if(V.localeCompare(\"content-length\",@undefined,{sensitivity:\"accent\"})===0){if(J=parseInt(Q.substring(W+1).trim(),10),@isNaN(J)||J<=0){w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's Content-Length is invalid. Aborting the connection.`)})),j.end();return}if(X)break}else if(V.localeCompare(\"transfer-encoding\",@undefined,{sensitivity:\"accent\"})===0){if(Q.substring(W+1).trim()!==\"chunked\"){w.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's Transfer-Encoding is invalid. Aborting the connection.`)})),j.end();return}if(J=0,X)break}}w.#F=J,w.#$=1,w.dispatchEvent(new Event(\"open\"));const Y=B.substring(K+4);if(F.#Z(w,Y,0),w.#F>0){if(w.#G+=Y.length,w.#G>=w.#F)w.#$=2,j.end()}return}case 1:if(F.#Z(w,A.toString(),2),w.#F>0){if(w.#G+=A.byteLength,w.#G>=w.#F)w.#$=2,j.end()}return;default:break}},drain(j){const A=j.data;if(A.#$===0){const w=A.#j;if(w.length){const B=j.write(w);if(B!==w.length)j.data.#O=w.substring(B);else j.data.#O=\"\"}}},close:F.#W,end(j){F.#W(j).dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Connection closed by server\")}))},timeout(j){F.#W(j).dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Timeout\")}))},binaryType:\"buffer\"};static#W(j){const A=j.data;if(A.#A=null,A.#G=0,A.#$=2,A.#U){if(A.#w)clearTimeout(A.#w);A.#w=setTimeout(F.#V,A.#X,A)}return A}constructor(j,A=@undefined){super();const w=new URL(j);this.#M=w.protocol===\"https:\",this.#B=w,this.#$=2,process.nextTick(F.#V,this)}ref(){this.#w\?.ref(),this.#A\?.ref()}unref(){this.#w\?.unref(),this.#A\?.unref()}#H(){if(this.#$!==2)return;const j=this.#B,A=this.#M;this.#$=0,@Bun.connect({data:this,socket:F.#z,hostname:j.hostname,port:parseInt(j.port||(A\?\"443\":\"80\"),10),tls:A\?{requestCert:!0,rejectUnauthorized:!1}:!1}).catch((w)=>{if(super.dispatchEvent(new ErrorEvent(\"error\",{error:w})),this.#U){if(this.#w)this.#w.unref\?.();this.#w=setTimeout(F.#V,1000,this)}})}get url(){return this.#B.href}get readyState(){return this.#$}close(){this.#U=!1,this.#$=2,this.#A\?.unref(),this.#A\?.end()}get onopen(){return this.#L}get onerror(){return this.#J}get onmessage(){return this.#K}set onopen(j){if(this.#L)super.removeEventListener(\"close\",this.#L);super.addEventListener(\"open\",j),this.#L=j}set onerror(j){if(this.#J)super.removeEventListener(\"error\",this.#J);super.addEventListener(\"error\",j),this.#J=j}set onmessage(j){if(this.#K)super.removeEventListener(\"message\",this.#K);super.addEventListener(\"message\",j),this.#K=j}}return Object.defineProperty(F.prototype,\"CONNECTING\",{enumerable:!0,value:0}),Object.defineProperty(F.prototype,\"OPEN\",{enumerable:!0,value:1}),Object.defineProperty(F.prototype,\"CLOSED\",{enumerable:!0,value:2}),F[Symbol.for(\"CommonJS\")]=0,F})\n"; +const char* const s_eventSourceGetEventSourceCode = "(function (){\"use strict\";class A extends EventTarget{#j;#$;#F;#G;#J;#K=!1;#U=null;#w=\"\";#M=\"\";#O=\"\";#Q=!0;#A=0;#B=0;#X=0;#L=null;static#V(w){w.#H()}static#Y(w,U){const L=w.data,j=L.#O\?`Last-Event-ID: ${L.#O}\\r\\n`:\"\",G=`GET ${U.pathname}${U.search} HTTP/1.1\\r\\nHost: bun\\r\\nContent-type: text/event-stream\\r\\nContent-length: 0\\r\\n${j}\\r\\n`,F=w.write(G);if(F!==G.length)L.#M=G.substring(F)}static#Z(w,U,L){for(;;){if(L>=U.length)return;let j=-1,G=U.indexOf(\"\\r\\n\",L);const F=G+2;if(G>0)if(w.#A===0){const B=parseInt(U.substring(L,G),16);if(B===0){w.#$=2,w.#U\?.end();return}j=F+B}else j=U.length;else{if(w.#w.length===0){w.#w+=U.substring(L);return}j=U.length}let K=U.substring(F,j);L=j+2;let Z=0,J=K.indexOf(\"\\n\\n\");if(J==-1){w.#w+=U.substring(F);return}if(w.#w.length)w.#w+=K,K=w.#w,w.#w=\"\";let X=!0;while(X){const B=K.substring(Z,J);let Y,M=\"\",O,W=0,Q=-1;for(;;){let z=B.indexOf(\"\\n\",W);if(z===-1){if(W>=B.length)break;z=B.length}const V=B.substring(W,z);if(V.startsWith(\"data:\"))if(M.length)M+=`\\n${V.substring(5).trim()}`;else M=V.substring(5).trim();else if(V.startsWith(\"event:\"))Y=V.substring(6).trim();else if(V.startsWith(\"id:\"))O=V.substring(3).trim();else if(V.startsWith(\"retry:\")){if(Q=parseInt(V.substring(6).trim(),10),Q!==Q)Q=-1}W=z+1}if(w.#O=O||\"\",Q>=0)w.#X=Q;if(M||O||Y)w.dispatchEvent(new MessageEvent(Y||\"message\",{data:M||\"\",origin:w.#j.origin,source:w,lastEventId:O}));if(K.length===J+2){X=!1;break}const H=K.indexOf(\"\\n\\n\",J+1);if(H===-1)break;Z=J,J=H}}}static#z={open(w){const U=w.data;if(U.#U=w,!U.#K)A.#Y(w,U.#j)},handshake(w,U,L){const j=w.data;if(U)A.#Y(w,j.#j);else j.#$=2,j.dispatchEvent(new ErrorEvent(\"error\",{error:L})),w.end()},data(w,U){const L=w.data;switch(L.#$){case 0:{let j=U.toString();const G=j.indexOf(\"\\r\\n\\r\\n\");if(G===-1){L.#w+=j;return}if(L.#w.length)L.#w+=j,j=L.#w,L.#w=\"\";const F=j.substring(0,G),K=F.indexOf(\"\\r\\n\");if(K===-1){L.#$=2,L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Invalid HTTP request\")})),w.end();return}const Z=F.substring(0,K);if(Z!==\"HTTP/1.1 200 OK\"){L.#$=2,L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(Z)})),w.end();return}let J=K+1,X=!1,B=-1;for(;;){let M=F.indexOf(\"\\r\\n\",J);if(M===-1){if(J>=F.length){if(!X)L.#$=2,L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's response has no MIME type and \"text/event-stream\" is required. Aborting the connection.`)})),w.end();return}M=F.length}const O=F.substring(J+1,M),W=O.indexOf(\":\"),Q=O.substring(0,W),H=Q.localeCompare(\"content-type\",@undefined,{sensitivity:\"accent\"})===0;if(J=M+1,H)if(O.endsWith(\" text/event-stream\"))X=!0;else{L.#$=2,L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(`EventSource's response has a MIME type that is not \"text/event-stream\". Aborting the connection.`)})),w.end();return}else if(Q.localeCompare(\"content-length\",@undefined,{sensitivity:\"accent\"})===0){if(B=parseInt(O.substring(W+1).trim(),10),B!==B||B<=0){L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"EventSource's Content-Length is invalid. Aborting the connection.\")})),w.end();return}if(X)break}else if(Q.localeCompare(\"transfer-encoding\",@undefined,{sensitivity:\"accent\"})===0){if(O.substring(W+1).trim()!==\"chunked\"){L.dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"EventSource's Transfer-Encoding is invalid. Aborting the connection.\")})),w.end();return}if(B=0,X)break}}L.#A=B,L.#$=1,L.dispatchEvent(new Event(\"open\"));const Y=j.substring(G+4);if(A.#Z(L,Y,0),L.#A>0){if(L.#B+=Y.length,L.#B>=L.#A)L.#$=2,w.end()}return}case 1:if(A.#Z(L,U.toString(),2),L.#A>0){if(L.#B+=U.byteLength,L.#B>=L.#A)L.#$=2,w.end()}return;default:break}},drain(w){const U=w.data;if(U.#$===0){const L=U.#w;if(L.length){const j=w.write(L);if(j!==L.length)w.data.#M=L.substring(j);else w.data.#M=\"\"}}},close:A.#W,end(w){A.#W(w).dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Connection closed by server\")}))},timeout(w){A.#W(w).dispatchEvent(new ErrorEvent(\"error\",{error:new Error(\"Timeout\")}))},binaryType:\"buffer\"};static#W(w){const U=w.data;if(U.#U=null,U.#B=0,U.#$=2,U.#Q){if(U.#L)clearTimeout(U.#L);U.#L=setTimeout(A.#V,U.#X,U)}return U}constructor(w,U=@undefined){super();const L=new URL(w);this.#K=L.protocol===\"https:\",this.#j=L,this.#$=2,process.nextTick(A.#V,this)}ref(){this.#L\?.ref(),this.#U\?.ref()}unref(){this.#L\?.unref(),this.#U\?.unref()}#H(){if(this.#$!==2)return;const w=this.#j,U=this.#K;this.#$=0,@Bun.connect({data:this,socket:A.#z,hostname:w.hostname,port:parseInt(w.port||(U\?\"443\":\"80\"),10),tls:U\?{requestCert:!0,rejectUnauthorized:!1}:!1}).catch((L)=>{if(super.dispatchEvent(new ErrorEvent(\"error\",{error:L})),this.#Q){if(this.#L)this.#L.unref\?.();this.#L=setTimeout(A.#V,1000,this)}})}get url(){return this.#j.href}get readyState(){return this.#$}close(){this.#Q=!1,this.#$=2,this.#U\?.unref(),this.#U\?.end()}get onopen(){return this.#J}get onerror(){return this.#F}get onmessage(){return this.#G}set onopen(w){if(this.#J)super.removeEventListener(\"close\",this.#J);super.addEventListener(\"open\",w),this.#J=w}set onerror(w){if(this.#F)super.removeEventListener(\"error\",this.#F);super.addEventListener(\"error\",w),this.#F=w}set onmessage(w){if(this.#G)super.removeEventListener(\"message\",this.#G);super.addEventListener(\"message\",w),this.#G=w}}return Object.defineProperty(A.prototype,\"CONNECTING\",{enumerable:!0,value:0}),Object.defineProperty(A.prototype,\"OPEN\",{enumerable:!0,value:1}),Object.defineProperty(A.prototype,\"CLOSED\",{enumerable:!0,value:2}),A[Symbol.for(\"CommonJS\")]=0,A})\n"; #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ |