diff --git a/.buildkite/Dockerfile b/.buildkite/Dockerfile index 033aec633d681a..2b5f944834560a 100644 --- a/.buildkite/Dockerfile +++ b/.buildkite/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ wget curl git python3 python3-pip ninja-build \ software-properties-common apt-transport-https \ ca-certificates gnupg lsb-release unzip \ - libxml2-dev ruby ruby-dev bison gawk perl make golang \ + libxml2-dev ruby ruby-dev bison gawk perl make golang ccache \ && add-apt-repository ppa:ubuntu-toolchain-r/test \ && apt-get update \ && apt-get install -y gcc-13 g++-13 libgcc-13-dev libstdc++-13-dev \ @@ -35,7 +35,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && wget https://apt.llvm.org/llvm.sh \ && chmod +x llvm.sh \ && ./llvm.sh ${LLVM_VERSION} all \ - && rm llvm.sh + && rm llvm.sh \ + && rm -rf /var/lib/apt/lists/* RUN --mount=type=tmpfs,target=/tmp \ @@ -48,14 +49,6 @@ RUN --mount=type=tmpfs,target=/tmp \ wget -O /tmp/cmake.sh "$cmake_url" && \ sh /tmp/cmake.sh --skip-license --prefix=/usr -RUN --mount=type=tmpfs,target=/tmp \ - sccache_version="0.12.0" && \ - arch=$(uname -m) && \ - sccache_url="https://github.com/mozilla/sccache/releases/download/v${sccache_version}/sccache-v${sccache_version}-${arch}-unknown-linux-musl.tar.gz" && \ - wget -O /tmp/sccache.tar.gz "$sccache_url" && \ - tar -xzf /tmp/sccache.tar.gz -C /tmp && \ - install -m755 /tmp/sccache-v${sccache_version}-${arch}-unknown-linux-musl/sccache /usr/local/bin - RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130 \ --slave /usr/bin/g++ g++ /usr/bin/g++-13 \ --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-13 \ @@ -134,9 +127,7 @@ RUN ARCH=$(if [ "$TARGETARCH" = "arm64" ]; then echo "arm64"; else echo "amd64"; RUN mkdir -p /var/cache/buildkite-agent /var/log/buildkite-agent /var/run/buildkite-agent /etc/buildkite-agent /var/lib/buildkite-agent/cache/bun # The following is necessary to configure buildkite to use a stable -# checkout directory. sccache hashes absolute paths into its cache keys, -# so if buildkite uses a different checkout path each time (which it does -# by default), sccache will be useless. +# checkout directory for ccache to be effective. RUN mkdir -p -m 755 /var/lib/buildkite-agent/hooks && \ cat <<'EOF' > /var/lib/buildkite-agent/hooks/environment #!/bin/sh diff --git a/.gitignore b/.gitignore index 4b95245f9c9ecb..528cf0fa5f4a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ .ninja_deps .ninja_log .npm +.npmrc .npm.gz .parcel-cache .swcrc diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fe9a83f3faca7..f30ad577c1e06d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,15 +47,7 @@ include(SetupEsbuild) include(SetupZig) include(SetupRust) -find_program(SCCACHE_PROGRAM sccache) -if(SCCACHE_PROGRAM AND NOT DEFINED ENV{NO_SCCACHE}) - include(SetupSccache) -else() - find_program(CCACHE_PROGRAM ccache) - if(CCACHE_PROGRAM) - include(SetupCcache) - endif() -endif() +include(SetupCcache) # Generate dependency versions header include(GenerateDependencyVersions) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 192ce5ad6393c9..750eb17a6255e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Using your system's package manager, install Bun's dependencies: {% codetabs group="os" %} ```bash#macOS (Homebrew) -$ brew install automake cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby sccache +$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby ``` ```bash#Ubuntu/Debian @@ -65,43 +65,28 @@ $ brew install bun {% /codetabs %} -### Optional: Install `sccache` +### Optional: Install `ccache` -sccache is used to cache compilation artifacts, significantly speeding up builds. It must be installed with S3 support: +ccache is used to cache compilation artifacts, significantly speeding up builds: ```bash # For macOS -$ brew install sccache +$ brew install ccache -# For Linux. Note that the version in your package manager may not have S3 support. -$ cargo install sccache --features=s3 -``` - -This will install `sccache` with S3 support. Our build scripts will automatically detect and use `sccache` with our shared S3 cache. **Note**: Not all versions of `sccache` are compiled with S3 support, hence we recommend installing it via `cargo`. - -#### Registering AWS Credentials for `sccache` (Core Developers Only) +# For Ubuntu/Debian +$ sudo apt install ccache -Core developers have write access to the shared S3 cache. To enable write access, you must log in with AWS credentials. The easiest way to do this is to use the [`aws` CLI](https://aws.amazon.com/cli/) and invoke [`aws configure` to provide your AWS security info](https://docs.aws.amazon.com/cli/latest/reference/configure/). +# For Arch +$ sudo pacman -S ccache -The `cmake` scripts should automatically detect your AWS credentials from the environment or the `~/.aws/credentials` file. +# For Fedora +$ sudo dnf install ccache -
- Logging in to the `aws` CLI - - 1. Install the AWS CLI by following [the official guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). - 2. Log in to your AWS account console. A team member should provide you with your credentials. - 3. Click your name in the top right > Security credentials. - 4. Scroll to "Access keys" and create a new access key. - 5. Run `aws configure` in your terminal and provide the access key ID and secret access key when prompted. -
- -
- Common Issues You May Encounter +# For openSUSE +$ sudo zypper install ccache +``` - - To confirm that the cache is being used, you can use the `sccache --show-stats` command right after a build. This will expose very useful statistics, including cache hits/misses. - - If you have multiple AWS profiles configured, ensure that the correct profile is set in the `AWS_PROFILE` environment variable. - - `sccache` follows a server-client model. If you run into weird issues where `sccache` refuses to use S3, even though you have AWS credentials configured, try killing any running `sccache` servers with `sccache --stop-server` and then re-running the build. -
+Our build scripts will automatically detect and use `ccache` if available. You can check cache statistics with `ccache --show-stats`. ## Install LLVM diff --git a/bench/snippets/array-of.js b/bench/snippets/array-of.js new file mode 100644 index 00000000000000..51e0a47bd530e6 --- /dev/null +++ b/bench/snippets/array-of.js @@ -0,0 +1,335 @@ +import { bench, run } from "../runner.mjs"; + +let sink; + +// Integers +bench("int: Array.of(1,2,3,4,5)", () => { + sink = Array.of(1, 2, 3, 4, 5); +}); + +bench("int: Array.of(100 elements)", () => { + sink = Array.of( + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + ); +}); + +// Doubles +bench("double: Array.of(1.1,2.2,3.3,4.4,5.5)", () => { + sink = Array.of(1.1, 2.2, 3.3, 4.4, 5.5); +}); + +bench("double: Array.of(100 elements)", () => { + sink = Array.of( + 0.1, + 1.1, + 2.1, + 3.1, + 4.1, + 5.1, + 6.1, + 7.1, + 8.1, + 9.1, + 10.1, + 11.1, + 12.1, + 13.1, + 14.1, + 15.1, + 16.1, + 17.1, + 18.1, + 19.1, + 20.1, + 21.1, + 22.1, + 23.1, + 24.1, + 25.1, + 26.1, + 27.1, + 28.1, + 29.1, + 30.1, + 31.1, + 32.1, + 33.1, + 34.1, + 35.1, + 36.1, + 37.1, + 38.1, + 39.1, + 40.1, + 41.1, + 42.1, + 43.1, + 44.1, + 45.1, + 46.1, + 47.1, + 48.1, + 49.1, + 50.1, + 51.1, + 52.1, + 53.1, + 54.1, + 55.1, + 56.1, + 57.1, + 58.1, + 59.1, + 60.1, + 61.1, + 62.1, + 63.1, + 64.1, + 65.1, + 66.1, + 67.1, + 68.1, + 69.1, + 70.1, + 71.1, + 72.1, + 73.1, + 74.1, + 75.1, + 76.1, + 77.1, + 78.1, + 79.1, + 80.1, + 81.1, + 82.1, + 83.1, + 84.1, + 85.1, + 86.1, + 87.1, + 88.1, + 89.1, + 90.1, + 91.1, + 92.1, + 93.1, + 94.1, + 95.1, + 96.1, + 97.1, + 98.1, + 99.1, + ); +}); + +// Objects +bench("object: Array.of(obj x5)", () => { + sink = Array.of({ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }); +}); + +bench("object: Array.of(100 elements)", () => { + sink = Array.of( + { a: 0 }, + { a: 1 }, + { a: 2 }, + { a: 3 }, + { a: 4 }, + { a: 5 }, + { a: 6 }, + { a: 7 }, + { a: 8 }, + { a: 9 }, + { a: 10 }, + { a: 11 }, + { a: 12 }, + { a: 13 }, + { a: 14 }, + { a: 15 }, + { a: 16 }, + { a: 17 }, + { a: 18 }, + { a: 19 }, + { a: 20 }, + { a: 21 }, + { a: 22 }, + { a: 23 }, + { a: 24 }, + { a: 25 }, + { a: 26 }, + { a: 27 }, + { a: 28 }, + { a: 29 }, + { a: 30 }, + { a: 31 }, + { a: 32 }, + { a: 33 }, + { a: 34 }, + { a: 35 }, + { a: 36 }, + { a: 37 }, + { a: 38 }, + { a: 39 }, + { a: 40 }, + { a: 41 }, + { a: 42 }, + { a: 43 }, + { a: 44 }, + { a: 45 }, + { a: 46 }, + { a: 47 }, + { a: 48 }, + { a: 49 }, + { a: 50 }, + { a: 51 }, + { a: 52 }, + { a: 53 }, + { a: 54 }, + { a: 55 }, + { a: 56 }, + { a: 57 }, + { a: 58 }, + { a: 59 }, + { a: 60 }, + { a: 61 }, + { a: 62 }, + { a: 63 }, + { a: 64 }, + { a: 65 }, + { a: 66 }, + { a: 67 }, + { a: 68 }, + { a: 69 }, + { a: 70 }, + { a: 71 }, + { a: 72 }, + { a: 73 }, + { a: 74 }, + { a: 75 }, + { a: 76 }, + { a: 77 }, + { a: 78 }, + { a: 79 }, + { a: 80 }, + { a: 81 }, + { a: 82 }, + { a: 83 }, + { a: 84 }, + { a: 85 }, + { a: 86 }, + { a: 87 }, + { a: 88 }, + { a: 89 }, + { a: 90 }, + { a: 91 }, + { a: 92 }, + { a: 93 }, + { a: 94 }, + { a: 95 }, + { a: 96 }, + { a: 97 }, + { a: 98 }, + { a: 99 }, + ); +}); + +await run(); diff --git a/bench/snippets/ipc-json-child.mjs b/bench/snippets/ipc-json-child.mjs new file mode 100644 index 00000000000000..4807baa14c91ab --- /dev/null +++ b/bench/snippets/ipc-json-child.mjs @@ -0,0 +1,4 @@ +// Child process for IPC benchmarks - echoes messages back to parent +process.on("message", message => { + process.send(message); +}); diff --git a/bench/snippets/ipc-json.mjs b/bench/snippets/ipc-json.mjs new file mode 100644 index 00000000000000..2daa1cd59e62b4 --- /dev/null +++ b/bench/snippets/ipc-json.mjs @@ -0,0 +1,45 @@ +import { fork } from "node:child_process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { bench, run } from "../runner.mjs"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const childPath = path.join(__dirname, "ipc-json-child.mjs"); + +const smallMessage = { type: "ping", id: 1 }; +const largeString = Buffer.alloc(10 * 1024 * 1024, "A").toString(); +const largeMessage = { type: "ping", id: 1, data: largeString }; + +async function runBenchmark(message, count) { + let received = 0; + const { promise, resolve } = Promise.withResolvers(); + + const child = fork(childPath, [], { + stdio: ["ignore", "ignore", "ignore", "ipc"], + serialization: "json", + }); + + child.on("message", () => { + received++; + if (received >= count) { + resolve(); + } + }); + + for (let i = 0; i < count; i++) { + child.send(message); + } + + await promise; + child.kill(); +} + +bench("ipc json - small messages (1000 roundtrips)", async () => { + await runBenchmark(smallMessage, 1000); +}); + +bench("ipc json - 10MB messages (10 roundtrips)", async () => { + await runBenchmark(largeMessage, 10); +}); + +await run(); diff --git a/bench/snippets/response-json.mjs b/bench/snippets/response-json.mjs index 2cd20523b6e0af..28cad6e6c78934 100644 --- a/bench/snippets/response-json.mjs +++ b/bench/snippets/response-json.mjs @@ -112,12 +112,40 @@ const obj = { }, }; -bench("Response.json(obj)", async () => { +const smallObj = { id: 1, name: "test" }; + +const arrayObj = { + items: Array.from({ length: 100 }, (_, i) => ({ id: i, value: `item-${i}` })), +}; + +bench("Response.json(obj)", () => { return Response.json(obj); }); -bench("Response.json(obj).json()", async () => { - return await Response.json(obj).json(); +bench("new Response(JSON.stringify(obj))", () => { + return new Response(JSON.stringify(obj), { + headers: { "Content-Type": "application/json" }, + }); +}); + +bench("Response.json(smallObj)", () => { + return Response.json(smallObj); +}); + +bench("new Response(JSON.stringify(smallObj))", () => { + return new Response(JSON.stringify(smallObj), { + headers: { "Content-Type": "application/json" }, + }); +}); + +bench("Response.json(arrayObj)", () => { + return Response.json(arrayObj); +}); + +bench("new Response(JSON.stringify(arrayObj))", () => { + return new Response(JSON.stringify(arrayObj), { + headers: { "Content-Type": "application/json" }, + }); }); await run(); diff --git a/bench/snippets/string-includes.mjs b/bench/snippets/string-includes.mjs new file mode 100644 index 00000000000000..daf912ecf126cc --- /dev/null +++ b/bench/snippets/string-includes.mjs @@ -0,0 +1,34 @@ +import { bench, run } from "../runner.mjs"; + +const shortStr = "The quick brown fox jumps over the lazy dog"; +const longStr = shortStr.repeat(100); + +bench("String.includes - short, hit (middle)", () => { + return shortStr.includes("jumps"); +}); + +bench("String.includes - short, hit (start)", () => { + return shortStr.includes("The"); +}); + +bench("String.includes - short, hit (end)", () => { + return shortStr.includes("dog"); +}); + +bench("String.includes - short, miss", () => { + return shortStr.includes("cat"); +}); + +bench("String.includes - long, hit (middle)", () => { + return longStr.includes("jumps"); +}); + +bench("String.includes - long, miss", () => { + return longStr.includes("cat"); +}); + +bench("String.includes - with position", () => { + return shortStr.includes("fox", 10); +}); + +await run(); diff --git a/cmake/tools/SetupBuildkite.cmake b/cmake/tools/SetupBuildkite.cmake index e1d8b32cdeae63..367c9c8d3bef39 100644 --- a/cmake/tools/SetupBuildkite.cmake +++ b/cmake/tools/SetupBuildkite.cmake @@ -48,6 +48,9 @@ if(NOT BUILDKITE_BUILD_STATUS EQUAL 0) endif() file(READ ${BUILDKITE_BUILD_PATH}/build.json BUILDKITE_BUILD) +# Escape backslashes so CMake doesn't interpret JSON escape sequences (e.g., \n in commit messages) +string(REPLACE "\\" "\\\\" BUILDKITE_BUILD "${BUILDKITE_BUILD}") + string(JSON BUILDKITE_BUILD_UUID GET ${BUILDKITE_BUILD} id) string(JSON BUILDKITE_JOBS GET ${BUILDKITE_BUILD} jobs) string(JSON BUILDKITE_JOBS_COUNT LENGTH ${BUILDKITE_JOBS}) diff --git a/cmake/tools/SetupCcache.cmake b/cmake/tools/SetupCcache.cmake index fc1e64aa96cfde..3e1982ca70c46d 100644 --- a/cmake/tools/SetupCcache.cmake +++ b/cmake/tools/SetupCcache.cmake @@ -5,18 +5,12 @@ if(NOT ENABLE_CCACHE OR CACHE_STRATEGY STREQUAL "none") return() endif() -if (CI AND NOT APPLE) - setenv(CCACHE_DISABLE 1) - return() -endif() find_command( VARIABLE CCACHE_PROGRAM COMMAND ccache - REQUIRED - ${CI} ) if(NOT CCACHE_PROGRAM) diff --git a/cmake/tools/SetupSccache.cmake b/cmake/tools/SetupSccache.cmake deleted file mode 100644 index cb4b5aa750ab66..00000000000000 --- a/cmake/tools/SetupSccache.cmake +++ /dev/null @@ -1,123 +0,0 @@ -# Setup sccache as the C and C++ compiler launcher to speed up builds by caching -if(CACHE_STRATEGY STREQUAL "none") - return() -endif() - -set(SCCACHE_SHARED_CACHE_REGION "us-west-1") -set(SCCACHE_SHARED_CACHE_BUCKET "bun-build-sccache-store") - -# Function to check if the system AWS credentials have access to the sccache S3 bucket. -function(check_aws_credentials OUT_VAR) - # Install dependencies first - execute_process( - COMMAND ${BUN_EXECUTABLE} install --frozen-lockfile - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/scripts/build-cache - RESULT_VARIABLE INSTALL_EXIT_CODE - OUTPUT_VARIABLE INSTALL_OUTPUT - ERROR_VARIABLE INSTALL_ERROR - ) - - if(NOT INSTALL_EXIT_CODE EQUAL 0) - message(FATAL_ERROR "Failed to install dependencies in scripts/build-cache\n" - "Exit code: ${INSTALL_EXIT_CODE}\n" - "Output: ${INSTALL_OUTPUT}\n" - "Error: ${INSTALL_ERROR}") - endif() - - # Check AWS credentials - execute_process( - COMMAND - ${BUN_EXECUTABLE} - run - have-access.ts - --bucket ${SCCACHE_SHARED_CACHE_BUCKET} - --region ${SCCACHE_SHARED_CACHE_REGION} - WORKING_DIRECTORY - ${CMAKE_SOURCE_DIR}/scripts/build-cache - RESULT_VARIABLE HAVE_ACCESS_EXIT_CODE - ) - - if(HAVE_ACCESS_EXIT_CODE EQUAL 0) - set(HAS_CREDENTIALS TRUE) - else() - set(HAS_CREDENTIALS FALSE) - endif() - - set(${OUT_VAR} ${HAS_CREDENTIALS} PARENT_SCOPE) -endfunction() - -# Configure sccache to use the local cache only. -function(sccache_configure_local_filesystem) - unsetenv(SCCACHE_BUCKET) - unsetenv(SCCACHE_REGION) - setenv(SCCACHE_DIR "${CACHE_PATH}/sccache") -endfunction() - -# Configure sccache to use the distributed cache (S3 + local). -function(sccache_configure_distributed) - setenv(SCCACHE_BUCKET "${SCCACHE_SHARED_CACHE_BUCKET}") - setenv(SCCACHE_REGION "${SCCACHE_SHARED_CACHE_REGION}") - setenv(SCCACHE_DIR "${CACHE_PATH}/sccache") -endfunction() - -function(sccache_configure_environment_ci) - if(CACHE_STRATEGY STREQUAL "auto" OR CACHE_STRATEGY STREQUAL "distributed") - check_aws_credentials(HAS_AWS_CREDENTIALS) - if(HAS_AWS_CREDENTIALS) - sccache_configure_distributed() - message(NOTICE "sccache: Using distributed cache strategy.") - else() - message(FATAL_ERROR "CI CACHE_STRATEGY is set to '${CACHE_STRATEGY}', but no valid AWS " - "credentials were found. Note that 'auto' requires AWS credentials to access the shared " - "cache in CI.") - endif() - elseif(CACHE_STRATEGY STREQUAL "local") - # We disallow this because we want our CI runs to always used the shared cache to accelerate - # builds. - # none, distributed and auto are all okay. - # - # If local is configured, it's as good as "none", so this is probably user error. - message(FATAL_ERROR "CI CACHE_STRATEGY is set to 'local', which is not allowed.") - endif() -endfunction() - -function(sccache_configure_environment_developer) - # Local environments can use any strategy they like. S3 is set up in such a way so as to clean - # itself from old entries automatically. - if (CACHE_STRATEGY STREQUAL "auto" OR CACHE_STRATEGY STREQUAL "local") - # In the local environment, we prioritize using the local cache. This is because sccache takes - # into consideration the whole absolute path of the files being compiled, and it's very - # unlikely users will have the same absolute paths on their local machines. - sccache_configure_local_filesystem() - message(NOTICE "sccache: Using local cache strategy.") - elseif(CACHE_STRATEGY STREQUAL "distributed") - check_aws_credentials(HAS_AWS_CREDENTIALS) - if(HAS_AWS_CREDENTIALS) - sccache_configure_distributed() - message(NOTICE "sccache: Using distributed cache strategy.") - else() - message(FATAL_ERROR "CACHE_STRATEGY is set to 'distributed', but no valid AWS credentials " - "were found.") - endif() - endif() -endfunction() - -find_command(VARIABLE SCCACHE_PROGRAM COMMAND sccache REQUIRED ${CI}) -if(NOT SCCACHE_PROGRAM) - message(WARNING "sccache not found. Your builds will be slower.") - return() -endif() - -set(SCCACHE_ARGS CMAKE_C_COMPILER_LAUNCHER CMAKE_CXX_COMPILER_LAUNCHER) -foreach(arg ${SCCACHE_ARGS}) - setx(${arg} ${SCCACHE_PROGRAM}) - list(APPEND CMAKE_ARGS -D${arg}=${${arg}}) -endforeach() - -setenv(SCCACHE_LOG "info") - -if (CI) - sccache_configure_environment_ci() -else() - sccache_configure_environment_developer() -endif() diff --git a/cmake/tools/SetupWebKit.cmake b/cmake/tools/SetupWebKit.cmake index 6ff1af55d826c6..6e2ce7d6774153 100644 --- a/cmake/tools/SetupWebKit.cmake +++ b/cmake/tools/SetupWebKit.cmake @@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use") option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading") if(NOT WEBKIT_VERSION) - set(WEBKIT_VERSION 8400ec68b2649d7b95f10576ad648c3aa8a92b77) + set(WEBKIT_VERSION 863778130931e0081a688f48e8479b8ee61b9507) endif() string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX) diff --git a/docs/pm/isolated-installs.mdx b/docs/pm/isolated-installs.mdx index 49718d71bcb35a..7a18cee5eeabee 100644 --- a/docs/pm/isolated-installs.mdx +++ b/docs/pm/isolated-installs.mdx @@ -189,7 +189,7 @@ Isolated installs are conceptually similar to pnpm, so migration should be strai ```bash terminal icon="terminal" # Remove pnpm files -$ rm -rf node_modules pnpm-lock.yaml +rm -rf node_modules pnpm-lock.yaml # Install with Bun's isolated linker bun install --linker isolated diff --git a/docs/pm/npmrc.mdx b/docs/pm/npmrc.mdx index bef86d5435063b..fb42aaafbbc3d3 100644 --- a/docs/pm/npmrc.mdx +++ b/docs/pm/npmrc.mdx @@ -72,6 +72,7 @@ The following options are supported: - `username` - `_password` (base64 encoded password) - `_auth` (base64 encoded username:password, e.g. `btoa(username + ":" + password)`) +- `email` The equivalent `bunfig.toml` option is to add a key in [`install.scopes`](/runtime/bunfig#install-registry): @@ -109,3 +110,136 @@ The equivalent `bunfig.toml` option is [`install.exact`](/runtime/bunfig#install [install] exact = true ``` + +### `ignore-scripts`: Skip lifecycle scripts + +Prevents running lifecycle scripts during installation: + +```ini .npmrc icon="npm" +ignore-scripts=true +``` + +This is equivalent to using the `--ignore-scripts` flag with `bun install`. + +### `dry-run`: Preview changes without installing + +Shows what would be installed without actually installing: + +```ini .npmrc icon="npm" +dry-run=true +``` + +The equivalent `bunfig.toml` option is [`install.dryRun`](/runtime/bunfig#install-dryrun): + +```toml bunfig.toml icon="settings" +[install] +dryRun = true +``` + +### `cache`: Configure cache directory + +Set the cache directory path, or disable caching: + +```ini .npmrc icon="npm" +# set a custom cache directory +cache=/path/to/cache + +# or disable caching +cache=false +``` + +The equivalent `bunfig.toml` option is [`install.cache`](/runtime/bunfig#install-cache): + +```toml bunfig.toml icon="settings" +[install.cache] +# set a custom cache directory +dir = "/path/to/cache" + +# or disable caching +disable = true +``` + +### `ca` and `cafile`: Configure CA certificates + +Configure custom CA certificates for registry connections: + +```ini .npmrc icon="npm" +# single CA certificate +ca="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" + +# multiple CA certificates +ca[]="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" +ca[]="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" + +# or specify a path to a CA file +cafile=/path/to/ca-bundle.crt +``` + +### `omit` and `include`: Control dependency types + +Control which dependency types are installed: + +```ini .npmrc icon="npm" +# omit dev dependencies +omit=dev + +# omit multiple types +omit[]=dev +omit[]=optional + +# include specific types (overrides omit) +include=dev +``` + +Valid values: `dev`, `peer`, `optional` + +### `install-strategy` and `node-linker`: Installation strategy + +Control how packages are installed in `node_modules`. Bun supports two different configuration options for compatibility with different package managers. + +**npm's `install-strategy`:** + +```ini .npmrc icon="npm" +# flat node_modules structure (default) +install-strategy=hoisted + +# symlinked structure +install-strategy=linked +``` + +**pnpm/yarn's `node-linker`:** + +The `node-linker` option controls the installation mode. Bun supports values from both pnpm and yarn: + +| Value | Description | Accepted by | +| -------------- | ----------------------------------------------- | ----------- | +| `isolated` | Symlinked structure with isolated dependencies | pnpm | +| `hoisted` | Flat node_modules structure | pnpm | +| `pnpm` | Symlinked structure (same as `isolated`) | yarn | +| `node-modules` | Flat node_modules structure (same as `hoisted`) | yarn | + +```ini .npmrc icon="npm" +# symlinked/isolated mode +node-linker=isolated +node-linker=pnpm + +# flat/hoisted mode +node-linker=hoisted +node-linker=node-modules +``` + +### `public-hoist-pattern` and `hoist-pattern`: Control hoisting + +Control which packages are hoisted to the root `node_modules`: + +```ini .npmrc icon="npm" +# packages matching this pattern will be hoisted to the root +public-hoist-pattern=*eslint* + +# multiple patterns +public-hoist-pattern[]=*eslint* +public-hoist-pattern[]=*prettier* + +# control general hoisting behavior +hoist-pattern=* +``` diff --git a/docs/project/building-windows.mdx b/docs/project/building-windows.mdx index 9a4a3ab2d77361..dc0b4836d3a011 100644 --- a/docs/project/building-windows.mdx +++ b/docs/project/building-windows.mdx @@ -14,7 +14,7 @@ It is strongly recommended to use [PowerShell 7 (`pwsh.exe`)](https://learn.micr By default, running unverified scripts are blocked. ```ps1 -> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted +Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted ``` ### System Dependencies @@ -22,7 +22,7 @@ By default, running unverified scripts are blocked. Bun v1.1 or later. We use Bun to run it's own code generators. ```ps1 -> irm bun.sh/install.ps1 | iex +irm bun.sh/install.ps1 | iex ``` [Visual Studio](https://visualstudio.microsoft.com) with the "Desktop Development with C++" workload. While installing, make sure to install Git as well, if Git for Windows is not already installed. @@ -30,7 +30,7 @@ Bun v1.1 or later. We use Bun to run it's own code generators. Visual Studio can be installed graphically using the wizard or through WinGet: ```ps1 -> winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore +winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore ``` After Visual Studio, you need the following: @@ -48,10 +48,10 @@ After Visual Studio, you need the following: [Scoop](https://scoop.sh) can be used to install these remaining tools easily. ```ps1 Scoop -> irm https://get.scoop.sh | iex -> scoop install nodejs-lts go rust nasm ruby perl sccache +irm https://get.scoop.sh | iex +scoop install nodejs-lts go rust nasm ruby perl ccache # scoop seems to be buggy if you install llvm and the rest at the same time -> scoop install llvm@19.1.7 +scoop install llvm@19.1.7 ``` @@ -63,19 +63,19 @@ After Visual Studio, you need the following: If you intend on building WebKit locally (optional), you should install these packages: ```ps1 Scoop -> scoop install make cygwin python +scoop install make cygwin python ``` From here on out, it is **expected you use a PowerShell Terminal with `.\scripts\vs-shell.ps1` sourced**. This script is available in the Bun repository and can be loaded by executing it: ```ps1 -> .\scripts\vs-shell.ps1 +.\scripts\vs-shell.ps1 ``` To verify, you can check for an MSVC-only command line such as `mt.exe` ```ps1 -> Get-Command mt +Get-Command mt ``` @@ -86,16 +86,16 @@ To verify, you can check for an MSVC-only command line such as `mt.exe` ## Building ```ps1 -> bun run build +bun run build # after the initial `bun run build` you can use the following to build -> ninja -Cbuild/debug +ninja -Cbuild/debug ``` If this was successful, you should have a `bun-debug.exe` in the `build/debug` folder. ```ps1 -> .\build\debug\bun-debug.exe --revision +.\build\debug\bun-debug.exe --revision ``` You should add this to `$Env:PATH`. The simplest way to do so is to open the start menu, type "Path", and then navigate the environment variables menu to add `C:\.....\bun\build\debug` to the user environment variable `PATH`. You should then restart your editor (if it does not update still, log out and log back in). @@ -111,15 +111,15 @@ You can run the test suite either using `bun test ` or by using the wrappe ```ps1 # Setup -> bun i --cwd packages\bun-internal-test +bun i --cwd packages\bun-internal-test # Run the entire test suite with reporter # the package.json script "test" uses "build/debug/bun-debug.exe" by default -> bun run test +bun run test # Run an individual test file: -> bun-debug test node\fs -> bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js" +bun-debug test node\fs +bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js" ``` ## Troubleshooting diff --git a/docs/project/contributing.mdx b/docs/project/contributing.mdx index b645b005f164b4..36353feaa0a401 100644 --- a/docs/project/contributing.mdx +++ b/docs/project/contributing.mdx @@ -28,23 +28,23 @@ Using your system's package manager, install Bun's dependencies: ```bash macOS (Homebrew) -$ brew install automake cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby sccache +brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby ``` ```bash Ubuntu/Debian -$ sudo apt install curl wget lsb-release software-properties-common cargo cmake git golang libtool ninja-build pkg-config rustc ruby-full xz-utils +sudo apt install curl wget lsb-release software-properties-common cargo cmake git golang libtool ninja-build pkg-config rustc ruby-full xz-utils ``` ```bash Arch -$ sudo pacman -S base-devel cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ruby +sudo pacman -S base-devel cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ruby ``` ```bash Fedora -$ sudo dnf install cargo clang19 llvm19 lld19 cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)' +sudo dnf install cargo clang19 llvm19 lld19 cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)' ``` ```bash openSUSE Tumbleweed -$ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable +sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable ``` @@ -56,59 +56,42 @@ Before starting, you will need to already have a release build of Bun installed, ```bash Native -$ curl -fsSL https://bun.com/install | bash +curl -fsSL https://bun.com/install | bash ``` ```bash npm -$ npm install -g bun +npm install -g bun ``` ```bash Homebrew -$ brew tap oven-sh/bun -$ brew install bun +brew tap oven-sh/bun +brew install bun ``` -### Optional: Install `sccache` +### Optional: Install `ccache` -sccache is used to cache compilation artifacts, significantly speeding up builds. It must be installed with S3 support: +ccache is used to cache compilation artifacts, significantly speeding up builds: ```bash # For macOS -$ brew install sccache +brew install ccache -# For Linux. Note that the version in your package manager may not have S3 support. -$ cargo install sccache --features=s3 -``` - -This will install `sccache` with S3 support. Our build scripts will automatically detect and use `sccache` with our shared S3 cache. **Note**: Not all versions of `sccache` are compiled with S3 support, hence we recommend installing it via `cargo`. - -#### Registering AWS Credentials for `sccache` (Core Developers Only) - -Core developers have write access to the shared S3 cache. To enable write access, you must log in with AWS credentials. The easiest way to do this is to use the [`aws` CLI](https://aws.amazon.com/cli/) and invoke [`aws configure` to provide your AWS security info](https://docs.aws.amazon.com/cli/latest/reference/configure/). +# For Ubuntu/Debian +sudo apt install ccache -The `cmake` scripts should automatically detect your AWS credentials from the environment or the `~/.aws/credentials` file. +# For Arch +sudo pacman -S ccache -
- Logging in to the `aws` CLI +# For Fedora +sudo dnf install ccache - 1. Install the AWS CLI by following [the official guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). - 2. Log in to your AWS account console. A team member should provide you with your credentials. - 3. Click your name in the top right > Security credentials. - 4. Scroll to "Access keys" and create a new access key. - 5. Run `aws configure` in your terminal and provide the access key ID and secret access key when prompted. - -
- -
- Common Issues You May Encounter - - - To confirm that the cache is being used, you can use the `sccache --show-stats` command right after a build. This will expose very useful statistics, including cache hits/misses. - - If you have multiple AWS profiles configured, ensure that the correct profile is set in the `AWS_PROFILE` environment variable. - - `sccache` follows a server-client model. If you run into weird issues where `sccache` refuses to use S3, even though you have AWS credentials configured, try killing any running `sccache` servers with `sccache --stop-server` and then re-running the build. +# For openSUSE +sudo zypper install ccache +``` -
+Our build scripts will automatically detect and use `ccache` if available. You can check cache statistics with `ccache --show-stats`. ## Install LLVM @@ -117,24 +100,24 @@ Bun requires LLVM 19 (`clang` is part of LLVM). This version requirement is to m ```bash macOS (Homebrew) -$ brew install llvm@19 +brew install llvm@19 ``` ```bash Ubuntu/Debian -$ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu -$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 19 all +# LLVM has an automatic installation script that is compatible with all versions of Ubuntu +wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 19 all ``` ```bash Arch -$ sudo pacman -S llvm clang lld +sudo pacman -S llvm clang lld ``` ```bash Fedora -$ sudo dnf install llvm clang lld-devel +sudo dnf install llvm clang lld-devel ``` ```bash openSUSE Tumbleweed -$ sudo zypper install clang19 lld19 llvm19 +sudo zypper install clang19 lld19 llvm19 ``` @@ -144,7 +127,7 @@ If none of the above solutions apply, you will have to install it [manually](htt Make sure Clang/LLVM 19 is in your path: ```bash -$ which clang-19 +which clang-19 ``` If not, run this to manually add it: @@ -154,12 +137,12 @@ If not, run this to manually add it: ```bash macOS (Homebrew) # use fish_add_path if you're using fish # use path+="$(brew --prefix llvm@19)/bin" if you are using zsh -$ export PATH="$(brew --prefix llvm@19)/bin:$PATH" +export PATH="$(brew --prefix llvm@19)/bin:$PATH" ``` ```bash Arch # use fish_add_path if you're using fish -$ export PATH="$PATH:/usr/lib/llvm19/bin" +export PATH="$PATH:/usr/lib/llvm19/bin" ``` @@ -179,7 +162,7 @@ bun run build The binary will be located at `./build/debug/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun. ```bash -$ build/debug/bun-debug --version +build/debug/bun-debug --version x.y.z_debug ``` @@ -278,17 +261,17 @@ WebKit is not cloned by default (to save time and disk space). To clone and buil ```bash # Clone WebKit into ./vendor/WebKit -$ git clone https://github.com/oven-sh/WebKit vendor/WebKit +git clone https://github.com/oven-sh/WebKit vendor/WebKit # Check out the commit hash specified in `set(WEBKIT_VERSION )` in cmake/tools/SetupWebKit.cmake -$ git -C vendor/WebKit checkout +git -C vendor/WebKit checkout # Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug # Optionally, you can use `bun run jsc:build` for a release build bun run jsc:build:debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h # After an initial run of `make jsc-debug`, you can rebuild JSC with: -$ cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h +cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h # Build bun with the local JSC build bun run build:local @@ -339,20 +322,20 @@ is not able to compile a simple test program. To fix the error, we need to update the GCC version to 11. To do this, we'll need to check if the latest version is available in the distribution's official repositories or use a third-party repository that provides GCC 11 packages. Here are general steps: ```bash -$ sudo apt update -$ sudo apt install gcc-11 g++-11 +sudo apt update +sudo apt install gcc-11 g++-11 # If the above command fails with `Unable to locate package gcc-11` we need # to add the APT repository -$ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test +sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # Now run `apt install` again -$ sudo apt install gcc-11 g++-11 +sudo apt install gcc-11 g++-11 ``` Now, we need to set GCC 11 as the default compiler: ```bash -$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 -$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 ``` ### libarchive @@ -360,7 +343,7 @@ $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 If you see an error on macOS when compiling `libarchive`, run: ```bash -$ brew install pkg-config +brew install pkg-config ``` ### macOS `library not found for -lSystem` @@ -368,7 +351,7 @@ $ brew install pkg-config If you see this error when compiling, run: ```bash -$ xcode-select --install +xcode-select --install ``` ### Cannot find `libatomic.a` diff --git a/docs/runtime/templating/create.mdx b/docs/runtime/templating/create.mdx index 30c69b5c7b4a45..3d190da6fe02b3 100644 --- a/docs/runtime/templating/create.mdx +++ b/docs/runtime/templating/create.mdx @@ -19,7 +19,7 @@ If you're looking to create a brand new empty project, use [`bun init`](/runtime `bun create ./MyComponent.tsx` turns an existing React component into a complete dev environment with hot reload and production builds in one command. ```bash -$ bun create ./MyComponent.jsx # .tsx also supported +bun create ./MyComponent.jsx # .tsx also supported ``` diff --git a/docs/style.css b/docs/style.css index b84026277756bf..29b0d8d2f5cc48 100644 --- a/docs/style.css +++ b/docs/style.css @@ -149,25 +149,25 @@ div.callout .code-block { margin-bottom: 0px; } -.code-block[language="shellscript"] code span.line:not(:empty):has(span)::before { +[language="shellscript"] code span.line:not(:empty):has(span)::before { content: "$ "; color: #6272a4; user-select: none; } -.code-block[language="shellscript"] code span.line:has(> span:first-child[style*="color: rgb(98, 114, 164)"])::before, -.code-block[language="shellscript"] code span.line:has(> span:first-child[style*="#6272A4"])::before { +[language="shellscript"] code span.line:has(> span:first-child[style*="color: rgb(98, 114, 164)"])::before, +[language="shellscript"] code span.line:has(> span:first-child[style*="#6272A4"])::before { content: ""; } -.code-block[language="powershell"] code span.line:not(:empty):has(span)::before { +[language="powershell"] code span.line:not(:empty):has(span)::before { content: "> "; color: #6272a4; user-select: none; } -.code-block[language="powershell"] code span.line:has(> span:first-child[style*="color: rgb(98, 114, 164)"])::before, -.code-block[language="powershell"] code span.line:has(> span:first-child[style*="#6272A4"])::before { +[language="powershell"] code span.line:has(> span:first-child[style*="color: rgb(98, 114, 164)"])::before, +[language="powershell"] code span.line:has(> span:first-child[style*="#6272A4"])::before { content: ""; } diff --git a/flake.nix b/flake.nix index 43e12b391e3651..3fb940126895ae 100644 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,7 @@ pkgs.cmake # Expected: 3.30+ on nixos-unstable as of 2025-10 pkgs.ninja pkgs.pkg-config - pkgs.sccache + pkgs.ccache # Compilers and toolchain - version pinned to LLVM 19 clang diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index e0135432b0ca7c..44a32429d5d4b9 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -1942,6 +1942,16 @@ declare module "bun" { development?: boolean; }; + /** + * Enable React Fast Refresh transform. + * + * This adds the necessary code transformations for React Fast Refresh (hot module + * replacement for React components), but does not emit hot-module code itself. + * + * @default false + */ + reactFastRefresh?: boolean; + outdir?: string; } diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index 5164112d74a859..b4fba56480f6a7 100755 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -313,7 +313,7 @@ function Install-Build-Essentials { strawberryperl ` mingw Install-Rust - Install-Sccache + Install-Ccache # Needed to remap stack traces Install-PdbAddr2line Install-Llvm @@ -376,8 +376,8 @@ function Install-Rust { Add-To-Path "$rustPath\cargo\bin" } -function Install-Sccache { - Install-Package sccache -Version "0.12.0" +function Install-Ccache { + Install-Package ccache } function Install-PdbAddr2line { diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index c7be1336511994..5deb20a7c792e7 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Version: 25 +# Version: 26 # A script that installs the dependencies needed to build and test Bun. # This should work on macOS and Linux with a POSIX shell. @@ -1086,7 +1086,7 @@ install_build_essentials() { install_osxcross install_gcc install_rust - install_sccache + install_ccache install_docker } @@ -1206,35 +1206,24 @@ install_gcc() { execute_sudo ln -sf $(which llvm-symbolizer-$llvm_v) /usr/bin/llvm-symbolizer } -install_sccache() { - if [ "$os" != "linux" ]; then - error "Unsupported platform: $os" - fi - - # Alright, look, this function is cobbled together but it's only as cobbled - # together as this whole script is. - # - # For some reason, move_to_bin doesn't work here due to permissions so I'm - # avoiding that function. It's also wrong with permissions and so on. - # - # Unfortunately, we cannot use install_packages since many package managers - # don't compile `sccache` with S3 support. - local opts=$- - set -ef - - local sccache_http - sccache_http="https://github.com/mozilla/sccache/releases/download/v0.12.0/sccache-v0.12.0-$(uname -m)-unknown-linux-musl.tar.gz" - - local file - file=$(download_file "$sccache_http") - - local tmpdir - tmpdir=$(mktemp -d) - - execute tar -xzf "$file" -C "$tmpdir" - execute_sudo install -m755 "$tmpdir/sccache-v0.12.0-$(uname -m)-unknown-linux-musl/sccache" "/usr/local/bin" - - set +ef -"$opts" +install_ccache() { + case "$pm" in + apt) + install_packages ccache + ;; + brew) + install_packages ccache + ;; + apk) + install_packages ccache + ;; + dnf|yum) + install_packages ccache + ;; + zypper) + install_packages ccache + ;; + esac } install_rust() { @@ -1457,9 +1446,7 @@ create_buildkite_user() { done # The following is necessary to configure buildkite to use a stable - # checkout directory. sccache hashes absolute paths into its cache keys, - # so if buildkite uses a different checkout path each time (which it does - # by default), sccache will be useless. + # checkout directory for ccache to be effective. local opts=$- set -ef diff --git a/scripts/build-cache/bun.lock b/scripts/build-cache/bun.lock deleted file mode 100644 index b822c8148378ef..00000000000000 --- a/scripts/build-cache/bun.lock +++ /dev/null @@ -1,249 +0,0 @@ -{ - "lockfileVersion": 1, - "configVersion": 1, - "workspaces": { - "": { - "dependencies": { - "@aws-sdk/client-s3": "^3.928.0", - "@aws-sdk/property-provider": "^3.374.0", - }, - }, - }, - "packages": { - "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], - - "@aws-crypto/crc32c": ["@aws-crypto/crc32c@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-+iWb8qaHLYKrNvGRbiYRHSdKRWhto5XlZUEBwDjYNf+ly5SVYG6zEoYIdxvf5R3zyeP16w4PLBn3rH1xc74Rag=="], - - "@aws-crypto/sha1-browser": ["@aws-crypto/sha1-browser@5.2.0", "", { "dependencies": { "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-OH6lveCFfcDjX4dbAvCFSYUjJZjDr/3XJ3xHtjn3Oj5b9RjojQo8npoLeA/bNwkOkrSQ0wgrHzXk4tDRxGKJeg=="], - - "@aws-crypto/sha256-browser": ["@aws-crypto/sha256-browser@5.2.0", "", { "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw=="], - - "@aws-crypto/sha256-js": ["@aws-crypto/sha256-js@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA=="], - - "@aws-crypto/supports-web-crypto": ["@aws-crypto/supports-web-crypto@5.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg=="], - - "@aws-crypto/util": ["@aws-crypto/util@5.2.0", "", { "dependencies": { "@aws-sdk/types": "^3.222.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ=="], - - "@aws-sdk/client-s3": ["@aws-sdk/client-s3@3.928.0", "", { "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.928.0", "@aws-sdk/credential-provider-node": "3.928.0", "@aws-sdk/middleware-bucket-endpoint": "3.922.0", "@aws-sdk/middleware-expect-continue": "3.922.0", "@aws-sdk/middleware-flexible-checksums": "3.928.0", "@aws-sdk/middleware-host-header": "3.922.0", "@aws-sdk/middleware-location-constraint": "3.922.0", "@aws-sdk/middleware-logger": "3.922.0", "@aws-sdk/middleware-recursion-detection": "3.922.0", "@aws-sdk/middleware-sdk-s3": "3.928.0", "@aws-sdk/middleware-ssec": "3.922.0", "@aws-sdk/middleware-user-agent": "3.928.0", "@aws-sdk/region-config-resolver": "3.925.0", "@aws-sdk/signature-v4-multi-region": "3.928.0", "@aws-sdk/types": "3.922.0", "@aws-sdk/util-endpoints": "3.922.0", "@aws-sdk/util-user-agent-browser": "3.922.0", "@aws-sdk/util-user-agent-node": "3.928.0", "@aws-sdk/xml-builder": "3.921.0", "@smithy/config-resolver": "^4.4.2", "@smithy/core": "^3.17.2", "@smithy/eventstream-serde-browser": "^4.2.4", "@smithy/eventstream-serde-config-resolver": "^4.3.4", "@smithy/eventstream-serde-node": "^4.2.4", "@smithy/fetch-http-handler": "^5.3.5", "@smithy/hash-blob-browser": "^4.2.5", "@smithy/hash-node": "^4.2.4", "@smithy/hash-stream-node": "^4.2.4", "@smithy/invalid-dependency": "^4.2.4", "@smithy/md5-js": "^4.2.4", "@smithy/middleware-content-length": "^4.2.4", "@smithy/middleware-endpoint": "^4.3.6", "@smithy/middleware-retry": "^4.4.6", "@smithy/middleware-serde": "^4.2.4", "@smithy/middleware-stack": "^4.2.4", "@smithy/node-config-provider": "^4.3.4", "@smithy/node-http-handler": "^4.4.4", "@smithy/protocol-http": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/url-parser": "^4.2.4", "@smithy/util-base64": "^4.3.0", "@smithy/util-body-length-browser": "^4.2.0", "@smithy/util-body-length-node": "^4.2.1", "@smithy/util-defaults-mode-browser": "^4.3.5", "@smithy/util-defaults-mode-node": "^4.2.8", "@smithy/util-endpoints": "^3.2.4", "@smithy/util-middleware": "^4.2.4", "@smithy/util-retry": "^4.2.4", "@smithy/util-stream": "^4.5.5", "@smithy/util-utf8": "^4.2.0", "@smithy/util-waiter": "^4.2.4", "@smithy/uuid": "^1.1.0", "tslib": "^2.6.2" } }, "sha512-lXhhmcBjYa+ea0kRs00aq3WUwiXggwJkLwcMzOOsbW3CVYQaNpT7hztkfn2S6Qna7ETzd8M5+XZP+BmQRVE0Sg=="], - - "@aws-sdk/client-sso": ["@aws-sdk/client-sso@3.928.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.928.0", "@aws-sdk/middleware-host-header": "3.922.0", "@aws-sdk/middleware-logger": "3.922.0", "@aws-sdk/middleware-recursion-detection": "3.922.0", "@aws-sdk/middleware-user-agent": "3.928.0", "@aws-sdk/region-config-resolver": "3.925.0", "@aws-sdk/types": "3.922.0", "@aws-sdk/util-endpoints": "3.922.0", "@aws-sdk/util-user-agent-browser": "3.922.0", "@aws-sdk/util-user-agent-node": "3.928.0", "@smithy/config-resolver": "^4.4.2", "@smithy/core": "^3.17.2", "@smithy/fetch-http-handler": "^5.3.5", "@smithy/hash-node": "^4.2.4", "@smithy/invalid-dependency": "^4.2.4", "@smithy/middleware-content-length": "^4.2.4", "@smithy/middleware-endpoint": "^4.3.6", "@smithy/middleware-retry": "^4.4.6", "@smithy/middleware-serde": "^4.2.4", "@smithy/middleware-stack": "^4.2.4", "@smithy/node-config-provider": "^4.3.4", "@smithy/node-http-handler": "^4.4.4", "@smithy/protocol-http": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/url-parser": "^4.2.4", "@smithy/util-base64": "^4.3.0", "@smithy/util-body-length-browser": "^4.2.0", "@smithy/util-body-length-node": "^4.2.1", "@smithy/util-defaults-mode-browser": "^4.3.5", "@smithy/util-defaults-mode-node": "^4.2.8", "@smithy/util-endpoints": "^3.2.4", "@smithy/util-middleware": "^4.2.4", "@smithy/util-retry": "^4.2.4", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-Efenb8zV2fJJDXmp2NE4xj8Ymhp4gVJCkQ6ixhdrpfQXgd2PODO7a20C2+BhFM6aGmN3m6XWYJ64ZyhXF4pAyQ=="], - - "@aws-sdk/core": ["@aws-sdk/core@3.928.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@aws-sdk/xml-builder": "3.921.0", "@smithy/core": "^3.17.2", "@smithy/node-config-provider": "^4.3.4", "@smithy/property-provider": "^4.2.4", "@smithy/protocol-http": "^5.3.4", "@smithy/signature-v4": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/util-base64": "^4.3.0", "@smithy/util-middleware": "^4.2.4", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-e28J2uKjy2uub4u41dNnmzAu0AN3FGB+LRcLN2Qnwl9Oq3kIcByl5sM8ZD+vWpNG+SFUrUasBCq8cMnHxwXZ4w=="], - - "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/property-provider": "^4.2.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-tB8F9Ti0/NFyFVQX8UQtgRik88evtHpyT6WfXOB4bAY6lEnEHA0ubJZmk9y+aUeoE+OsGLx70dC3JUsiiCPJkQ=="], - - "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/fetch-http-handler": "^5.3.5", "@smithy/node-http-handler": "^4.4.4", "@smithy/property-provider": "^4.2.4", "@smithy/protocol-http": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/util-stream": "^4.5.5", "tslib": "^2.6.2" } }, "sha512-67ynC/8UW9Y8Gn1ZZtC3OgcQDGWrJelHmkbgpmmxYUrzVhp+NINtz3wiTzrrBFhPH/8Uy6BxvhMfXhn0ptcMEQ=="], - - "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/credential-provider-env": "3.928.0", "@aws-sdk/credential-provider-http": "3.928.0", "@aws-sdk/credential-provider-process": "3.928.0", "@aws-sdk/credential-provider-sso": "3.928.0", "@aws-sdk/credential-provider-web-identity": "3.928.0", "@aws-sdk/nested-clients": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/credential-provider-imds": "^4.2.4", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-WVWYyj+jox6mhKYp11mu8x1B6Xa2sLbXFHAv5K3Jg8CHvXYpePgTcYlCljq3d4XHC4Jl4nCcsdMtBahSpU9bAA=="], - - "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.928.0", "", { "dependencies": { "@aws-sdk/credential-provider-env": "3.928.0", "@aws-sdk/credential-provider-http": "3.928.0", "@aws-sdk/credential-provider-ini": "3.928.0", "@aws-sdk/credential-provider-process": "3.928.0", "@aws-sdk/credential-provider-sso": "3.928.0", "@aws-sdk/credential-provider-web-identity": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/credential-provider-imds": "^4.2.4", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-SdXVjxZOIXefIR/NJx+lyXOrn4m0ScTAU2JXpLsFCkW2Cafo6vTqHUghyO8vak/XQ8PpPqpLXVpGbAYFuIPW6Q=="], - - "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-XL0juran8yhqwn0mreV+NJeHJOkcRBaExsvVn9fXWW37A4gLh4esSJxM2KbSNh0t+/Bk3ehBI5sL9xad+yRDuw=="], - - "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.928.0", "", { "dependencies": { "@aws-sdk/client-sso": "3.928.0", "@aws-sdk/core": "3.928.0", "@aws-sdk/token-providers": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-md/y+ePDsO1zqPJrsOyPs4ciKmdpqLL7B0dln1NhqZPnKIS5IBfTqZJ5tJ9eTezqc7Tn4Dbg6HiuemcGvZTeFA=="], - - "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/nested-clients": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-rd97nLY5e/nGOr73ZfsXD+H44iZ9wyGZTKt/2QkiBN3hot/idhgT9+XHsWhRi+o/dThQbpL8RkpAnpF+0ZGthw=="], - - "@aws-sdk/middleware-bucket-endpoint": ["@aws-sdk/middleware-bucket-endpoint@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@aws-sdk/util-arn-parser": "3.893.0", "@smithy/node-config-provider": "^4.3.4", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "@smithy/util-config-provider": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-Dpr2YeOaLFqt3q1hocwBesynE3x8/dXZqXZRuzSX/9/VQcwYBFChHAm4mTAl4zuvArtDbLrwzWSxmOWYZGtq5w=="], - - "@aws-sdk/middleware-expect-continue": ["@aws-sdk/middleware-expect-continue@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-xmnLWMtmHJHJBupSWMUEW1gyxuRIeQ1Ov2xa8Tqq77fPr4Ft2AluEwiDMaZIMHoAvpxWKEEt9Si59Li7GIA+bQ=="], - - "@aws-sdk/middleware-flexible-checksums": ["@aws-sdk/middleware-flexible-checksums@3.928.0", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@aws-crypto/crc32c": "5.2.0", "@aws-crypto/util": "5.2.0", "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/is-array-buffer": "^4.2.0", "@smithy/node-config-provider": "^4.3.4", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "@smithy/util-middleware": "^4.2.4", "@smithy/util-stream": "^4.5.5", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-9+aCRt7teItSIMbnGvOY+FhtJnW2ZBUbfD+ug29a/ZbobDfTwmtrmtgEIWdXryFaRbT03HHfaJ3a++lTw4osuw=="], - - "@aws-sdk/middleware-host-header": ["@aws-sdk/middleware-host-header@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-HPquFgBnq/KqKRVkiuCt97PmWbKtxQ5iUNLEc6FIviqOoZTmaYG3EDsIbuFBz9C4RHJU4FKLmHL2bL3FEId6AA=="], - - "@aws-sdk/middleware-location-constraint": ["@aws-sdk/middleware-location-constraint@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-T4iqd7WQ2DDjCH/0s50mnhdoX+IJns83ZE+3zj9IDlpU0N2aq8R91IG890qTfYkUEdP9yRm0xir/CNed+v6Dew=="], - - "@aws-sdk/middleware-logger": ["@aws-sdk/middleware-logger@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-AkvYO6b80FBm5/kk2E636zNNcNgjztNNUxpqVx+huyGn9ZqGTzS4kLqW2hO6CBe5APzVtPCtiQsXL24nzuOlAg=="], - - "@aws-sdk/middleware-recursion-detection": ["@aws-sdk/middleware-recursion-detection@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@aws/lambda-invoke-store": "^0.1.1", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-TtSCEDonV/9R0VhVlCpxZbp/9sxQvTTRKzIf8LxW3uXpby6Wl8IxEciBJlxmSkoqxh542WRcko7NYODlvL/gDA=="], - - "@aws-sdk/middleware-sdk-s3": ["@aws-sdk/middleware-sdk-s3@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@aws-sdk/util-arn-parser": "3.893.0", "@smithy/core": "^3.17.2", "@smithy/node-config-provider": "^4.3.4", "@smithy/protocol-http": "^5.3.4", "@smithy/signature-v4": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/util-config-provider": "^4.2.0", "@smithy/util-middleware": "^4.2.4", "@smithy/util-stream": "^4.5.5", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-LTkjS6cpJ2PEtsottTKq7JxZV0oH+QJ12P/dGNPZL4URayjEMBVR/dp4zh835X/FPXzijga3sdotlIKzuFy9FA=="], - - "@aws-sdk/middleware-ssec": ["@aws-sdk/middleware-ssec@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-eHvSJZTSRJO+/tjjGD6ocnPc8q9o3m26+qbwQTu/4V6yOJQ1q+xkDZNqwJQphL+CodYaQ7uljp8g1Ji/AN3D9w=="], - - "@aws-sdk/middleware-user-agent": ["@aws-sdk/middleware-user-agent@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/types": "3.922.0", "@aws-sdk/util-endpoints": "3.922.0", "@smithy/core": "^3.17.2", "@smithy/protocol-http": "^5.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-ESvcfLx5PtpdUM3ptCwb80toBTd3y5I4w5jaeOPHihiZr7jkRLE/nsaCKzlqscPs6UQ8xI0maav04JUiTskcHw=="], - - "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.928.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.928.0", "@aws-sdk/middleware-host-header": "3.922.0", "@aws-sdk/middleware-logger": "3.922.0", "@aws-sdk/middleware-recursion-detection": "3.922.0", "@aws-sdk/middleware-user-agent": "3.928.0", "@aws-sdk/region-config-resolver": "3.925.0", "@aws-sdk/types": "3.922.0", "@aws-sdk/util-endpoints": "3.922.0", "@aws-sdk/util-user-agent-browser": "3.922.0", "@aws-sdk/util-user-agent-node": "3.928.0", "@smithy/config-resolver": "^4.4.2", "@smithy/core": "^3.17.2", "@smithy/fetch-http-handler": "^5.3.5", "@smithy/hash-node": "^4.2.4", "@smithy/invalid-dependency": "^4.2.4", "@smithy/middleware-content-length": "^4.2.4", "@smithy/middleware-endpoint": "^4.3.6", "@smithy/middleware-retry": "^4.4.6", "@smithy/middleware-serde": "^4.2.4", "@smithy/middleware-stack": "^4.2.4", "@smithy/node-config-provider": "^4.3.4", "@smithy/node-http-handler": "^4.4.4", "@smithy/protocol-http": "^5.3.4", "@smithy/smithy-client": "^4.9.2", "@smithy/types": "^4.8.1", "@smithy/url-parser": "^4.2.4", "@smithy/util-base64": "^4.3.0", "@smithy/util-body-length-browser": "^4.2.0", "@smithy/util-body-length-node": "^4.2.1", "@smithy/util-defaults-mode-browser": "^4.3.5", "@smithy/util-defaults-mode-node": "^4.2.8", "@smithy/util-endpoints": "^3.2.4", "@smithy/util-middleware": "^4.2.4", "@smithy/util-retry": "^4.2.4", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-kXzfJkq2cD65KAHDe4hZCsnxcGGEWD5pjHqcZplwG4VFMa/iVn/mWrUY9QdadD2GBpXFNQbgOiKG3U2NkKu+4Q=="], - - "@aws-sdk/property-provider": ["@aws-sdk/property-provider@3.374.0", "", { "dependencies": { "@smithy/property-provider": "^1.0.1", "tslib": "^2.5.0" } }, "sha512-UvsRnRtLD3g0tPMuiILJiGT9PIg4tgU3coRO4s+bAuT29mUiuViDAQB8DYPgaOtqA4qNFiWose+AMCpdxlOhRA=="], - - "@aws-sdk/region-config-resolver": ["@aws-sdk/region-config-resolver@3.925.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/config-resolver": "^4.4.2", "@smithy/node-config-provider": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-FOthcdF9oDb1pfQBRCfWPZhJZT5wqpvdAS5aJzB1WDZ+6EuaAhLzLH/fW1slDunIqq1PSQGG3uSnVglVVOvPHQ=="], - - "@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.928.0", "", { "dependencies": { "@aws-sdk/middleware-sdk-s3": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/protocol-http": "^5.3.4", "@smithy/signature-v4": "^5.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-1+Ic8+MyqQy+OE6QDoQKVCIcSZO+ETmLLLpVS5yu0fihBU85B5HHU7iaKX1qX7lEaGPMpSN/mbHW0VpyQ0Xqaw=="], - - "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.928.0", "", { "dependencies": { "@aws-sdk/core": "3.928.0", "@aws-sdk/nested-clients": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/property-provider": "^4.2.4", "@smithy/shared-ini-file-loader": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-533NpTdUJNDi98zBwRp4ZpZoqULrAVfc0YgIy+8AZHzk0v7N+v59O0d2Du3YO6zN4VU8HU8766DgKiyEag6Dzg=="], - - "@aws-sdk/types": ["@aws-sdk/types@3.922.0", "", { "dependencies": { "@smithy/types": "^4.8.1", "tslib": "^2.6.2" } }, "sha512-eLA6XjVobAUAMivvM7DBL79mnHyrm+32TkXNWZua5mnxF+6kQCfblKKJvxMZLGosO53/Ex46ogim8IY5Nbqv2w=="], - - "@aws-sdk/util-arn-parser": ["@aws-sdk/util-arn-parser@3.893.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-u8H4f2Zsi19DGnwj5FSZzDMhytYF/bCh37vAtBsn3cNDL3YG578X5oc+wSX54pM3tOxS+NY7tvOAo52SW7koUA=="], - - "@aws-sdk/util-endpoints": ["@aws-sdk/util-endpoints@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/types": "^4.8.1", "@smithy/url-parser": "^4.2.4", "@smithy/util-endpoints": "^3.2.4", "tslib": "^2.6.2" } }, "sha512-4ZdQCSuNMY8HMlR1YN4MRDdXuKd+uQTeKIr5/pIM+g3TjInZoj8imvXudjcrFGA63UF3t92YVTkBq88mg58RXQ=="], - - "@aws-sdk/util-locate-window": ["@aws-sdk/util-locate-window@3.893.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-T89pFfgat6c8nMmpI8eKjBcDcgJq36+m9oiXbcUzeU55MP9ZuGgBomGjGnHaEyF36jenW9gmg3NfZDm0AO2XPg=="], - - "@aws-sdk/util-user-agent-browser": ["@aws-sdk/util-user-agent-browser@3.922.0", "", { "dependencies": { "@aws-sdk/types": "3.922.0", "@smithy/types": "^4.8.1", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-qOJAERZ3Plj1st7M4Q5henl5FRpE30uLm6L9edZqZXGR6c7ry9jzexWamWVpQ4H4xVAVmiO9dIEBAfbq4mduOA=="], - - "@aws-sdk/util-user-agent-node": ["@aws-sdk/util-user-agent-node@3.928.0", "", { "dependencies": { "@aws-sdk/middleware-user-agent": "3.928.0", "@aws-sdk/types": "3.922.0", "@smithy/node-config-provider": "^4.3.4", "@smithy/types": "^4.8.1", "tslib": "^2.6.2" }, "peerDependencies": { "aws-crt": ">=1.0.0" }, "optionalPeers": ["aws-crt"] }, "sha512-s0jP67nQLLWVWfBtqTkZUkSWK5e6OI+rs+wFya2h9VLyWBFir17XSDI891s8HZKIVCEl8eBrup+hhywm4nsIAA=="], - - "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.921.0", "", { "dependencies": { "@smithy/types": "^4.8.1", "fast-xml-parser": "5.2.5", "tslib": "^2.6.2" } }, "sha512-LVHg0jgjyicKKvpNIEMXIMr1EBViESxcPkqfOlT+X1FkmUMTNZEEVF18tOJg4m4hV5vxtkWcqtr4IEeWa1C41Q=="], - - "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.1.1", "", {}, "sha512-RcLam17LdlbSOSp9VxmUu1eI6Mwxp+OwhD2QhiSNmNCzoDb0EeUXTD2n/WbcnrAYMGlmf05th6QYq23VqvJqpA=="], - - "@smithy/abort-controller": ["@smithy/abort-controller@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-j7HwVkBw68YW8UmFRcjZOmssE77Rvk0GWAIN1oFBhsaovQmZWYCIcGa9/pwRB0ExI8Sk9MWNALTjftjHZea7VA=="], - - "@smithy/chunked-blob-reader": ["@smithy/chunked-blob-reader@5.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-WmU0TnhEAJLWvfSeMxBNe5xtbselEO8+4wG0NtZeL8oR21WgH1xiO37El+/Y+H/Ie4SCwBy3MxYWmOYaGgZueA=="], - - "@smithy/chunked-blob-reader-native": ["@smithy/chunked-blob-reader-native@4.2.1", "", { "dependencies": { "@smithy/util-base64": "^4.3.0", "tslib": "^2.6.2" } }, "sha512-lX9Ay+6LisTfpLid2zZtIhSEjHMZoAR5hHCR4H7tBz/Zkfr5ea8RcQ7Tk4mi0P76p4cN+Btz16Ffno7YHpKXnQ=="], - - "@smithy/config-resolver": ["@smithy/config-resolver@4.4.3", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.5", "@smithy/types": "^4.9.0", "@smithy/util-config-provider": "^4.2.0", "@smithy/util-endpoints": "^3.2.5", "@smithy/util-middleware": "^4.2.5", "tslib": "^2.6.2" } }, "sha512-ezHLe1tKLUxDJo2LHtDuEDyWXolw8WGOR92qb4bQdWq/zKenO5BvctZGrVJBK08zjezSk7bmbKFOXIVyChvDLw=="], - - "@smithy/core": ["@smithy/core@3.18.0", "", { "dependencies": { "@smithy/middleware-serde": "^4.2.5", "@smithy/protocol-http": "^5.3.5", "@smithy/types": "^4.9.0", "@smithy/util-base64": "^4.3.0", "@smithy/util-body-length-browser": "^4.2.0", "@smithy/util-middleware": "^4.2.5", "@smithy/util-stream": "^4.5.6", "@smithy/util-utf8": "^4.2.0", "@smithy/uuid": "^1.1.0", "tslib": "^2.6.2" } }, "sha512-vGSDXOJFZgOPTatSI1ly7Gwyy/d/R9zh2TO3y0JZ0uut5qQ88p9IaWaZYIWSSqtdekNM4CGok/JppxbAff4KcQ=="], - - "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.2.5", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.5", "@smithy/property-provider": "^4.2.5", "@smithy/types": "^4.9.0", "@smithy/url-parser": "^4.2.5", "tslib": "^2.6.2" } }, "sha512-BZwotjoZWn9+36nimwm/OLIcVe+KYRwzMjfhd4QT7QxPm9WY0HiOV8t/Wlh+HVUif0SBVV7ksq8//hPaBC/okQ=="], - - "@smithy/eventstream-codec": ["@smithy/eventstream-codec@4.2.5", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.9.0", "@smithy/util-hex-encoding": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-Ogt4Zi9hEbIP17oQMd68qYOHUzmH47UkK7q7Gl55iIm9oKt27MUGrC5JfpMroeHjdkOliOA4Qt3NQ1xMq/nrlA=="], - - "@smithy/eventstream-serde-browser": ["@smithy/eventstream-serde-browser@4.2.5", "", { "dependencies": { "@smithy/eventstream-serde-universal": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-HohfmCQZjppVnKX2PnXlf47CW3j92Ki6T/vkAT2DhBR47e89pen3s4fIa7otGTtrVxmj7q+IhH0RnC5kpR8wtw=="], - - "@smithy/eventstream-serde-config-resolver": ["@smithy/eventstream-serde-config-resolver@4.3.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-ibjQjM7wEXtECiT6my1xfiMH9IcEczMOS6xiCQXoUIYSj5b1CpBbJ3VYbdwDy8Vcg5JHN7eFpOCGk8nyZAltNQ=="], - - "@smithy/eventstream-serde-node": ["@smithy/eventstream-serde-node@4.2.5", "", { "dependencies": { "@smithy/eventstream-serde-universal": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-+elOuaYx6F2H6x1/5BQP5ugv12nfJl66GhxON8+dWVUEDJ9jah/A0tayVdkLRP0AeSac0inYkDz5qBFKfVp2Gg=="], - - "@smithy/eventstream-serde-universal": ["@smithy/eventstream-serde-universal@4.2.5", "", { "dependencies": { "@smithy/eventstream-codec": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-G9WSqbST45bmIFaeNuP/EnC19Rhp54CcVdX9PDL1zyEB514WsDVXhlyihKlGXnRycmHNmVv88Bvvt4EYxWef/Q=="], - - "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.3.6", "", { "dependencies": { "@smithy/protocol-http": "^5.3.5", "@smithy/querystring-builder": "^4.2.5", "@smithy/types": "^4.9.0", "@smithy/util-base64": "^4.3.0", "tslib": "^2.6.2" } }, "sha512-3+RG3EA6BBJ/ofZUeTFJA7mHfSYrZtQIrDP9dI8Lf7X6Jbos2jptuLrAAteDiFVrmbEmLSuRG/bUKzfAXk7dhg=="], - - "@smithy/hash-blob-browser": ["@smithy/hash-blob-browser@4.2.6", "", { "dependencies": { "@smithy/chunked-blob-reader": "^5.2.0", "@smithy/chunked-blob-reader-native": "^4.2.1", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8P//tA8DVPk+3XURk2rwcKgYwFvwGwmJH/wJqQiSKwXZtf/LiZK+hbUZmPj/9KzM+OVSwe4o85KTp5x9DUZTjw=="], - - "@smithy/hash-node": ["@smithy/hash-node@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "@smithy/util-buffer-from": "^4.2.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-DpYX914YOfA3UDT9CN1BM787PcHfWRBB43fFGCYrZFUH0Jv+5t8yYl+Pd5PW4+QzoGEDvn5d5QIO4j2HyYZQSA=="], - - "@smithy/hash-stream-node": ["@smithy/hash-stream-node@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-6+do24VnEyvWcGdHXomlpd0m8bfZePpUKBy7m311n+JuRwug8J4dCanJdTymx//8mi0nlkflZBvJe+dEO/O12Q=="], - - "@smithy/invalid-dependency": ["@smithy/invalid-dependency@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-2L2erASEro1WC5nV+plwIMxrTXpvpfzl4e+Nre6vBVRR2HKeGGcvpJyyL3/PpiSg+cJG2KpTmZmq934Olb6e5A=="], - - "@smithy/is-array-buffer": ["@smithy/is-array-buffer@4.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-DZZZBvC7sjcYh4MazJSGiWMI2L7E0oCiRHREDzIxi/M2LY79/21iXt6aPLHge82wi5LsuRF5A06Ds3+0mlh6CQ=="], - - "@smithy/md5-js": ["@smithy/md5-js@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-Bt6jpSTMWfjCtC0s79gZ/WZ1w90grfmopVOWqkI2ovhjpD5Q2XRXuecIPB9689L2+cCySMbaXDhBPU56FKNDNg=="], - - "@smithy/middleware-content-length": ["@smithy/middleware-content-length@4.2.5", "", { "dependencies": { "@smithy/protocol-http": "^5.3.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-Y/RabVa5vbl5FuHYV2vUCwvh/dqzrEY/K2yWPSqvhFUwIY0atLqO4TienjBXakoy4zrKAMCZwg+YEqmH7jaN7A=="], - - "@smithy/middleware-endpoint": ["@smithy/middleware-endpoint@4.3.7", "", { "dependencies": { "@smithy/core": "^3.18.0", "@smithy/middleware-serde": "^4.2.5", "@smithy/node-config-provider": "^4.3.5", "@smithy/shared-ini-file-loader": "^4.4.0", "@smithy/types": "^4.9.0", "@smithy/url-parser": "^4.2.5", "@smithy/util-middleware": "^4.2.5", "tslib": "^2.6.2" } }, "sha512-i8Mi8OuY6Yi82Foe3iu7/yhBj1HBRoOQwBSsUNYglJTNSFaWYTNM2NauBBs/7pq2sqkLRqeUXA3Ogi2utzpUlQ=="], - - "@smithy/middleware-retry": ["@smithy/middleware-retry@4.4.7", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.5", "@smithy/protocol-http": "^5.3.5", "@smithy/service-error-classification": "^4.2.5", "@smithy/smithy-client": "^4.9.3", "@smithy/types": "^4.9.0", "@smithy/util-middleware": "^4.2.5", "@smithy/util-retry": "^4.2.5", "@smithy/uuid": "^1.1.0", "tslib": "^2.6.2" } }, "sha512-E7Vc6WHCHlzDRTx1W0jZ6J1L6ziEV0PIWcUdmfL4y+c8r7WYr6I+LkQudaD8Nfb7C5c4P3SQ972OmXHtv6m/OA=="], - - "@smithy/middleware-serde": ["@smithy/middleware-serde@4.2.5", "", { "dependencies": { "@smithy/protocol-http": "^5.3.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-La1ldWTJTZ5NqQyPqnCNeH9B+zjFhrNoQIL1jTh4zuqXRlmXhxYHhMtI1/92OlnoAtp6JoN7kzuwhWoXrBwPqg=="], - - "@smithy/middleware-stack": ["@smithy/middleware-stack@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-bYrutc+neOyWxtZdbB2USbQttZN0mXaOyYLIsaTbJhFsfpXyGWUxJpEuO1rJ8IIJm2qH4+xJT0mxUSsEDTYwdQ=="], - - "@smithy/node-config-provider": ["@smithy/node-config-provider@4.3.5", "", { "dependencies": { "@smithy/property-provider": "^4.2.5", "@smithy/shared-ini-file-loader": "^4.4.0", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-UTurh1C4qkVCtqggI36DGbLB2Kv8UlcFdMXDcWMbqVY2uRg0XmT9Pb4Vj6oSQ34eizO1fvR0RnFV4Axw4IrrAg=="], - - "@smithy/node-http-handler": ["@smithy/node-http-handler@4.4.5", "", { "dependencies": { "@smithy/abort-controller": "^4.2.5", "@smithy/protocol-http": "^5.3.5", "@smithy/querystring-builder": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-CMnzM9R2WqlqXQGtIlsHMEZfXKJVTIrqCNoSd/QpAyp+Dw0a1Vps13l6ma1fH8g7zSPNsA59B/kWgeylFuA/lw=="], - - "@smithy/property-provider": ["@smithy/property-provider@1.2.0", "", { "dependencies": { "@smithy/types": "^1.2.0", "tslib": "^2.5.0" } }, "sha512-qlJd9gT751i4T0t/hJAyNGfESfi08Fek8QiLcysoKPgR05qHhG0OYhlaCJHhpXy4ECW0lHyjvFM1smrCLIXVfw=="], - - "@smithy/protocol-http": ["@smithy/protocol-http@5.3.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-RlaL+sA0LNMp03bf7XPbFmT5gN+w3besXSWMkA8rcmxLSVfiEXElQi4O2IWwPfxzcHkxqrwBFMbngB8yx/RvaQ=="], - - "@smithy/querystring-builder": ["@smithy/querystring-builder@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "@smithy/util-uri-escape": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-y98otMI1saoajeik2kLfGyRp11e5U/iJYH/wLCh3aTV/XutbGT9nziKGkgCaMD1ghK7p6htHMm6b6scl9JRUWg=="], - - "@smithy/querystring-parser": ["@smithy/querystring-parser@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-031WCTdPYgiQRYNPXznHXof2YM0GwL6SeaSyTH/P72M1Vz73TvCNH2Nq8Iu2IEPq9QP2yx0/nrw5YmSeAi/AjQ=="], - - "@smithy/service-error-classification": ["@smithy/service-error-classification@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0" } }, "sha512-8fEvK+WPE3wUAcDvqDQG1Vk3ANLR8Px979te96m84CbKAjBVf25rPYSzb4xU4hlTyho7VhOGnh5i62D/JVF0JQ=="], - - "@smithy/shared-ini-file-loader": ["@smithy/shared-ini-file-loader@4.4.0", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-5WmZ5+kJgJDjwXXIzr1vDTG+RhF9wzSODQBfkrQ2VVkYALKGvZX1lgVSxEkgicSAFnFhPj5rudJV0zoinqS0bA=="], - - "@smithy/signature-v4": ["@smithy/signature-v4@5.3.5", "", { "dependencies": { "@smithy/is-array-buffer": "^4.2.0", "@smithy/protocol-http": "^5.3.5", "@smithy/types": "^4.9.0", "@smithy/util-hex-encoding": "^4.2.0", "@smithy/util-middleware": "^4.2.5", "@smithy/util-uri-escape": "^4.2.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-xSUfMu1FT7ccfSXkoLl/QRQBi2rOvi3tiBZU2Tdy3I6cgvZ6SEi9QNey+lqps/sJRnogIS+lq+B1gxxbra2a/w=="], - - "@smithy/smithy-client": ["@smithy/smithy-client@4.9.3", "", { "dependencies": { "@smithy/core": "^3.18.0", "@smithy/middleware-endpoint": "^4.3.7", "@smithy/middleware-stack": "^4.2.5", "@smithy/protocol-http": "^5.3.5", "@smithy/types": "^4.9.0", "@smithy/util-stream": "^4.5.6", "tslib": "^2.6.2" } }, "sha512-8tlueuTgV5n7inQCkhyptrB3jo2AO80uGrps/XTYZivv5MFQKKBj3CIWIGMI2fRY5LEduIiazOhAWdFknY1O9w=="], - - "@smithy/types": ["@smithy/types@4.9.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-MvUbdnXDTwykR8cB1WZvNNwqoWVaTRA0RLlLmf/cIFNMM2cKWz01X4Ly6SMC4Kks30r8tT3Cty0jmeWfiuyHTA=="], - - "@smithy/url-parser": ["@smithy/url-parser@4.2.5", "", { "dependencies": { "@smithy/querystring-parser": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-VaxMGsilqFnK1CeBX+LXnSuaMx4sTL/6znSZh2829txWieazdVxr54HmiyTsIbpOTLcf5nYpq9lpzmwRdxj6rQ=="], - - "@smithy/util-base64": ["@smithy/util-base64@4.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-GkXZ59JfyxsIwNTWFnjmFEI8kZpRNIBfxKjv09+nkAWPt/4aGaEWMM04m4sxgNVWkbt2MdSvE3KF/PfX4nFedQ=="], - - "@smithy/util-body-length-browser": ["@smithy/util-body-length-browser@4.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Fkoh/I76szMKJnBXWPdFkQJl2r9SjPt3cMzLdOB6eJ4Pnpas8hVoWPYemX/peO0yrrvldgCUVJqOAjUrOLjbxg=="], - - "@smithy/util-body-length-node": ["@smithy/util-body-length-node@4.2.1", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-h53dz/pISVrVrfxV1iqXlx5pRg3V2YWFcSQyPyXZRrZoZj4R4DeWRDo1a7dd3CPTcFi3kE+98tuNyD2axyZReA=="], - - "@smithy/util-buffer-from": ["@smithy/util-buffer-from@4.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-kAY9hTKulTNevM2nlRtxAG2FQ3B2OR6QIrPY3zE5LqJy1oxzmgBGsHLWTcNhWXKchgA0WHW+mZkQrng/pgcCew=="], - - "@smithy/util-config-provider": ["@smithy/util-config-provider@4.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-YEjpl6XJ36FTKmD+kRJJWYvrHeUvm5ykaUS5xK+6oXffQPHeEM4/nXlZPe+Wu0lsgRUcNZiliYNh/y7q9c2y6Q=="], - - "@smithy/util-defaults-mode-browser": ["@smithy/util-defaults-mode-browser@4.3.6", "", { "dependencies": { "@smithy/property-provider": "^4.2.5", "@smithy/smithy-client": "^4.9.3", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-kbpuXbEf2YQ9zEE6eeVnUCQWO0e1BjMnKrXL8rfXgiWA0m8/E0leU4oSNzxP04WfCmW8vjEqaDeXWxwE4tpOjQ=="], - - "@smithy/util-defaults-mode-node": ["@smithy/util-defaults-mode-node@4.2.9", "", { "dependencies": { "@smithy/config-resolver": "^4.4.3", "@smithy/credential-provider-imds": "^4.2.5", "@smithy/node-config-provider": "^4.3.5", "@smithy/property-provider": "^4.2.5", "@smithy/smithy-client": "^4.9.3", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-dgyribrVWN5qE5usYJ0m5M93mVM3L3TyBPZWe1Xl6uZlH2gzfQx3dz+ZCdW93lWqdedJRkOecnvbnoEEXRZ5VQ=="], - - "@smithy/util-endpoints": ["@smithy/util-endpoints@3.2.5", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-3O63AAWu2cSNQZp+ayl9I3NapW1p1rR5mlVHcF6hAB1dPZUQFfRPYtplWX/3xrzWthPGj5FqB12taJJCfH6s8A=="], - - "@smithy/util-hex-encoding": ["@smithy/util-hex-encoding@4.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-CCQBwJIvXMLKxVbO88IukazJD9a4kQ9ZN7/UMGBjBcJYvatpWk+9g870El4cB8/EJxfe+k+y0GmR9CAzkF+Nbw=="], - - "@smithy/util-middleware": ["@smithy/util-middleware@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-6Y3+rvBF7+PZOc40ybeZMcGln6xJGVeY60E7jy9Mv5iKpMJpHgRE6dKy9ScsVxvfAYuEX4Q9a65DQX90KaQ3bA=="], - - "@smithy/util-retry": ["@smithy/util-retry@4.2.5", "", { "dependencies": { "@smithy/service-error-classification": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-GBj3+EZBbN4NAqJ/7pAhsXdfzdlznOh8PydUijy6FpNIMnHPSMO2/rP4HKu+UFeikJxShERk528oy7GT79YiJg=="], - - "@smithy/util-stream": ["@smithy/util-stream@4.5.6", "", { "dependencies": { "@smithy/fetch-http-handler": "^5.3.6", "@smithy/node-http-handler": "^4.4.5", "@smithy/types": "^4.9.0", "@smithy/util-base64": "^4.3.0", "@smithy/util-buffer-from": "^4.2.0", "@smithy/util-hex-encoding": "^4.2.0", "@smithy/util-utf8": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-qWw/UM59TiaFrPevefOZ8CNBKbYEP6wBAIlLqxn3VAIo9rgnTNc4ASbVrqDmhuwI87usnjhdQrxodzAGFFzbRQ=="], - - "@smithy/util-uri-escape": ["@smithy/util-uri-escape@4.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-igZpCKV9+E/Mzrpq6YacdTQ0qTiLm85gD6N/IrmyDvQFA4UnU3d5g3m8tMT/6zG/vVkWSU+VxeUyGonL62DuxA=="], - - "@smithy/util-utf8": ["@smithy/util-utf8@4.2.0", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-zBPfuzoI8xyBtR2P6WQj63Rz8i3AmfAaJLuNG8dWsfvPe8lO4aCPYLn879mEgHndZH1zQ2oXmG8O1GGzzaoZiw=="], - - "@smithy/util-waiter": ["@smithy/util-waiter@4.2.5", "", { "dependencies": { "@smithy/abort-controller": "^4.2.5", "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-Dbun99A3InifQdIrsXZ+QLcC0PGBPAdrl4cj1mTgJvyc9N2zf7QSxg8TBkzsCmGJdE3TLbO9ycwpY0EkWahQ/g=="], - - "@smithy/uuid": ["@smithy/uuid@1.1.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-4aUIteuyxtBUhVdiQqcDhKFitwfd9hqoSDYY2KRXiWtgoWJ9Bmise+KfEPDiVHWeJepvF8xJO9/9+WDIciMFFw=="], - - "bowser": ["bowser@2.12.1", "", {}, "sha512-z4rE2Gxh7tvshQ4hluIT7XcFrgLIQaw9X3A+kTTRdovCz5PMukm/0QC/BKSYPj3omF5Qfypn9O/c5kgpmvYUCw=="], - - "fast-xml-parser": ["fast-xml-parser@5.2.5", "", { "dependencies": { "strnum": "^2.1.0" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-pfX9uG9Ki0yekDHx2SiuRIyFdyAr1kMIMitPvb0YBo8SUfKvia7w7FIyd/l6av85pFYRhZscS75MwMnbvY+hcQ=="], - - "strnum": ["strnum@2.1.1", "", {}, "sha512-7ZvoFTiCnGxBtDqJ//Cu6fWtZtc7Y3x+QOirG15wztbdngGSkht27o2pyGWrVy0b4WAy3jbKmnoK6g5VlVNUUw=="], - - "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-crypto/sha1-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], - - "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], - - "@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], - - "@aws-sdk/core/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-env/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-http/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-ini/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-node/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-process/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-sso/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/credential-provider-web-identity/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-sdk/token-providers/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@smithy/credential-provider-imds/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@smithy/node-config-provider/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@smithy/property-provider/@smithy/types": ["@smithy/types@1.2.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA=="], - - "@smithy/util-defaults-mode-browser/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@smithy/util-defaults-mode-node/@smithy/property-provider": ["@smithy/property-provider@4.2.5", "", { "dependencies": { "@smithy/types": "^4.9.0", "tslib": "^2.6.2" } }, "sha512-8iLN1XSE1rl4MuxvQ+5OSk/Zb5El7NJZ1td6Tn+8dQQHIjp59Lwl6bd0+nzw6SKm2wSSriH2v/I9LPzUic7EOg=="], - - "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], - - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], - - "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], - - "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - - "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - } -} diff --git a/scripts/build-cache/have-access.ts b/scripts/build-cache/have-access.ts deleted file mode 100644 index e3a28b9ccb2760..00000000000000 --- a/scripts/build-cache/have-access.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Test whether the current user has access to the Bun build-cache. - * - * Exits with code 0 if access is available, or 1 otherwise. - */ -import { HeadBucketCommand, S3Client } from "@aws-sdk/client-s3"; -import { CredentialsProviderError } from "@aws-sdk/property-provider"; - -class CacheConfig { - #bucket: string; - #region: string; - - get bucket(): string { - return this.#bucket; - } - - get region(): string { - return this.#region; - } - - static fromArgv(): CacheConfig { - const cacheConfig = new CacheConfig(); - - const exitWithHelp = (reason: string) => { - console.error(`Error: ${reason}\n`); - console.error("Usage: have-access --bucket --region "); - process.exit(1); - }; - - for (let i = 2; i < process.argv.length; i++) { - switch (process.argv[i]) { - case "-b": - case "--bucket": - cacheConfig.#bucket = process.argv[++i]; - break; - case "-r": - case "--region": - cacheConfig.#region = process.argv[++i]; - break; - default: - exitWithHelp(`Unknown argument: ${process.argv[i]}`); - } - } - - if (!cacheConfig.#bucket) { - exitWithHelp("Missing required argument: --bucket"); - } - - if (!cacheConfig.#region) { - exitWithHelp("Missing required argument: --region"); - } - - return cacheConfig; - } -} - -/** - * Test whether the current user has access to the Bun build-cache. - */ -async function currentUserHasAccess(cacheConfig: CacheConfig): Promise { - const s3Client = new S3Client({ region: cacheConfig.region }); - - try { - await s3Client.send(new HeadBucketCommand({ Bucket: cacheConfig.bucket })); - return true; - } catch (error) { - if ( - error.name === "NotFound" || - error.$metadata?.httpStatusCode === 404 || - error.name === "Forbidden" || - error.$metadata?.httpStatusCode === 403 || - error instanceof CredentialsProviderError - ) { - return false; - } - - throw error; - } -} - -const ok = await currentUserHasAccess(CacheConfig.fromArgv()); -process.exit(ok ? 0 : 1); diff --git a/scripts/build-cache/package.json b/scripts/build-cache/package.json deleted file mode 100644 index 79e2d130a13d0a..00000000000000 --- a/scripts/build-cache/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "@aws-sdk/client-s3": "^3.928.0", - "@aws-sdk/property-provider": "^3.374.0" - } -} diff --git a/scripts/build.mjs b/scripts/build.mjs index 2607b11a73172c..34ce12247c66f5 100755 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -108,8 +108,8 @@ async function build(args) { await startGroup("CMake Build", () => spawn("cmake", buildArgs, { env })); if (ciCppBuild) { - await startGroup("sccache stats", () => { - spawn("sccache", ["--show-stats"], { env }); + await startGroup("ccache stats", () => { + spawn("ccache", ["--show-stats"], { env }); }); } diff --git a/shell.nix b/shell.nix index 22c4315dec563f..571c66d17601df 100644 --- a/shell.nix +++ b/shell.nix @@ -17,7 +17,7 @@ pkgs.mkShell rec { cargo go python3 - sccache + ccache pkg-config gnumake libtool diff --git a/src/ast/Expr.zig b/src/ast/Expr.zig index 8b3052a0d932bc..aa9f7eb5b58a81 100644 --- a/src/ast/Expr.zig +++ b/src/ast/Expr.zig @@ -617,7 +617,7 @@ pub fn joinAllWithCommaCallback(all: []Expr, comptime Context: type, ctx: Contex return callback(ctx, all[0]); }, 2 => { - return Expr.joinWithComma( + const result = Expr.joinWithComma( callback(ctx, all[0]) orelse Expr{ .data = .{ .e_missing = .{} }, .loc = all[0].loc, @@ -628,6 +628,10 @@ pub fn joinAllWithCommaCallback(all: []Expr, comptime Context: type, ctx: Contex }, allocator, ); + if (result.isMissing()) { + return null; + } + return result; }, else => { var i: usize = 1; @@ -643,6 +647,9 @@ pub fn joinAllWithCommaCallback(all: []Expr, comptime Context: type, ctx: Contex }, allocator); } + if (expr.isMissing()) { + return null; + } return expr; }, } diff --git a/src/ast/SideEffects.zig b/src/ast/SideEffects.zig index 37d64a0294d52c..44c25896da46e5 100644 --- a/src/ast/SideEffects.zig +++ b/src/ast/SideEffects.zig @@ -315,6 +315,10 @@ pub const SideEffects = enum(u1) { ); } + if (result.isMissing()) { + return null; + } + return result; }, .e_array => { diff --git a/src/bake/BakeGlobalObject.cpp b/src/bake/BakeGlobalObject.cpp index f7ca1b4231941a..b5c25eecac1c4e 100644 --- a/src/bake/BakeGlobalObject.cpp +++ b/src/bake/BakeGlobalObject.cpp @@ -141,10 +141,10 @@ JSC::JSInternalPromise* bakeModuleLoaderFetch(JSC::JSGlobalObject* globalObject, globalObject, source.toWTFString(), origin, - WTFMove(moduleKey), + WTF::move(moduleKey), WTF::TextPosition(), JSC::SourceProviderSourceType::Module)); - return resolvedInternalPromise(globalObject, JSC::JSSourceCode::create(vm, WTFMove(sourceCode))); + return resolvedInternalPromise(globalObject, JSC::JSSourceCode::create(vm, WTF::move(sourceCode))); } // We unconditionally prefix the key with "bake:" inside diff --git a/src/bake/BakeSourceProvider.cpp b/src/bake/BakeSourceProvider.cpp index 8efa3d8d347596..24353dcb7bf863 100644 --- a/src/bake/BakeSourceProvider.cpp +++ b/src/bake/BakeSourceProvider.cpp @@ -33,7 +33,7 @@ extern "C" JSC::EncodedJSValue BakeLoadInitialServerCode(JSC::JSGlobalObject* gl global, source.toWTFString(), origin, - WTFMove(string), + WTF::move(string), WTF::TextPosition(), JSC::SourceProviderSourceType::Program )); @@ -67,7 +67,7 @@ extern "C" JSC::EncodedJSValue BakeLoadServerHmrPatch(GlobalObject* global, BunS global, source.toWTFString(), origin, - WTFMove(string), + WTF::move(string), WTF::TextPosition(), JSC::SourceProviderSourceType::Program )); @@ -93,7 +93,7 @@ extern "C" JSC::EncodedJSValue BakeLoadServerHmrPatchWithSourceMap(GlobalObject* sourceMapJSONPtr, sourceMapJSONLength, origin, - WTFMove(string), + WTF::move(string), WTF::TextPosition(), JSC::SourceProviderSourceType::Program ); @@ -159,7 +159,7 @@ extern "C" JSC::EncodedJSValue BakeRegisterProductionChunk(JSC::JSGlobalObject* global, source.toWTFString(), origin, - WTFMove(string), + WTF::move(string), WTF::TextPosition(), JSC::SourceProviderSourceType::Module )); diff --git a/src/bake/BakeSourceProvider.h b/src/bake/BakeSourceProvider.h index 7055fcedbea61b..2b6ffe495d59c9 100644 --- a/src/bake/BakeSourceProvider.h +++ b/src/bake/BakeSourceProvider.h @@ -20,7 +20,7 @@ class SourceProvider final : public JSC::StringSourceProvider { const TextPosition& startPosition, JSC::SourceProviderSourceType sourceType) { - auto provider = adoptRef(*new SourceProvider(source, sourceOrigin, WTFMove(sourceURL), startPosition, sourceType)); + auto provider = adoptRef(*new SourceProvider(source, sourceOrigin, WTF::move(sourceURL), startPosition, sourceType)); auto* zigGlobalObject = jsCast(globalObject); auto specifier = Bun::toString(provider->sourceURL()); Bun__addBakeSourceProviderSourceMap(zigGlobalObject->bunVM(), provider.ptr(), &specifier); @@ -38,7 +38,7 @@ class SourceProvider final : public JSC::StringSourceProvider { source, sourceOrigin, JSC::SourceTaintedOrigin::Untainted, - WTFMove(sourceURL), + WTF::move(sourceURL), startPosition, sourceType) { diff --git a/src/bake/DevServerSourceProvider.h b/src/bake/DevServerSourceProvider.h index 7667b6f811c176..d18087dd147f7d 100644 --- a/src/bake/DevServerSourceProvider.h +++ b/src/bake/DevServerSourceProvider.h @@ -25,7 +25,7 @@ class DevServerSourceProvider final : public JSC::StringSourceProvider { const TextPosition& startPosition, JSC::SourceProviderSourceType sourceType) { - auto provider = adoptRef(*new DevServerSourceProvider(source, sourceMapJSONPtr, sourceMapJSONLength, sourceOrigin, WTFMove(sourceURL), startPosition, sourceType)); + auto provider = adoptRef(*new DevServerSourceProvider(source, sourceMapJSONPtr, sourceMapJSONLength, sourceOrigin, WTF::move(sourceURL), startPosition, sourceType)); auto* zigGlobalObject = jsCast<::Zig::GlobalObject*>(globalObject); auto specifier = Bun::toString(provider->sourceURL()); provider->m_globalObject = zigGlobalObject; @@ -52,7 +52,7 @@ class DevServerSourceProvider final : public JSC::StringSourceProvider { source, sourceOrigin, JSC::SourceTaintedOrigin::Untainted, - WTFMove(sourceURL), + WTF::move(sourceURL), startPosition, sourceType) , m_sourceMapJSON(sourceMapJSONPtr, sourceMapJSONLength) diff --git a/src/bun.js/ConsoleObject.zig b/src/bun.js/ConsoleObject.zig index f9d540ed11edcd..491689ecc43800 100644 --- a/src/bun.js/ConsoleObject.zig +++ b/src/bun.js/ConsoleObject.zig @@ -1629,11 +1629,11 @@ pub const Formatter = struct { }, .j => { - // JSON.stringify the value + // JSON.stringify the value using FastStringifier for SIMD optimization var str = bun.String.empty; defer str.deref(); - try next_value.jsonStringify(global, 0, &str); + try next_value.jsonStringifyFast(global, &str); this.addForNewLine(str.length()); writer.print("{f}", .{str}); }, diff --git a/src/bun.js/JSONLineBuffer.zig b/src/bun.js/JSONLineBuffer.zig new file mode 100644 index 00000000000000..b4b2833005dea6 --- /dev/null +++ b/src/bun.js/JSONLineBuffer.zig @@ -0,0 +1,135 @@ +/// Buffer for newline-delimited data that tracks scan positions to avoid O(n²) scanning. +/// Each byte is scanned exactly once. We track: +/// - newline_pos: position of first known newline (if any) +/// - scanned_pos: how far we've scanned (bytes before this have been checked) +/// - head: offset into the buffer where unconsumed data starts (avoids copying on each consume) +/// +/// When data arrives, we only scan the NEW bytes. +/// When we consume a message, we just advance `head` instead of copying. +/// Compaction only happens when head exceeds a threshold. +pub const JSONLineBuffer = struct { + data: bun.ByteList = .{}, + /// Offset into data where unconsumed content starts. + head: u32 = 0, + /// Position of a known upcoming newline relative to head, if any. + newline_pos: ?u32 = null, + /// How far we've scanned for newlines relative to head. + scanned_pos: u32 = 0, + + /// Compact the buffer when head exceeds this threshold. + const compaction_threshold = 16 * 1024 * 1024; // 16 MB + + /// Get the active (unconsumed) portion of the buffer. + fn activeSlice(self: *const @This()) []const u8 { + return self.data.slice()[self.head..]; + } + + /// Scan for newline in unscanned portion of the buffer. + fn scanForNewline(self: *@This()) void { + if (self.newline_pos != null) return; + const slice = self.activeSlice(); + if (self.scanned_pos >= slice.len) return; + + const unscanned = slice[self.scanned_pos..]; + if (bun.strings.indexOfChar(unscanned, '\n')) |local_idx| { + bun.debugAssert(local_idx <= std.math.maxInt(u32)); + const pos = self.scanned_pos +| @as(u32, @intCast(local_idx)); + self.newline_pos = pos; + self.scanned_pos = pos +| 1; // Only scanned up to (and including) the newline + } else { + bun.debugAssert(slice.len <= std.math.maxInt(u32)); + self.scanned_pos = @intCast(slice.len); // No newline, scanned everything + } + } + + /// Compact the buffer by moving data to the front. Called when head exceeds threshold. + fn compact(self: *@This()) void { + if (self.head == 0) return; + const slice = self.activeSlice(); + bun.copy(u8, self.data.ptr[0..slice.len], slice); + bun.debugAssert(slice.len <= std.math.maxInt(u32)); + self.data.len = @intCast(slice.len); + self.head = 0; + } + + /// Append bytes to the buffer, scanning only new data for newline. + pub fn append(self: *@This(), bytes: []const u8) void { + _ = bun.handleOom(self.data.write(bun.default_allocator, bytes)); + self.scanForNewline(); + } + + /// Returns the next complete message (up to and including newline) if available. + pub fn next(self: *const @This()) ?struct { data: []const u8, newline_pos: u32 } { + const pos = self.newline_pos orelse return null; + return .{ + .data = self.activeSlice()[0 .. pos + 1], + .newline_pos = pos, + }; + } + + /// Consume bytes from the front of the buffer after processing a message. + /// Just advances head offset - no copying until compaction threshold is reached. + pub fn consume(self: *@This(), bytes: u32) void { + self.head +|= bytes; + + // Adjust scanned_pos (subtract consumed bytes, but don't go negative) + self.scanned_pos = if (bytes >= self.scanned_pos) 0 else self.scanned_pos - bytes; + + // Adjust newline_pos + if (self.newline_pos) |pos| { + if (bytes > pos) { + // Consumed past the known newline - clear it and scan for next + self.newline_pos = null; + self.scanForNewline(); + } else { + self.newline_pos = pos - bytes; + } + } + + // Check if we've consumed everything + if (self.head >= self.data.len) { + // Free memory if capacity exceeds threshold, otherwise just reset + if (self.data.cap >= compaction_threshold) { + self.data.deinit(bun.default_allocator); + self.data = .{}; + } else { + self.data.len = 0; + } + self.head = 0; + self.scanned_pos = 0; + self.newline_pos = null; + return; + } + + // Compact if head exceeds threshold to avoid unbounded memory growth + if (self.head >= compaction_threshold) { + self.compact(); + } + } + + pub fn isEmpty(self: *const @This()) bool { + return self.head >= self.data.len; + } + + pub fn unusedCapacitySlice(self: *@This()) []u8 { + return self.data.unusedCapacitySlice(); + } + + pub fn ensureUnusedCapacity(self: *@This(), additional: usize) void { + bun.handleOom(self.data.ensureUnusedCapacity(bun.default_allocator, additional)); + } + + /// Notify the buffer that data was written directly (e.g., via pre-allocated slice). + pub fn notifyWritten(self: *@This(), new_data: []const u8) void { + bun.debugAssert(new_data.len <= std.math.maxInt(u32)); + self.data.len +|= @as(u32, @intCast(new_data.len)); + self.scanForNewline(); + } + + pub fn deinit(self: *@This()) void { + self.data.deinit(bun.default_allocator); + } +}; + +const bun = @import("bun"); +const std = @import("std"); diff --git a/src/bun.js/api/BunObject.zig b/src/bun.js/api/BunObject.zig index 1ed2b9e24452a5..831c4c50088bad 100644 --- a/src/bun.js/api/BunObject.zig +++ b/src/bun.js/api/BunObject.zig @@ -16,6 +16,7 @@ pub const BunObject = struct { pub const connect = toJSCallback(host_fn.wrapStaticMethod(api.Listener, "connect", false)); pub const createParsedShellScript = toJSCallback(bun.shell.ParsedShellScript.createParsedShellScript); pub const createShellInterpreter = toJSCallback(bun.shell.Interpreter.createShellInterpreter); + pub const traceShellScript = toJSCallback(bun.shell.TraceInterpreter.traceShellScript); pub const deflateSync = toJSCallback(JSZlib.deflateSync); pub const file = toJSCallback(WebCore.Blob.constructBunFile); pub const gunzipSync = toJSCallback(JSZlib.gunzipSync); @@ -154,6 +155,7 @@ pub const BunObject = struct { @export(&BunObject.connect, .{ .name = callbackName("connect") }); @export(&BunObject.createParsedShellScript, .{ .name = callbackName("createParsedShellScript") }); @export(&BunObject.createShellInterpreter, .{ .name = callbackName("createShellInterpreter") }); + @export(&BunObject.traceShellScript, .{ .name = callbackName("traceShellScript") }); @export(&BunObject.deflateSync, .{ .name = callbackName("deflateSync") }); @export(&BunObject.file, .{ .name = callbackName("file") }); @export(&BunObject.gunzipSync, .{ .name = callbackName("gunzipSync") }); diff --git a/src/bun.js/api/HashObject.zig b/src/bun.js/api/HashObject.zig index 05256cf581aab1..92b3f6da4e5577 100644 --- a/src/bun.js/api/HashObject.zig +++ b/src/bun.js/api/HashObject.zig @@ -2,7 +2,22 @@ const HashObject = @This(); pub const wyhash = hashWrap(std.hash.Wyhash); pub const adler32 = hashWrap(std.hash.Adler32); -pub const crc32 = hashWrap(std.hash.Crc32); +/// Use hardware-accelerated CRC32 from zlib +pub const crc32 = hashWrap(struct { + pub fn hash(seed: u32, bytes: []const u8) u32 { + // zlib takes a 32-bit length, so chunk large inputs to avoid truncation. + var crc: u64 = seed; + var offset: usize = 0; + while (offset < bytes.len) { + const remaining = bytes.len - offset; + const max_len: usize = std.math.maxInt(u32); + const chunk_len: u32 = if (remaining > max_len) @intCast(max_len) else @intCast(remaining); + crc = bun.zlib.crc32(crc, bytes.ptr + offset, chunk_len); + offset += chunk_len; + } + return @intCast(crc); + } +}); pub const cityHash32 = hashWrap(std.hash.CityHash32); pub const cityHash64 = hashWrap(std.hash.CityHash64); pub const xxHash32 = hashWrap(struct { diff --git a/src/bun.js/api/JSBundler.zig b/src/bun.js/api/JSBundler.zig index 6e77655062742f..1a948f78b38c60 100644 --- a/src/bun.js/api/JSBundler.zig +++ b/src/bun.js/api/JSBundler.zig @@ -7,6 +7,7 @@ pub const JSBundler = struct { target: Target = Target.browser, entry_points: bun.StringSet = bun.StringSet.init(bun.default_allocator), hot: bool = false, + react_fast_refresh: bool = false, define: bun.StringMap = bun.StringMap.init(bun.default_allocator, false), loaders: ?api.LoaderMap = null, dir: OwnedString = OwnedString.initEmpty(bun.default_allocator), @@ -341,6 +342,10 @@ pub const JSBundler = struct { } } + if (try config.getBooleanLoose(globalThis, "reactFastRefresh")) |react_fast_refresh| { + this.react_fast_refresh = react_fast_refresh; + } + var has_out_dir = false; if (try config.getOptional(globalThis, "outdir", ZigString.Slice)) |slice| { defer slice.deinit(); diff --git a/src/bun.js/api/JSTranspiler.zig b/src/bun.js/api/JSTranspiler.zig index 86814d6deedaaa..2524468d1a8c6a 100644 --- a/src/bun.js/api/JSTranspiler.zig +++ b/src/bun.js/api/JSTranspiler.zig @@ -165,7 +165,8 @@ pub const Config = struct { } if (!kind.isStringLike()) { - try tsconfig.jsonStringify(globalThis, 0, &out); + // Use jsonStringifyFast for SIMD-optimized serialization + try tsconfig.jsonStringifyFast(globalThis, &out); } else { out = try tsconfig.toBunString(globalThis); } @@ -204,7 +205,8 @@ pub const Config = struct { defer out.deref(); // TODO: write a converter between JSC types and Bun AST types if (is_object) { - try macros.jsonStringify(globalThis, 0, &out); + // Use jsonStringifyFast for SIMD-optimized serialization + try macros.jsonStringifyFast(globalThis, &out); } else { out = try macros.toBunString(globalThis); } diff --git a/src/bun.js/api/bun/js_bun_spawn_bindings.zig b/src/bun.js/api/bun/js_bun_spawn_bindings.zig index 7010c9f7e2d2f2..45c33a5a19e44a 100644 --- a/src/bun.js/api/bun/js_bun_spawn_bindings.zig +++ b/src/bun.js/api/bun/js_bun_spawn_bindings.zig @@ -6,6 +6,11 @@ fn getArgv0(globalThis: *jsc.JSGlobalObject, PATH: []const u8, cwd: []const u8, } { var arg0 = try first_cmd.toSliceOrNullWithAllocator(globalThis, allocator); defer arg0.deinit(); + + // Check for null bytes in command (security: prevent null byte injection) + if (strings.indexOfChar(arg0.slice(), 0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The argument 'args[0]' must be a string without null bytes. Received {f}", .{bun.fmt.quote(arg0.slice())}).throw(); + } // Heap allocate it to ensure we don't run out of stack space. const path_buf: *bun.PathBuffer = try bun.default_allocator.create(bun.PathBuffer); defer bun.default_allocator.destroy(path_buf); @@ -63,11 +68,18 @@ fn getArgv(globalThis: *jsc.JSGlobalObject, args: JSValue, PATH: []const u8, cwd argv0.* = argv0_result.argv0.ptr; argv.appendAssumeCapacity(argv0_result.arg0.ptr); + var arg_index: usize = 1; while (try cmds_array.next()) |value| { const arg = try value.toBunString(globalThis); defer arg.deref(); + // Check for null bytes in argument (security: prevent null byte injection) + if (arg.indexOfAsciiChar(0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The argument 'args[{d}]' must be a string without null bytes. Received \"{f}\"", .{ arg_index, arg.toZigString() }).throw(); + } + argv.appendAssumeCapacity(try arg.toOwnedSliceZ(allocator)); + arg_index += 1; } if (argv.items.len == 0) { @@ -1063,7 +1075,18 @@ pub fn appendEnvpFromJS(globalThis: *jsc.JSGlobalObject, object: *jsc.JSObject, var value = object_iter.value; if (value.isUndefined()) continue; - const line = try std.fmt.allocPrintSentinel(envp.allocator, "{f}={f}", .{ key, try value.getZigString(globalThis) }, 0); + const value_bunstr = try value.toBunString(globalThis); + defer value_bunstr.deref(); + + // Check for null bytes in env key and value (security: prevent null byte injection) + if (key.indexOfAsciiChar(0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toZigString(), key.toZigString() }).throw(); + } + if (value_bunstr.indexOfAsciiChar(0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The property 'options.env['{f}']' must be a string without null bytes. Received \"{f}\"", .{ key.toZigString(), value_bunstr.toZigString() }).throw(); + } + + const line = try std.fmt.allocPrintSentinel(envp.allocator, "{f}={f}", .{ key, value_bunstr.toZigString() }, 0); if (key.eqlComptime("PATH")) { PATH.* = bun.asByteSlice(line["PATH=".len..]); diff --git a/src/bun.js/bindings/BunCPUProfiler.cpp b/src/bun.js/bindings/BunCPUProfiler.cpp index e31dccaae61dac..6fa40d28815c47 100644 --- a/src/bun.js/bindings/BunCPUProfiler.cpp +++ b/src/bun.js/bindings/BunCPUProfiler.cpp @@ -34,7 +34,7 @@ void startCPUProfiler(JSC::VM& vm) auto stopwatch = WTF::Stopwatch::create(); stopwatch->start(); - JSC::SamplingProfiler& samplingProfiler = vm.ensureSamplingProfiler(WTFMove(stopwatch)); + JSC::SamplingProfiler& samplingProfiler = vm.ensureSamplingProfiler(WTF::move(stopwatch)); // Set sampling interval to 1ms (1000 microseconds) to match Node.js samplingProfiler.setTimingInterval(WTF::Seconds::fromMicroseconds(1000)); @@ -92,7 +92,7 @@ WTF::String stopCPUProfilerAndGetJSON(JSC::VM& vm) rootNode.lineNumber = -1; rootNode.columnNumber = -1; rootNode.hitCount = 0; - nodes.append(WTFMove(rootNode)); + nodes.append(WTF::move(rootNode)); int nextNodeId = 2; WTF::Vector samples; @@ -229,7 +229,7 @@ WTF::String stopCPUProfilerAndGetJSON(JSC::VM& vm) node.columnNumber = columnNumber; node.hitCount = 0; - nodes.append(WTFMove(node)); + nodes.append(WTF::move(node)); // Add this node as child of parent if (currentParentId > 0) { diff --git a/src/bun.js/bindings/BunClientData.cpp b/src/bun.js/bindings/BunClientData.cpp index 37ebf65ddee7fc..aa1285153bbaa1 100644 --- a/src/bun.js/bindings/BunClientData.cpp +++ b/src/bun.js/bindings/BunClientData.cpp @@ -85,10 +85,10 @@ void JSVMClientData::create(VM* vm, void* bunVM) JSVMClientData* clientData = new JSVMClientData(*vm, provider); clientData->bunVM = bunVM; vm->deferredWorkTimer->onAddPendingWork = [clientData](Ref&& ticket, JSC::DeferredWorkTimer::WorkType kind) -> void { - Bun::JSCTaskScheduler::onAddPendingWork(clientData, WTFMove(ticket), kind); + Bun::JSCTaskScheduler::onAddPendingWork(clientData, WTF::move(ticket), kind); }; vm->deferredWorkTimer->onScheduleWorkSoon = [clientData](JSC::DeferredWorkTimer::Ticket ticket, JSC::DeferredWorkTimer::Task&& task) -> void { - Bun::JSCTaskScheduler::onScheduleWorkSoon(clientData, ticket, WTFMove(task)); + Bun::JSCTaskScheduler::onScheduleWorkSoon(clientData, ticket, WTF::move(task)); }; vm->deferredWorkTimer->onCancelPendingWork = [clientData](JSC::DeferredWorkTimer::Ticket ticket) -> void { Bun::JSCTaskScheduler::onCancelPendingWork(clientData, ticket); diff --git a/src/bun.js/bindings/BunClientData.h b/src/bun.js/bindings/BunClientData.h index 07ba0cfc95fbe1..d0ba38b19dab42 100644 --- a/src/bun.js/bindings/BunClientData.h +++ b/src/bun.js/bindings/BunClientData.h @@ -170,7 +170,7 @@ ALWAYS_INLINE JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm, GetClient uniqueSubspace = makeUnique ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, T); } space = uniqueSubspace.get(); - setServer(subspaces, WTFMove(uniqueSubspace)); + setServer(subspaces, WTF::move(uniqueSubspace)); IGNORE_WARNINGS_BEGIN("unreachable-code") IGNORE_WARNINGS_BEGIN("tautological-compare") @@ -184,7 +184,7 @@ ALWAYS_INLINE JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm, GetClient auto uniqueClientSubspace = makeUnique(*space); auto* clientSpace = uniqueClientSubspace.get(); - setClient(clientSubspaces, WTFMove(uniqueClientSubspace)); + setClient(clientSubspaces, WTF::move(uniqueClientSubspace)); return clientSpace; } diff --git a/src/bun.js/bindings/BunDebugger.cpp b/src/bun.js/bindings/BunDebugger.cpp index 00ee9499e98a3c..25573fb1975b2c 100644 --- a/src/bun.js/bindings/BunDebugger.cpp +++ b/src/bun.js/bindings/BunDebugger.cpp @@ -280,7 +280,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { } for (auto message : messages) { - dispatcher.dispatchMessageFromRemote(WTFMove(message)); + dispatcher.dispatchMessageFromRemote(WTF::move(message)); if (!debugger) { debugger = reinterpret_cast(globalObject->debugger()); @@ -293,7 +293,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { } } else { for (auto message : messages) { - dispatcher.dispatchMessageFromRemote(WTFMove(message)); + dispatcher.dispatchMessageFromRemote(WTF::move(message)); } } @@ -461,7 +461,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionSend, (JSC::JSGlobalObject * globalObject, JS messages.append(value.toWTFString(globalObject).isolatedCopy()); return true; }); - jsConnection->connection()->sendMessageToInspectorFromDebuggerThread(WTFMove(messages)); + jsConnection->connection()->sendMessageToInspectorFromDebuggerThread(WTF::move(messages)); } return JSValue::encode(jsUndefined()); diff --git a/src/bun.js/bindings/BunInjectedScriptHost.cpp b/src/bun.js/bindings/BunInjectedScriptHost.cpp index 7141083305a7e5..0402d3ec87669c 100644 --- a/src/bun.js/bindings/BunInjectedScriptHost.cpp +++ b/src/bun.js/bindings/BunInjectedScriptHost.cpp @@ -130,7 +130,7 @@ JSValue BunInjectedScriptHost::getInternalProperties(VM& vm, JSGlobalObject* exe String name = worker->name(); if (!name.isEmpty()) - array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, "name"_s, jsString(vm, WTFMove(name)))); + array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, "name"_s, jsString(vm, WTF::move(name)))); array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, "terminated"_s, jsBoolean(worker->wasTerminated()))); diff --git a/src/bun.js/bindings/BunInspector.cpp b/src/bun.js/bindings/BunInspector.cpp index ef7a9a251df756..cbabe4f91e79f1 100644 --- a/src/bun.js/bindings/BunInspector.cpp +++ b/src/bun.js/bindings/BunInspector.cpp @@ -74,7 +74,7 @@ class BunInspectorConnection : public Inspector::FrontendChannel { Bun__tickWhilePaused(&done); }; } - this->globalObject->inspectorDebuggable().dispatchMessageFromRemote(WTFMove(messageString)); + this->globalObject->inspectorDebuggable().dispatchMessageFromRemote(WTF::move(messageString)); } void drain() @@ -138,7 +138,7 @@ static void addInspector(void* app, JSC::JSGlobalObject* globalObject) delete inspector; } }; - ((uWS::SSLApp*)app)->ws("/bun:inspect", std::move(handler)); + ((uWS::SSLApp*)app)->ws("/bun:inspect", WTF::move(handler)); } else { auto handler = uWS::App::WebSocketBehavior { @@ -174,7 +174,7 @@ static void addInspector(void* app, JSC::JSGlobalObject* globalObject) delete inspector; } }; - ((uWS::App*)app)->ws("/bun:inspect", std::move(handler)); + ((uWS::App*)app)->ws("/bun:inspect", WTF::move(handler)); } } diff --git a/src/bun.js/bindings/BunObject+exports.h b/src/bun.js/bindings/BunObject+exports.h index d92b41c0cd803c..b4481f7e4758f5 100644 --- a/src/bun.js/bindings/BunObject+exports.h +++ b/src/bun.js/bindings/BunObject+exports.h @@ -69,6 +69,7 @@ macro(spawn) \ macro(spawnSync) \ macro(stringWidth) \ + macro(traceShellScript) \ macro(udpSocket) \ macro(which) \ macro(write) \ diff --git a/src/bun.js/bindings/BunObject.cpp b/src/bun.js/bindings/BunObject.cpp index 3f835745723920..c94784cf96e085 100644 --- a/src/bun.js/bindings/BunObject.cpp +++ b/src/bun.js/bindings/BunObject.cpp @@ -232,12 +232,12 @@ static inline JSC::EncodedJSValue flattenArrayOfBuffersIntoArrayBufferOrUint8Arr } if (asUint8Array) { - auto uint8array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->m_typedArrayUint8.get(lexicalGlobalObject), WTFMove(buffer), 0, byteLength); + auto uint8array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->m_typedArrayUint8.get(lexicalGlobalObject), WTF::move(buffer), 0, byteLength); RETURN_IF_EXCEPTION(throwScope, {}); return JSValue::encode(uint8array); } - RELEASE_AND_RETURN(throwScope, JSValue::encode(JSC::JSArrayBuffer::create(vm, lexicalGlobalObject->arrayBufferStructure(), WTFMove(buffer)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(JSC::JSArrayBuffer::create(vm, lexicalGlobalObject->arrayBufferStructure(), WTF::move(buffer)))); } JSC_DEFINE_HOST_FUNCTION(functionConcatTypedArrays, (JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) @@ -354,12 +354,14 @@ static JSValue constructBunShell(VM& vm, JSObject* bunObject) auto* globalObject = jsCast(bunObject->globalObject()); JSFunction* createParsedShellScript = JSFunction::create(vm, bunObject->globalObject(), 2, "createParsedShellScript"_s, BunObject_callback_createParsedShellScript, ImplementationVisibility::Private, NoIntrinsic); JSFunction* createShellInterpreterFunction = JSFunction::create(vm, bunObject->globalObject(), 1, "createShellInterpreter"_s, BunObject_callback_createShellInterpreter, ImplementationVisibility::Private, NoIntrinsic); + JSFunction* traceShellScriptFunction = JSFunction::create(vm, bunObject->globalObject(), 1, "traceShellScript"_s, BunObject_callback_traceShellScript, ImplementationVisibility::Private, NoIntrinsic); JSC::JSFunction* createShellFn = JSC::JSFunction::create(vm, globalObject, shellCreateBunShellTemplateFunctionCodeGenerator(vm), globalObject); auto scope = DECLARE_THROW_SCOPE(vm); auto args = JSC::MarkedArgumentBuffer(); args.append(createShellInterpreterFunction); args.append(createParsedShellScript); + args.append(traceShellScriptFunction); JSC::JSValue shell = JSC::call(globalObject, createShellFn, args, "BunShell"_s); RETURN_IF_EXCEPTION(scope, {}); @@ -585,7 +587,7 @@ JSC_DEFINE_HOST_FUNCTION(functionPathToFileURL, (JSC::JSGlobalObject * lexicalGl auto fileURL = WTF::URL::fileURLWithFileSystemPath(pathString); auto object = WebCore::DOMURL::create(fileURL.string(), String()); - jsValue = WebCore::toJSNewlyCreated>(*lexicalGlobalObject, globalObject, throwScope, WTFMove(object)); + jsValue = WebCore::toJSNewlyCreated>(*lexicalGlobalObject, globalObject, throwScope, WTF::move(object)); } auto* jsDOMURL = jsCast(jsValue.asCell()); diff --git a/src/bun.js/bindings/BunPlugin.cpp b/src/bun.js/bindings/BunPlugin.cpp index 94bc8350236509..590037d1a5ce4f 100644 --- a/src/bun.js/bindings/BunPlugin.cpp +++ b/src/bun.js/bindings/BunPlugin.cpp @@ -371,7 +371,7 @@ void BunPlugin::Base::append(JSC::VM& vm, JSC::RegExp* filter, JSC::JSObject* fu } else { Group newGroup; newGroup.append(vm, filter, func); - this->groups.append(WTFMove(newGroup)); + this->groups.append(WTF::move(newGroup)); this->namespaces.append(namespaceString); } } diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/bun.js/bindings/BunProcess.cpp index 0c427be8f0b383..f0e77d579c5514 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -3740,7 +3740,7 @@ JSC_DEFINE_CUSTOM_GETTER(processTitle, (JSC::JSGlobalObject * globalObject, JSC: BunString str; Bun__Process__getTitle(globalObject, &str); auto value = str.transferToWTFString(); - auto* result = jsString(globalObject->vm(), WTFMove(value)); + auto* result = jsString(globalObject->vm(), WTF::move(value)); RETURN_IF_EXCEPTION(scope, {}); RELEASE_AND_RETURN(scope, JSValue::encode(result)); #else diff --git a/src/bun.js/bindings/BunProcess.h b/src/bun.js/bindings/BunProcess.h index 807b4c0c105cbb..02b049ebf1e5d1 100644 --- a/src/bun.js/bindings/BunProcess.h +++ b/src/bun.js/bindings/BunProcess.h @@ -35,7 +35,7 @@ class Process : public WebCore::JSEventEmitter { public: Process(JSC::Structure* structure, WebCore::JSDOMGlobalObject& globalObject, Ref&& impl) - : Base(structure, globalObject, WTFMove(impl)) + : Base(structure, globalObject, WTF::move(impl)) { } @@ -88,7 +88,7 @@ class Process : public WebCore::JSEventEmitter { static Process* create(WebCore::JSDOMGlobalObject& globalObject, JSC::Structure* structure) { auto emitter = WebCore::EventEmitter::create(*globalObject.scriptExecutionContext()); - Process* accessor = new (NotNull, JSC::allocateCell(globalObject.vm())) Process(structure, globalObject, WTFMove(emitter)); + Process* accessor = new (NotNull, JSC::allocateCell(globalObject.vm())) Process(structure, globalObject, WTF::move(emitter)); accessor->finishCreation(globalObject.vm()); return accessor; } diff --git a/src/bun.js/bindings/BunString.cpp b/src/bun.js/bindings/BunString.cpp index 6c90ec612e446e..fddb5c8cbe649b 100644 --- a/src/bun.js/bindings/BunString.cpp +++ b/src/bun.js/bindings/BunString.cpp @@ -102,7 +102,7 @@ extern "C" [[ZIG_EXPORT(zero_is_throw)]] JSC::EncodedJSValue BunString__createUT return {}; } scope.assertNoException(); - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } extern "C" JSC::EncodedJSValue BunString__transferToJS(BunString* bunString, JSC::JSGlobalObject* globalObject) @@ -125,12 +125,12 @@ extern "C" JSC::EncodedJSValue BunString__transferToJS(BunString* bunString, JSC #endif bunString->impl.wtf->deref(); *bunString = { .tag = BunStringTag::Dead }; - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } WTF::String str = bunString->toWTFString(); *bunString = { .tag = BunStringTag::Dead }; - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } // int64_t max to say "not a number" @@ -553,7 +553,7 @@ extern "C" JSC::EncodedJSValue BunString__toJSDOMURL(JSC::JSGlobalObject* lexica auto str = bunString->toWTFString(BunString::ZeroCopy); auto object = WebCore::DOMURL::create(str, String()); - auto jsValue = WebCore::toJSNewlyCreated>(*lexicalGlobalObject, globalObject, throwScope, WTFMove(object)); + auto jsValue = WebCore::toJSNewlyCreated>(*lexicalGlobalObject, globalObject, throwScope, WTF::move(object)); auto* jsDOMURL = jsCast(jsValue.asCell()); vm.heap.reportExtraMemoryAllocated(jsDOMURL, jsDOMURL->wrapped().memoryCostForGC()); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(jsValue)); @@ -573,7 +573,7 @@ extern "C" WTF::URL* URL__fromJS(EncodedJSValue encodedValue, JSC::JSGlobalObjec if (!url.isValid() || url.isNull()) return nullptr; - return new WTF::URL(WTFMove(url)); + return new WTF::URL(WTF::move(url)); } extern "C" BunString URL__getHrefFromJS(EncodedJSValue encodedValue, JSC::JSGlobalObject* globalObject) @@ -647,7 +647,7 @@ extern "C" WTF::URL* URL__fromString(BunString* input) if (!url.isValid()) return nullptr; - return new WTF::URL(WTFMove(url)); + return new WTF::URL(WTF::move(url)); } extern "C" BunString URL__protocol(WTF::URL* url) diff --git a/src/bun.js/bindings/ConsoleObject.cpp b/src/bun.js/bindings/ConsoleObject.cpp index beecfc84a14cec..6d8fddae56b71c 100644 --- a/src/bun.js/bindings/ConsoleObject.cpp +++ b/src/bun.js/bindings/ConsoleObject.cpp @@ -35,7 +35,7 @@ void ConsoleObject::messageWithTypeAndLevel(MessageType type, MessageLevel level Ref&& arguments) { if (globalObject->inspectable()) { - if (auto* client = globalObject->inspectorController().consoleClient().get()) { + if (auto client = globalObject->inspectorController().consoleClient()) { client->messageWithTypeAndLevel(type, level, globalObject, arguments.copyRef()); } } @@ -113,7 +113,7 @@ void ConsoleObject::warnUnimplemented(const String& method) {} void ConsoleObject::profile(JSC::JSGlobalObject* globalObject, const String& title) { if (globalObject->inspectable()) { - if (auto* client = globalObject->inspectorController().consoleClient().get()) { + if (auto client = globalObject->inspectorController().consoleClient()) { client->profile(globalObject, title); } } @@ -122,7 +122,7 @@ void ConsoleObject::profile(JSC::JSGlobalObject* globalObject, const String& tit void ConsoleObject::profileEnd(JSC::JSGlobalObject* globalObject, const String& title) { if (globalObject->inspectable()) { - if (auto* client = globalObject->inspectorController().consoleClient().get()) { + if (auto client = globalObject->inspectorController().consoleClient()) { client->profileEnd(globalObject, title); } } diff --git a/src/bun.js/bindings/CookieMap.cpp b/src/bun.js/bindings/CookieMap.cpp index f2adb476b466f4..fa84f709398957 100644 --- a/src/bun.js/bindings/CookieMap.cpp +++ b/src/bun.js/bindings/CookieMap.cpp @@ -47,12 +47,12 @@ CookieMap::CookieMap() } CookieMap::CookieMap(Vector>&& cookies) - : m_modifiedCookies(WTFMove(cookies)) + : m_modifiedCookies(WTF::move(cookies)) { } CookieMap::CookieMap(Vector>&& cookies) - : m_originalCookies(WTFMove(cookies)) + : m_originalCookies(WTF::move(cookies)) { } @@ -68,7 +68,7 @@ ExceptionOr> CookieMap::create(std::variant return Exception { TypeError, "Invalid cookie string: expected name=value pair"_s }; } } - return adoptRef(*new CookieMap(WTFMove(cookies))); + return adoptRef(*new CookieMap(WTF::move(cookies))); }, [&](const HashMap& pairs) -> ExceptionOr> { Vector> cookies; @@ -76,7 +76,7 @@ ExceptionOr> CookieMap::create(std::variant cookies.append(KeyValuePair(entry.key, entry.value)); } - return adoptRef(*new CookieMap(WTFMove(cookies))); + return adoptRef(*new CookieMap(WTF::move(cookies))); }, [&](const String& cookieString) -> ExceptionOr> { StringView forCookieHeader = cookieString; @@ -121,7 +121,7 @@ ExceptionOr> CookieMap::create(std::variant cookies.append(KeyValuePair(name, value)); } - return adoptRef(*new CookieMap(WTFMove(cookies))); + return adoptRef(*new CookieMap(WTF::move(cookies))); }); return std::visit(visitor, variant); @@ -181,7 +181,7 @@ void CookieMap::set(Ref cookie) { removeInternal(cookie->name()); // Add the new cookie - m_modifiedCookies.append(WTFMove(cookie)); + m_modifiedCookies.append(WTF::move(cookie)); } ExceptionOr CookieMap::remove(const CookieStoreDeleteOptions& options) @@ -198,7 +198,7 @@ ExceptionOr CookieMap::remove(const CookieStoreDeleteOptions& options) return cookie_exception.releaseException(); } auto cookie = cookie_exception.releaseReturnValue(); - m_modifiedCookies.append(WTFMove(cookie)); + m_modifiedCookies.append(WTF::move(cookie)); return {}; } diff --git a/src/bun.js/bindings/DOMFormData.cpp b/src/bun.js/bindings/DOMFormData.cpp index 08c203585f9a11..e866c2704eb924 100644 --- a/src/bun.js/bindings/DOMFormData.cpp +++ b/src/bun.js/bindings/DOMFormData.cpp @@ -173,7 +173,7 @@ void DOMFormData::set(const String& name, Item&& item) } if (initialMatchLocation) { - m_items[*initialMatchLocation] = WTFMove(item); + m_items[*initialMatchLocation] = WTF::move(item); m_items.removeAllMatching([&name](const auto& item) { return item.name == name; @@ -182,7 +182,7 @@ void DOMFormData::set(const String& name, Item&& item) return; } - m_items.append(WTFMove(item)); + m_items.append(WTF::move(item)); } DOMFormData::Iterator::Iterator(DOMFormData& target) diff --git a/src/bun.js/bindings/DOMURL.cpp b/src/bun.js/bindings/DOMURL.cpp index 2bfc6d43366512..61af7c63383d5d 100644 --- a/src/bun.js/bindings/DOMURL.cpp +++ b/src/bun.js/bindings/DOMURL.cpp @@ -56,7 +56,7 @@ static inline String redact(const String& input) } inline DOMURL::DOMURL(URL&& completeURL) - : m_url(WTFMove(completeURL)) + : m_url(WTF::move(completeURL)) , m_initialURLCostForGC(static_cast(std::min(m_url.string().impl()->costDuringGC(), std::numeric_limits::max()))) { ASSERT(m_url.isValid()); @@ -67,7 +67,7 @@ ExceptionOr> DOMURL::create(const String& url) URL completeURL { url }; if (!completeURL.isValid()) return Exception { InvalidURLError, makeString(redact(url), " cannot be parsed as a URL."_s) }; - return adoptRef(*new DOMURL(WTFMove(completeURL))); + return adoptRef(*new DOMURL(WTF::move(completeURL))); } ExceptionOr> DOMURL::create(const String& url, const URL& base) @@ -76,7 +76,7 @@ ExceptionOr> DOMURL::create(const String& url, const URL& base) URL completeURL { base, url }; if (!completeURL.isValid()) return Exception { InvalidURLError, makeString(redact(url), " cannot be parsed as a URL."_s) }; - return adoptRef(*new DOMURL(WTFMove(completeURL))); + return adoptRef(*new DOMURL(WTF::move(completeURL))); } ExceptionOr> DOMURL::create(const String& url, const String& base) @@ -102,7 +102,7 @@ RefPtr DOMURL::parse(const String& url, const String& base) auto completeURL = parseInternal(url, base); if (!completeURL.isValid()) return {}; - return adoptRef(*new DOMURL(WTFMove(completeURL))); + return adoptRef(*new DOMURL(WTF::move(completeURL))); } bool DOMURL::canParse(const String& url, const String& base) @@ -117,7 +117,7 @@ ExceptionOr DOMURL::setHref(const String& url) return Exception { InvalidURLError, makeString(redact(url), " cannot be parsed as a URL."_s) }; } - m_url = WTFMove(completeURL); + m_url = WTF::move(completeURL); if (m_searchParams) m_searchParams->updateFromAssociatedURL(); return {}; diff --git a/src/bun.js/bindings/ErrorStackTrace.h b/src/bun.js/bindings/ErrorStackTrace.h index faaac27a84ca99..1d8f89c70d777b 100644 --- a/src/bun.js/bindings/ErrorStackTrace.h +++ b/src/bun.js/bindings/ErrorStackTrace.h @@ -169,7 +169,7 @@ class JSCStackTrace { } JSCStackTrace(WTF::Vector&& frames) - : m_frames(WTFMove(frames)) + : m_frames(WTF::move(frames)) { } @@ -177,7 +177,7 @@ class JSCStackTrace { bool isEmpty() const { return m_frames.isEmpty(); } JSCStackFrame& at(size_t i) { return m_frames.at(i); } - WTF::Vector&& frames() { return WTFMove(m_frames); } + WTF::Vector&& frames() { return WTF::move(m_frames); } static JSCStackTrace fromExisting(JSC::VM& vm, const WTF::Vector& existingFrames); @@ -203,7 +203,7 @@ class JSCStackTrace { private: JSCStackTrace(WTF::Vector& frames) - : m_frames(WTFMove(frames)) + : m_frames(WTF::move(frames)) { } }; diff --git a/src/bun.js/bindings/EventLoopTask.h b/src/bun.js/bindings/EventLoopTask.h index 953fc0da851702..021c39b1a17e91 100644 --- a/src/bun.js/bindings/EventLoopTask.h +++ b/src/bun.js/bindings/EventLoopTask.h @@ -11,20 +11,20 @@ class EventLoopTask { template::value && std::is_convertible>::value>::type> EventLoopTask(T task) - : m_task(WTFMove(task)) + : m_task(WTF::move(task)) , m_isCleanupTask(false) { } EventLoopTask(Function&& task) - : m_task([task = WTFMove(task)](ScriptExecutionContext&) { task(); }) + : m_task([task = WTF::move(task)](ScriptExecutionContext&) { task(); }) , m_isCleanupTask(false) { } template>::value>::type> EventLoopTask(CleanupTaskTag, T task) - : m_task(WTFMove(task)) + : m_task(WTF::move(task)) , m_isCleanupTask(true) { } diff --git a/src/bun.js/bindings/EventLoopTaskNoContext.h b/src/bun.js/bindings/EventLoopTaskNoContext.h index e795a23ccbfdcd..fede33f2603c50 100644 --- a/src/bun.js/bindings/EventLoopTaskNoContext.h +++ b/src/bun.js/bindings/EventLoopTaskNoContext.h @@ -12,7 +12,7 @@ class EventLoopTaskNoContext { public: EventLoopTaskNoContext(JSC::JSGlobalObject* globalObject, Function&& task) : m_createdInBunVm(defaultGlobalObject(globalObject)->bunVM()) - , m_task(WTFMove(task)) + , m_task(WTF::move(task)) { } diff --git a/src/bun.js/bindings/Exception.h b/src/bun.js/bindings/Exception.h index e14b1e01a1fab2..a5b09e9bf40a01 100644 --- a/src/bun.js/bindings/Exception.h +++ b/src/bun.js/bindings/Exception.h @@ -39,7 +39,7 @@ class Exception { ExceptionCode code() const { return m_code; } const String& message() const { return m_message; } - String&& releaseMessage() { return WTFMove(m_message); } + String&& releaseMessage() { return WTF::move(m_message); } Exception isolatedCopy() const { @@ -55,7 +55,7 @@ Exception isolatedCopy(Exception&&); inline Exception::Exception(ExceptionCode code, String message) : m_code { code } - , m_message { WTFMove(message) } + , m_message { WTF::move(message) } { } diff --git a/src/bun.js/bindings/ExceptionOr.h b/src/bun.js/bindings/ExceptionOr.h index aed54f73755b12..adad6fe19f2bab 100644 --- a/src/bun.js/bindings/ExceptionOr.h +++ b/src/bun.js/bindings/ExceptionOr.h @@ -92,12 +92,12 @@ template<> class ExceptionOr { ExceptionOr isolatedCopy(ExceptionOr&&); template inline ExceptionOr::ExceptionOr(Exception&& exception) - : m_value(makeUnexpected(WTFMove(exception))) + : m_value(makeUnexpected(WTF::move(exception))) { } template inline ExceptionOr::ExceptionOr(ReturnType&& returnValue) - : m_value(WTFMove(returnValue)) + : m_value(WTF::move(returnValue)) { } @@ -118,7 +118,7 @@ template inline const Exception& ExceptionOr::e template inline Exception ExceptionOr::releaseException() { - return WTFMove(m_value.error()); + return WTF::move(m_value.error()); } template inline const ReturnType& ExceptionOr::returnValue() const @@ -128,11 +128,11 @@ template inline const ReturnType& ExceptionOr:: template inline ReturnType ExceptionOr::releaseReturnValue() { - return WTFMove(m_value.value()); + return WTF::move(m_value.value()); } template inline ExceptionOr::ExceptionOr(Exception&& exception) - : m_value(WTFMove(exception)) + : m_value(WTF::move(exception)) { } @@ -167,7 +167,7 @@ template inline ReturnReferenceType& ExceptionOr::ExceptionOr(Exception&& exception) - : m_value(makeUnexpected(WTFMove(exception))) + : m_value(makeUnexpected(WTF::move(exception))) { } @@ -183,7 +183,7 @@ inline const Exception& ExceptionOr::exception() const inline Exception ExceptionOr::releaseException() { - return WTFMove(m_value.error()); + return WTF::move(m_value.error()); } inline ExceptionOr isolatedCopy(ExceptionOr&& value) diff --git a/src/bun.js/bindings/FormatStackTraceForJS.cpp b/src/bun.js/bindings/FormatStackTraceForJS.cpp index c570432ea3aec1..bd53f19267d16b 100644 --- a/src/bun.js/bindings/FormatStackTraceForJS.cpp +++ b/src/bun.js/bindings/FormatStackTraceForJS.cpp @@ -687,7 +687,7 @@ JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalOb JSCStackTrace::getFramesForCaller(vm, callFrame, errorObject, caller, stackTrace, stackTraceLimit); if (auto* instance = jsDynamicCast(errorObject)) { - instance->setStackFrames(vm, WTFMove(stackTrace)); + instance->setStackFrames(vm, WTF::move(stackTrace)); if (instance->hasMaterializedErrorInfo()) { const auto& propertyName = vm.propertyNames->stack; VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); diff --git a/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp b/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp index 81039a09de7e3b..4cc5e4c659356b 100644 --- a/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp +++ b/src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp @@ -82,7 +82,7 @@ void InspectorBunFrontendDevServerAgent::bundleStart(int devServerId, RefbundleStart(devServerId, WTFMove(triggerFiles)); + m_frontendDispatcher->bundleStart(devServerId, WTF::move(triggerFiles)); } void InspectorBunFrontendDevServerAgent::bundleComplete(int devServerId, double durationMs) @@ -106,7 +106,7 @@ void InspectorBunFrontendDevServerAgent::clientNavigated(int devServerId, int co if (!m_enabled || !m_frontendDispatcher) return; - m_frontendDispatcher->clientNavigated(devServerId, connectionId, url, WTFMove(routeBundleId)); + m_frontendDispatcher->clientNavigated(devServerId, connectionId, url, WTF::move(routeBundleId)); } void InspectorBunFrontendDevServerAgent::clientErrorReported(int devServerId, const String& clientErrorPayloadBase64) @@ -154,7 +154,7 @@ void InspectorBunFrontendDevServerAgent__notifyBundleStart(InspectorBunFrontendD files->addItem(triggerFiles[i].transferToWTFString()); } - agent->bundleStart(devServerId, WTFMove(files)); + agent->bundleStart(devServerId, WTF::move(files)); } void InspectorBunFrontendDevServerAgent__notifyBundleComplete(InspectorBunFrontendDevServerAgent* agent, int devServerId, double durationMs) diff --git a/src/bun.js/bindings/InspectorHTTPServerAgent.cpp b/src/bun.js/bindings/InspectorHTTPServerAgent.cpp index cc376d13ac9822..e1e12784982657 100644 --- a/src/bun.js/bindings/InspectorHTTPServerAgent.cpp +++ b/src/bun.js/bindings/InspectorHTTPServerAgent.cpp @@ -132,7 +132,7 @@ void InspectorHTTPServerAgent::serverRoutesUpdated(int serverId, int hotReloadId return; } - this->m_frontendDispatcher->serverRoutesUpdated(serverId, hotReloadId, WTFMove(routes)); + this->m_frontendDispatcher->serverRoutesUpdated(serverId, hotReloadId, WTF::move(routes)); } void InspectorHTTPServerAgent::requestWillBeSent(Ref&& request) { @@ -140,7 +140,7 @@ void InspectorHTTPServerAgent::requestWillBeSent(Refm_frontendDispatcher->requestWillBeSent(WTFMove(request)); + this->m_frontendDispatcher->requestWillBeSent(WTF::move(request)); } void InspectorHTTPServerAgent::responseReceived(Ref&& response) { @@ -148,7 +148,7 @@ void InspectorHTTPServerAgent::responseReceived(Refm_frontendDispatcher->responseReceived(WTFMove(response)); + this->m_frontendDispatcher->responseReceived(WTF::move(response)); } void InspectorHTTPServerAgent::bodyChunkReceived(Ref&& chunk) { @@ -156,7 +156,7 @@ void InspectorHTTPServerAgent::bodyChunkReceived(Refm_frontendDispatcher->bodyChunkReceived(WTFMove(chunk)); + this->m_frontendDispatcher->bodyChunkReceived(WTF::move(chunk)); } void InspectorHTTPServerAgent::requestFinished(int requestId, int serverId, double timestamp, std::optional&& opt_duration) { @@ -164,7 +164,7 @@ void InspectorHTTPServerAgent::requestFinished(int requestId, int serverId, doub return; } - this->m_frontendDispatcher->requestFinished(requestId, serverId, timestamp, WTFMove(opt_duration)); + this->m_frontendDispatcher->requestFinished(requestId, serverId, timestamp, WTF::move(opt_duration)); } void InspectorHTTPServerAgent::requestHandlerException(Ref&& error) { @@ -172,7 +172,7 @@ void InspectorHTTPServerAgent::requestHandlerException(Refm_frontendDispatcher->requestHandlerException(WTFMove(error)); + this->m_frontendDispatcher->requestHandlerException(WTF::move(error)); } } @@ -258,9 +258,9 @@ struct Route { object->setScriptUrl(route.script_url.toWTFString()); } - routes->addItem(WTFMove(object)); + routes->addItem(WTF::move(object)); } - agent->serverRoutesUpdated(serverId, hotReloadId, WTFMove(routes)); + agent->serverRoutesUpdated(serverId, hotReloadId, WTF::move(routes)); } } diff --git a/src/bun.js/bindings/InspectorLifecycleAgent.cpp b/src/bun.js/bindings/InspectorLifecycleAgent.cpp index 67ae9822990c04..e3c24a1f9a75b3 100644 --- a/src/bun.js/bindings/InspectorLifecycleAgent.cpp +++ b/src/bun.js/bindings/InspectorLifecycleAgent.cpp @@ -122,7 +122,7 @@ void InspectorLifecycleAgent::reportError(ZigException& exception) } // error(const String& message, const String& name, Ref>&& urls, Ref>&& lineColumns, Ref>&& sourceLines); - m_frontendDispatcher->error(WTFMove(message), WTFMove(name), WTFMove(urls), WTFMove(lineColumns), WTFMove(sourceLines)); + m_frontendDispatcher->error(WTF::move(message), WTF::move(name), WTF::move(urls), WTF::move(lineColumns), WTF::move(sourceLines)); } Protocol::ErrorStringOr InspectorLifecycleAgent::preventExit() @@ -206,7 +206,7 @@ Protocol::ErrorStringOr InspectorLifecycleAgent::getModuleGraph() RETURN_IF_EXCEPTION(scope, makeUnexpected(ErrorString("Failed to convert value to string"_s))); } - return ModuleGraph { WTFMove(esm), WTFMove(cjs), WTFMove(cwd), WTFMove(main), WTFMove(argv) }; + return ModuleGraph { WTF::move(esm), WTF::move(cjs), WTF::move(cwd), WTF::move(main), WTF::move(argv) }; } } diff --git a/src/bun.js/bindings/InternalModuleRegistry.cpp b/src/bun.js/bindings/InternalModuleRegistry.cpp index 1b0837ae734bf6..4e4f6fb428bf9d 100644 --- a/src/bun.js/bindings/InternalModuleRegistry.cpp +++ b/src/bun.js/bindings/InternalModuleRegistry.cpp @@ -100,7 +100,7 @@ ALWAYS_INLINE JSC::JSValue generateNativeModule( #ifdef BUN_DYNAMIC_JS_LOAD_PATH JSValue initializeInternalModuleFromDisk(JSGlobalObject* globalObject, VM& vm, const WTF::String& moduleName, WTF::String fileBase, const WTF::String& urlString) { - WTF::String file = makeString(ASCIILiteral::fromLiteralUnsafe(BUN_DYNAMIC_JS_LOAD_PATH), "/"_s, WTFMove(fileBase)); + WTF::String file = makeString(ASCIILiteral::fromLiteralUnsafe(BUN_DYNAMIC_JS_LOAD_PATH), "/"_s, WTF::move(fileBase)); if (auto contents = WTF::FileSystemImpl::readEntireFile(file)) { auto string = WTF::String::fromUTF8(contents.value()); return generateModule(globalObject, vm, string, moduleName, urlString); diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp index e3be045a44dc9e..867a689fbac42e 100644 --- a/src/bun.js/bindings/JSBuffer.cpp +++ b/src/bun.js/bindings/JSBuffer.cpp @@ -80,6 +80,10 @@ extern "C" bool Bun__Node__ZeroFillBuffers; +// SIMD-optimized search functions from highway_strings.cpp +extern "C" void* highway_memmem(const uint8_t* haystack, size_t haystack_len, const uint8_t* needle, size_t needle_len); +extern "C" size_t highway_index_of_char(const uint8_t* haystack, size_t haystack_len, uint8_t needle); + // export fn Bun__inspect_singleline(globalThis: *JSGlobalObject, value: JSValue) bun.String extern "C" BunString Bun__inspect_singleline(JSC::JSGlobalObject* globalObject, JSC::JSValue value); @@ -352,7 +356,7 @@ JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalO bytesDeallocator(p, ctx); })); - uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTFMove(buffer), 0, length); + uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTF::move(buffer), 0, length); } else { uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, 0); } @@ -409,7 +413,7 @@ static JSC::EncodedJSValue writeToBuffer(JSC::JSGlobalObject* lexicalGlobalObjec JSC::JSUint8Array* createBuffer(JSC::JSGlobalObject* lexicalGlobalObject, Ref&& backingStore) { size_t length = backingStore->byteLength(); - return JSC::JSUint8Array::create(lexicalGlobalObject, defaultGlobalObject(lexicalGlobalObject)->JSBufferSubclassStructure(), WTFMove(backingStore), 0, length); + return JSC::JSUint8Array::create(lexicalGlobalObject, defaultGlobalObject(lexicalGlobalObject)->JSBufferSubclassStructure(), WTF::move(backingStore), 0, length); } JSC::JSUint8Array* createBuffer(JSC::JSGlobalObject* lexicalGlobalObject, const uint8_t* ptr, size_t length) @@ -1377,11 +1381,20 @@ static ssize_t indexOfOffset(size_t length, ssize_t offset_i64, ssize_t needle_l static int64_t indexOf(const uint8_t* thisPtr, int64_t thisLength, const uint8_t* valuePtr, int64_t valueLength, int64_t byteOffset) { - auto haystack = std::span(thisPtr, thisLength).subspan(byteOffset); - auto needle = std::span(valuePtr, valueLength); - auto it = std::search(haystack.begin(), haystack.end(), needle.begin(), needle.end()); - if (it == haystack.end()) return -1; - return byteOffset + std::distance(haystack.begin(), it); + const size_t haystackLen = static_cast(thisLength - byteOffset); + const uint8_t* haystackPtr = thisPtr + byteOffset; + + if (valueLength == 1) { + // Use SIMD-optimized single-byte search + size_t result = highway_index_of_char(haystackPtr, haystackLen, valuePtr[0]); + if (result == haystackLen) return -1; + return byteOffset + static_cast(result); + } + + // Use SIMD-optimized multi-byte search + void* result = highway_memmem(haystackPtr, haystackLen, valuePtr, static_cast(valueLength)); + if (result == nullptr) return -1; + return byteOffset + static_cast(static_cast(result) - haystackPtr); } static int64_t indexOf16(const uint8_t* thisPtr, int64_t thisLength, const uint8_t* valuePtr, int64_t valueLength, int64_t byteOffset) @@ -1771,7 +1784,7 @@ JSC::EncodedJSValue jsBufferToStringFromBytes(JSGlobalObject* lexicalGlobalObjec } memcpy(data.data(), bytes.data(), bytes.size()); - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } case BufferEncodingType::ucs2: case BufferEncodingType::utf16le: { @@ -1786,7 +1799,7 @@ JSC::EncodedJSValue jsBufferToStringFromBytes(JSGlobalObject* lexicalGlobalObjec return {}; } memcpy(reinterpret_cast(data.data()), bytes.data(), u16length * 2); - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } case BufferEncodingType::ascii: { std::span data; @@ -1796,7 +1809,7 @@ JSC::EncodedJSValue jsBufferToStringFromBytes(JSGlobalObject* lexicalGlobalObjec return {}; } Bun__encoding__writeLatin1(bytes.data(), bytes.size(), data.data(), data.size(), static_cast(encoding)); - return JSValue::encode(jsString(vm, WTFMove(str))); + return JSValue::encode(jsString(vm, WTF::move(str))); } case WebCore::BufferEncodingType::utf8: @@ -2167,7 +2180,7 @@ extern "C" JSC::EncodedJSValue JSBuffer__fromMmap(Zig::GlobalObject* globalObjec #endif })); - auto* view = JSC::JSUint8Array::create(globalObject, structure, WTFMove(buffer), 0, length); + auto* view = JSC::JSUint8Array::create(globalObject, structure, WTF::move(buffer), 0, length); RETURN_IF_EXCEPTION(scope, {}); if (!view) [[unlikely]] { @@ -2889,7 +2902,7 @@ EncodedJSValue constructBufferFromArrayBuffer(JSC::ThrowScope& throwScope, JSGlo auto isResizableOrGrowableShared = jsBuffer->isResizableOrGrowableShared(); if (isResizableOrGrowableShared) { auto* subclassStructure = globalObject->JSResizableOrGrowableSharedBufferSubclassStructure(); - auto* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTFMove(buffer), offset, std::nullopt); + auto* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTF::move(buffer), offset, std::nullopt); RETURN_IF_EXCEPTION(throwScope, {}); if (!uint8Array) [[unlikely]] { throwOutOfMemoryError(globalObject, throwScope); @@ -2898,7 +2911,7 @@ EncodedJSValue constructBufferFromArrayBuffer(JSC::ThrowScope& throwScope, JSGlo RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array)); } auto* subclassStructure = globalObject->JSBufferSubclassStructure(); - auto* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTFMove(buffer), offset, length); + auto* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTF::move(buffer), offset, length); RETURN_IF_EXCEPTION(throwScope, {}); if (!uint8Array) [[unlikely]] { throwOutOfMemoryError(globalObject, throwScope); diff --git a/src/bun.js/bindings/JSBunRequest.cpp b/src/bun.js/bindings/JSBunRequest.cpp index f72f54a40f07d5..1a40d64dc26035 100644 --- a/src/bun.js/bindings/JSBunRequest.cpp +++ b/src/bun.js/bindings/JSBunRequest.cpp @@ -132,7 +132,7 @@ JSBunRequest* JSBunRequest::clone(JSC::VM& vm, JSGlobalObject* globalObject) if (auto* wrapper = jsDynamicCast(cookiesObject)) { auto cookieMap = wrapper->protectedWrapped(); auto cookieMapClone = cookieMap->clone(); - auto cookies = WebCore::toJSNewlyCreated(globalObject, jsCast(globalObject), WTFMove(cookieMapClone)); + auto cookies = WebCore::toJSNewlyCreated(globalObject, jsCast(globalObject), WTF::move(cookieMapClone)); clone->setCookies(cookies.getObject()); } } @@ -266,7 +266,7 @@ JSC_DEFINE_CUSTOM_GETTER(jsJSBunRequestGetCookies, (JSC::JSGlobalObject * global auto cookieMap = cookieMapResult.releaseReturnValue(); // Convert to JS - auto cookies = WebCore::toJSNewlyCreated(globalObject, jsCast(globalObject), WTFMove(cookieMap)); + auto cookies = WebCore::toJSNewlyCreated(globalObject, jsCast(globalObject), WTF::move(cookieMap)); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); request->setCookies(cookies.getObject()); return JSValue::encode(cookies); diff --git a/src/bun.js/bindings/JSBundlerPlugin.cpp b/src/bun.js/bindings/JSBundlerPlugin.cpp index 3bd323e2ef038c..c1152b494fe068 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.cpp +++ b/src/bun.js/bindings/JSBundlerPlugin.cpp @@ -71,7 +71,7 @@ void BundlerPlugin::NamespaceList::append(JSC::VM& vm, JSC::RegExp* filter, Stri auto pattern = filter->pattern(); auto filter_regexp = FilterRegExp(pattern, filter->flags()); - nsGroup->append(WTFMove(filter_regexp)); + nsGroup->append(WTF::move(filter_regexp)); } static bool anyMatchesForNamespace(JSC::VM& vm, BundlerPlugin::NamespaceList& list, const BunString* namespaceStr, const BunString* path) @@ -260,7 +260,7 @@ void BundlerPlugin::NativePluginList::append(JSC::VM& vm, JSC::RegExp* filter, S auto pattern = filter->pattern(); auto filter_regexp = FilterRegExp(pattern, filter->flags()); - nsGroup->append(WTFMove(filter_regexp)); + nsGroup->append(WTF::move(filter_regexp)); } if (index == std::numeric_limits::max()) { diff --git a/src/bun.js/bindings/JSBundlerPlugin.h b/src/bun.js/bindings/JSBundlerPlugin.h index 34fb3130758fdc..ee59d1e61441c0 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.h +++ b/src/bun.js/bindings/JSBundlerPlugin.h @@ -29,8 +29,8 @@ class BundlerPlugin final { WTF::Lock lock {}; FilterRegExp(FilterRegExp&& other) - : m_pattern(WTFMove(other.m_pattern)) - , regex(WTFMove(other.regex)) + : m_pattern(WTF::move(other.m_pattern)) + , regex(WTF::move(other.regex)) { } diff --git a/src/bun.js/bindings/JSCTaskScheduler.cpp b/src/bun.js/bindings/JSCTaskScheduler.cpp index 7652caabef7a54..171b5c4edc19a9 100644 --- a/src/bun.js/bindings/JSCTaskScheduler.cpp +++ b/src/bun.js/bindings/JSCTaskScheduler.cpp @@ -16,8 +16,8 @@ extern "C" void Bun__eventLoop__incrementRefConcurrently(void* bunVM, int delta) class JSCDeferredWorkTask { public: JSCDeferredWorkTask(Ref ticket, Task&& task) - : ticket(WTFMove(ticket)) - , task(WTFMove(task)) + : ticket(WTF::move(ticket)) + , task(WTF::move(task)) { } @@ -43,14 +43,14 @@ void JSCTaskScheduler::onAddPendingWork(WebCore::JSVMClientData* clientData, Ref Locker holder { scheduler.m_lock }; if (kind == DeferredWorkTimer::WorkType::ImminentlyScheduled) { Bun__eventLoop__incrementRefConcurrently(clientData->bunVM, 1); - scheduler.m_pendingTicketsKeepingEventLoopAlive.add(WTFMove(ticket)); + scheduler.m_pendingTicketsKeepingEventLoopAlive.add(WTF::move(ticket)); } else { - scheduler.m_pendingTicketsOther.add(WTFMove(ticket)); + scheduler.m_pendingTicketsOther.add(WTF::move(ticket)); } } void JSCTaskScheduler::onScheduleWorkSoon(WebCore::JSVMClientData* clientData, Ticket ticket, Task&& task) { - auto* job = new JSCDeferredWorkTask(*ticket, WTFMove(task)); + auto* job = new JSCDeferredWorkTask(*ticket, WTF::move(task)); Bun__queueJSCDeferredWorkTaskConcurrently(clientData->bunVM, job); } diff --git a/src/bun.js/bindings/JSCommonJSModule.cpp b/src/bun.js/bindings/JSCommonJSModule.cpp index b6000602bc9a2f..095d305e661a52 100644 --- a/src/bun.js/bindings/JSCommonJSModule.cpp +++ b/src/bun.js/bindings/JSCommonJSModule.cpp @@ -112,7 +112,7 @@ extern "C" void Bun__VM__setEntryPointEvalResultCJS(void*, EncodedJSValue); static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObject, JSCommonJSModule* moduleObject, JSString* dirname, JSValue filename) { auto scope = DECLARE_THROW_SCOPE(vm); - SourceCode code = std::move(moduleObject->sourceCode); + SourceCode code = WTF::move(moduleObject->sourceCode); // If an exception occurred somewhere else, we might have cleared the source code. if (code.isNull()) [[unlikely]] { @@ -715,7 +715,7 @@ JSC_DEFINE_HOST_FUNCTION(functionJSCommonJSModule_compile, (JSGlobalObject * glo } moduleObject->sourceCode = makeSource( - WTFMove(wrappedString), + WTF::move(wrappedString), SourceOrigin(URL::fileURLWithFileSystemPath(filenameString)), JSC::SourceTaintedOrigin::Untainted, filenameString, @@ -1365,7 +1365,7 @@ void JSCommonJSModule::evaluate( if (this->hasEvaluated) return; - this->sourceCode = JSC::SourceCode(WTFMove(sourceProvider)); + this->sourceCode = JSC::SourceCode(WTF::move(sourceProvider)); evaluateCommonJSModuleOnce(vm, globalObject, this, this->m_dirname.get(), this->m_filename.get()); } @@ -1466,7 +1466,7 @@ std::optional createCommonJSModule( moduleObject = JSCommonJSModule::create( vm, globalObject->CommonJSModuleObjectStructure(), - requireMapKey, filename, dirname, WTFMove(JSC::SourceCode(WTFMove(sourceProvider)))); + requireMapKey, filename, dirname, JSC::SourceCode(WTF::move(sourceProvider))); moduleObject->putDirect(vm, WebCore::clientData(vm)->builtinNames().exportsPublicName(), diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.cpp b/src/bun.js/bindings/JSDOMExceptionHandling.cpp index f2dc43508652c6..2b8bd8a3abd03c 100644 --- a/src/bun.js/bindings/JSDOMExceptionHandling.cpp +++ b/src/bun.js/bindings/JSDOMExceptionHandling.cpp @@ -212,7 +212,7 @@ JSValue createDOMException(JSGlobalObject& lexicalGlobalObject, Exception&& exce void propagateExceptionSlowPath(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, Exception&& exception) { throwScope.assertNoExceptionExceptTermination(); - auto jsException = createDOMException(lexicalGlobalObject, WTFMove(exception)); + auto jsException = createDOMException(lexicalGlobalObject, WTF::move(exception)); RETURN_IF_EXCEPTION(throwScope, ); throwException(&lexicalGlobalObject, throwScope, jsException); } diff --git a/src/bun.js/bindings/JSDOMExceptionHandling.h b/src/bun.js/bindings/JSDOMExceptionHandling.h index 600673927e658d..7f04a6efdec7f5 100644 --- a/src/bun.js/bindings/JSDOMExceptionHandling.h +++ b/src/bun.js/bindings/JSDOMExceptionHandling.h @@ -80,7 +80,7 @@ ALWAYS_INLINE void propagateException(JSC::JSGlobalObject& lexicalGlobalObject, { if (throwScope.exception()) return; - propagateExceptionSlowPath(lexicalGlobalObject, throwScope, WTFMove(exception)); + propagateExceptionSlowPath(lexicalGlobalObject, throwScope, WTF::move(exception)); } inline void propagateException(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, ExceptionOr&& value) @@ -91,7 +91,7 @@ inline void propagateException(JSC::JSGlobalObject& lexicalGlobalObject, JSC::Th ALWAYS_INLINE void propagateException(JSC::JSGlobalObject* lexicalGlobalObject, JSC::ThrowScope& throwScope, Exception&& exception) { - return propagateException(*lexicalGlobalObject, throwScope, WTFMove(exception)); + return propagateException(*lexicalGlobalObject, throwScope, WTF::move(exception)); } template void invokeFunctorPropagatingExceptionIfNecessary(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, Functor&& functor) diff --git a/src/bun.js/bindings/JSDOMWrapper.h b/src/bun.js/bindings/JSDOMWrapper.h index bff0179a4586ac..d27d0c24c324a5 100644 --- a/src/bun.js/bindings/JSDOMWrapper.h +++ b/src/bun.js/bindings/JSDOMWrapper.h @@ -91,7 +91,7 @@ class JSDOMWrapper : public JSDOMObject { protected: JSDOMWrapper(JSC::Structure* structure, JSC::JSGlobalObject& globalObject, Ref&& impl) : Base(structure, globalObject) - , m_wrapped(WTFMove(impl)) + , m_wrapped(WTF::move(impl)) { } diff --git a/src/bun.js/bindings/JSDOMWrapperCache.h b/src/bun.js/bindings/JSDOMWrapperCache.h index 11795651a04553..7397ae993c346d 100644 --- a/src/bun.js/bindings/JSDOMWrapperCache.h +++ b/src/bun.js/bindings/JSDOMWrapperCache.h @@ -186,14 +186,14 @@ template inline auto createWrapper(JSDOMGlobalObj ASSERT(!getCachedWrapper(globalObject->world(), domObject)); auto* domObjectPtr = domObject.ptr(); - auto* wrapper = WrapperClass::create(getDOMStructure(globalObject->vm(), *globalObject), globalObject, WTFMove(domObject)); + auto* wrapper = WrapperClass::create(getDOMStructure(globalObject->vm(), *globalObject), globalObject, WTF::move(domObject)); cacheWrapper(globalObject->world(), domObjectPtr, wrapper); return wrapper; } template inline auto createWrapper(JSDOMGlobalObject* globalObject, Ref&& domObject) -> typename std::enable_if::value, typename JSDOMWrapperConverterTraits::WrapperClass*>::type { - return createWrapper(globalObject, unsafeRefDowncast(WTFMove(domObject))); + return createWrapper(globalObject, unsafeRefDowncast(WTF::move(domObject))); } template inline JSC::JSValue wrap(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, DOMClass& domObject) diff --git a/src/bun.js/bindings/JSFFIFunction.cpp b/src/bun.js/bindings/JSFFIFunction.cpp index 0a66f7366587e4..292f15e875770d 100644 --- a/src/bun.js/bindings/JSFFIFunction.cpp +++ b/src/bun.js/bindings/JSFFIFunction.cpp @@ -127,7 +127,7 @@ const ClassInfo JSFFIFunction::s_info = { "Function"_s, &Base::s_info, nullptr, JSFFIFunction::JSFFIFunction(VM& vm, NativeExecutable* executable, JSGlobalObject* globalObject, Structure* structure, CFFIFunction&& function) : Base(vm, executable, globalObject, structure) - , m_function(WTFMove(function)) + , m_function(WTF::move(function)) { // used in NAPI dataPtr = nullptr; @@ -153,7 +153,7 @@ JSFFIFunction* JSFFIFunction::create(VM& vm, Zig::GlobalObject* globalObject, un { NativeExecutable* executable = vm.getHostFunction(FFIFunction, ImplementationVisibility::Public, intrinsic, FFIFunction, nullptr, name); Structure* structure = globalObject->FFIFunctionStructure(); - JSFFIFunction* function = new (NotNull, allocateCell(vm)) JSFFIFunction(vm, executable, globalObject, structure, reinterpret_cast(WTFMove(FFIFunction))); + JSFFIFunction* function = new (NotNull, allocateCell(vm)) JSFFIFunction(vm, executable, globalObject, structure, reinterpret_cast(WTF::move(FFIFunction))); function->finishCreation(vm, executable, length, name); return function; } @@ -176,7 +176,7 @@ JSFFIFunction* JSFFIFunction::createForFFI(VM& vm, Zig::GlobalObject* globalObje NativeExecutable* executable = vm.getHostFunction(FFIFunction, ImplementationVisibility::Public, NoIntrinsic, FFIFunction, nullptr, name); #endif Structure* structure = globalObject->FFIFunctionStructure(); - JSFFIFunction* function = new (NotNull, allocateCell(vm)) JSFFIFunction(vm, executable, globalObject, structure, reinterpret_cast(WTFMove(FFIFunction))); + JSFFIFunction* function = new (NotNull, allocateCell(vm)) JSFFIFunction(vm, executable, globalObject, structure, reinterpret_cast(WTF::move(FFIFunction))); function->finishCreation(vm, executable, length, name); return function; } @@ -212,7 +212,7 @@ FFI_Callback_threadsafe_call(FFICallbackFunctionWrapper& wrapper, size_t argCoun for (size_t i = 0; i < argCount; ++i) argsVec.append(args[i]); - WebCore::ScriptExecutionContext::postTaskTo(globalObject->scriptExecutionContext()->identifier(), [argsVec = WTFMove(argsVec), wrapper](WebCore::ScriptExecutionContext& ctx) mutable { + WebCore::ScriptExecutionContext::postTaskTo(globalObject->scriptExecutionContext()->identifier(), [argsVec = WTF::move(argsVec), wrapper](WebCore::ScriptExecutionContext& ctx) mutable { auto* globalObject = JSC::jsCast(ctx.jsGlobalObject()); auto& vm = JSC::getVM(globalObject); JSC::MarkedArgumentBuffer arguments; diff --git a/src/bun.js/bindings/JSSecrets.cpp b/src/bun.js/bindings/JSSecrets.cpp index 94fd771a8c5387..f86093ec528416 100644 --- a/src/bun.js/bindings/JSSecrets.cpp +++ b/src/bun.js/bindings/JSSecrets.cpp @@ -246,13 +246,13 @@ void Bun__SecretsJobOptions__runTask(SecretsJobOptions* opts, JSGlobalObject* gl auto result = Secrets::getPassword(opts->service, opts->name, opts->error); if (result.has_value()) { // Store as String for main thread (String is thread-safe to construct from CString) - opts->resultPassword = WTFMove(result.value()); + opts->resultPassword = WTF::move(result.value()); } break; } case SecretsJobOptions::SET: - opts->error = Secrets::setPassword(opts->service, opts->name, WTFMove(opts->password), opts->allowUnrestrictedAccess); + opts->error = Secrets::setPassword(opts->service, opts->name, WTF::move(opts->password), opts->allowUnrestrictedAccess); break; case SecretsJobOptions::DELETE_OP: @@ -288,7 +288,7 @@ void Bun__SecretsJobOptions__runFromJS(SecretsJobOptions* opts, JSGlobalObject* switch (opts->op) { case SecretsJobOptions::GET: if (opts->resultPassword.has_value()) { - auto resultPassword = WTFMove(opts->resultPassword.value()); + auto resultPassword = WTF::move(opts->resultPassword.value()); result = jsString(vm, String::fromUTF8(resultPassword.span())); RETURN_IF_EXCEPTION(scope, ); memsetSpan(resultPassword.mutableSpan(), 0); diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/bun.js/bindings/JSStringDecoder.cpp index 14b8e51da46802..4d6186509d303e 100644 --- a/src/bun.js/bindings/JSStringDecoder.cpp +++ b/src/bun.js/bindings/JSStringDecoder.cpp @@ -486,7 +486,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi RETURN_IF_EXCEPTION(scope, {}); auto buffer = ArrayBuffer::create({ castedThis->m_lastChar, 4 }); auto* globalObject = static_cast(lexicalGlobalObject); - JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, 4); + JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(buffer), 0, 4); RELEASE_AND_RETURN(scope, JSC::JSValue::encode(uint8Array)); } static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName attributeName)) diff --git a/src/bun.js/bindings/JSValue.zig b/src/bun.js/bindings/JSValue.zig index fe8b178dc1d2ff..8d911d6ecced73 100644 --- a/src/bun.js/bindings/JSValue.zig +++ b/src/bun.js/bindings/JSValue.zig @@ -1202,6 +1202,15 @@ pub const JSValue = enum(i64) { return bun.jsc.fromJSHostCallGeneric(globalThis, @src(), JSC__JSValue__jsonStringify, .{ this, globalThis, indent, out }); } + extern fn JSC__JSValue__jsonStringifyFast(this: JSValue, globalThis: *JSGlobalObject, out: *bun.String) void; + + /// Fast version of JSON.stringify that uses JSC's FastStringifier optimization. + /// When space is undefined (as opposed to 0), JSC uses a highly optimized SIMD-based + /// serialization path. This is significantly faster for most common use cases. + pub fn jsonStringifyFast(this: JSValue, globalThis: *JSGlobalObject, out: *bun.String) bun.JSError!void { + return bun.jsc.fromJSHostCallGeneric(globalThis, @src(), JSC__JSValue__jsonStringifyFast, .{ this, globalThis, out }); + } + /// Call `toString()` on the JSValue and clone the result. pub fn toSliceOrNull(this: JSValue, globalThis: *JSGlobalObject) bun.JSError!ZigString.Slice { const str = try bun.String.fromJS(this, globalThis); diff --git a/src/bun.js/bindings/JSX509Certificate.cpp b/src/bun.js/bindings/JSX509Certificate.cpp index 36058482cfcfa2..0dfee0257510f0 100644 --- a/src/bun.js/bindings/JSX509Certificate.cpp +++ b/src/bun.js/bindings/JSX509Certificate.cpp @@ -265,13 +265,13 @@ JSX509Certificate* JSX509Certificate::create(JSC::VM& vm, JSC::Structure* struct return nullptr; } - return create(vm, structure, globalObject, WTFMove(result.value)); + return create(vm, structure, globalObject, WTF::move(result.value)); } JSX509Certificate* JSX509Certificate::create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, ncrypto::X509Pointer&& cert) { auto* certificate = create(vm, structure); - certificate->m_x509 = WTFMove(cert); + certificate->m_x509 = WTF::move(cert); size_t size = i2d_X509(certificate->m_x509.get(), nullptr); certificate->m_extraMemorySizeForGC = size; vm.heap.reportExtraMemoryAllocated(certificate, size); @@ -573,7 +573,7 @@ JSUint8Array* JSX509Certificate::computeRaw(ncrypto::X509View view, JSGlobalObje Ref buffer = JSC::ArrayBuffer::createFromBytes(std::span(reinterpret_cast(bptr->data), bptr->length), createSharedTask([](void* data) { ncrypto::BIOPointer free_me(static_cast(data)); })); - RELEASE_AND_RETURN(scope, Bun::createBuffer(globalObject, WTFMove(buffer))); + RELEASE_AND_RETURN(scope, Bun::createBuffer(globalObject, WTF::move(buffer))); } bool JSX509Certificate::computeIsCA(ncrypto::X509View view, JSGlobalObject* globalObject) @@ -1046,8 +1046,8 @@ JSValue JSX509Certificate::computePublicKey(ncrypto::X509View view, JSGlobalObje return {}; } - auto handle = KeyObject::create(CryptoKeyType::Public, WTFMove(result.value)); - return JSPublicKeyObject::create(vm, globalObject->m_JSPublicKeyObjectClassStructure.get(lexicalGlobalObject), lexicalGlobalObject, WTFMove(handle)); + auto handle = KeyObject::create(CryptoKeyType::Public, WTF::move(result.value)); + return JSPublicKeyObject::create(vm, globalObject->m_JSPublicKeyObjectClassStructure.get(lexicalGlobalObject), lexicalGlobalObject, WTF::move(handle)); } JSValue JSX509Certificate::computeInfoAccess(ncrypto::X509View view, JSGlobalObject* globalObject, bool legacy) @@ -1171,7 +1171,7 @@ extern "C" EncodedJSValue Bun__X509__toJS(X509* cert, JSGlobalObject* globalObje { ncrypto::X509Pointer cert_ptr(cert); auto* zigGlobalObject = defaultGlobalObject(globalObject); - return JSValue::encode(JSX509Certificate::create(zigGlobalObject->vm(), zigGlobalObject->m_JSX509CertificateClassStructure.get(zigGlobalObject), globalObject, WTFMove(cert_ptr))); + return JSValue::encode(JSX509Certificate::create(zigGlobalObject->vm(), zigGlobalObject->m_JSX509CertificateClassStructure.get(zigGlobalObject), globalObject, WTF::move(cert_ptr))); } JSC_DEFINE_HOST_FUNCTION(jsIsX509Certificate, (JSGlobalObject * globalObject, CallFrame* callFrame)) diff --git a/src/bun.js/bindings/ModuleLoader.cpp b/src/bun.js/bindings/ModuleLoader.cpp index fb46b9f127ef5a..05ab6649c1d514 100644 --- a/src/bun.js/bindings/ModuleLoader.cpp +++ b/src/bun.js/bindings/ModuleLoader.cpp @@ -422,10 +422,10 @@ static JSValue handleVirtualModuleResult( globalObject, object); auto source = JSC::SourceCode( - JSC::SyntheticSourceProvider::create(WTFMove(function), + JSC::SyntheticSourceProvider::create(WTF::move(function), JSC::SourceOrigin(), specifier->toWTFString(BunString::ZeroCopy))); JSC::ensureStillAliveHere(object); - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTFMove(source)))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTF::move(source)))); } case OnLoadResultTypePromise: { @@ -496,7 +496,7 @@ extern "C" void Bun__onFulfillAsyncModule( auto created = Bun::createCommonJSModule(jsCast(globalObject), specifierValue, res->result.value); EXCEPTION_ASSERT(created.has_value() == !scope.exception()); if (created.has_value()) { - JSSourceCode* code = JSSourceCode::create(vm, WTFMove(created.value())); + JSSourceCode* code = JSSourceCode::create(vm, WTF::move(created.value())); promise->resolve(globalObject, code); scope.assertNoExceptionExceptTermination(); } else { @@ -956,7 +956,7 @@ static JSValue fetchESMSourceCode( auto created = Bun::createCommonJSModule(globalObject, specifierJS, res->result.value); EXCEPTION_ASSERT(created.has_value() == !scope.exception()); if (created.has_value()) { - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTFMove(created.value())))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTF::move(created.value())))); } if constexpr (allowPromise) { @@ -978,10 +978,10 @@ static JSValue fetchESMSourceCode( RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, JSC::SourceCode(provider)))); } -#define CASE(str, name) \ - case (SyntheticModuleType::name): { \ - auto source = JSC::SourceCode(JSC::SyntheticSourceProvider::create(generateNativeModule_##name, JSC::SourceOrigin(), WTFMove(moduleKey))); \ - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTFMove(source)))); \ +#define CASE(str, name) \ + case (SyntheticModuleType::name): { \ + auto source = JSC::SourceCode(JSC::SyntheticSourceProvider::create(generateNativeModule_##name, JSC::SourceOrigin(), WTF::move(moduleKey))); \ + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTF::move(source)))); \ } BUN_FOREACH_ESM_NATIVE_MODULE(CASE) #undef CASE @@ -991,7 +991,7 @@ static JSValue fetchESMSourceCode( if (tag & SyntheticModuleType::InternalModuleRegistryFlag) { constexpr auto mask = (SyntheticModuleType::InternalModuleRegistryFlag - 1); auto source = JSC::SourceCode(JSC::SyntheticSourceProvider::create(generateInternalModuleSourceCode(globalObject, static_cast(tag & mask)), JSC::SourceOrigin(URL(makeString("builtins://"_s, moduleKey))), moduleKey)); - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTFMove(source)))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTF::move(source)))); } else { auto&& provider = Zig::SourceProvider::create(globalObject, res->result.value, JSC::SourceProviderSourceType::Module, true); RELEASE_AND_RETURN(scope, rejectOrResolve(JSC::JSSourceCode::create(vm, JSC::SourceCode(provider)))); @@ -1022,7 +1022,7 @@ static JSValue fetchESMSourceCode( auto created = Bun::createCommonJSModule(globalObject, specifierJS, res->result.value); EXCEPTION_ASSERT(created.has_value() == !scope.exception()); if (created.has_value()) { - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTFMove(created.value())))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(vm, WTF::move(created.value())))); } if constexpr (allowPromise) { @@ -1067,10 +1067,10 @@ static JSValue fetchESMSourceCode( globalObject, value); auto source = JSC::SourceCode( - JSC::SyntheticSourceProvider::create(WTFMove(function), + JSC::SyntheticSourceProvider::create(WTF::move(function), JSC::SourceOrigin(), specifier->toWTFString(BunString::ZeroCopy))); JSC::ensureStillAliveHere(value); - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTFMove(source)))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTF::move(source)))); } // TOML and JSONC may go through here else if (res->result.value.tag == SyntheticModuleType::ExportsObject) { @@ -1084,10 +1084,10 @@ static JSValue fetchESMSourceCode( globalObject, value); auto source = JSC::SourceCode( - JSC::SyntheticSourceProvider::create(WTFMove(function), + JSC::SyntheticSourceProvider::create(WTF::move(function), JSC::SourceOrigin(), specifier->toWTFString(BunString::ZeroCopy))); JSC::ensureStillAliveHere(value); - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTFMove(source)))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTF::move(source)))); } else if (res->result.value.tag == SyntheticModuleType::ExportDefaultObject) { JSC::JSValue value = JSC::JSValue::decode(res->result.value.jsvalue_for_export); if (!value) { @@ -1099,10 +1099,10 @@ static JSValue fetchESMSourceCode( globalObject, value); auto source = JSC::SourceCode( - JSC::SyntheticSourceProvider::create(WTFMove(function), + JSC::SyntheticSourceProvider::create(WTF::move(function), JSC::SourceOrigin(), specifier->toWTFString(BunString::ZeroCopy))); JSC::ensureStillAliveHere(value); - RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTFMove(source)))); + RELEASE_AND_RETURN(scope, rejectOrResolve(JSSourceCode::create(globalObject->vm(), WTF::move(source)))); } RELEASE_AND_RETURN(scope, rejectOrResolve(JSC::JSSourceCode::create(vm, JSC::SourceCode(Zig::SourceProvider::create(globalObject, res->result.value))))); diff --git a/src/bun.js/bindings/NodeDirent.cpp b/src/bun.js/bindings/NodeDirent.cpp index d4d7fae7a0c334..ac05a494173e4e 100644 --- a/src/bun.js/bindings/NodeDirent.cpp +++ b/src/bun.js/bindings/NodeDirent.cpp @@ -349,14 +349,14 @@ extern "C" JSC::EncodedJSValue Bun__Dirent__toJS(Zig::GlobalObject* globalObject if (!pathValue) { auto pathString = path->transferToWTFString(); - pathValue = jsString(vm, WTFMove(pathString)); + pathValue = jsString(vm, WTF::move(pathString)); if (previousPath) { *previousPath = pathValue; } } auto nameString = name->transferToWTFString(); - auto nameValue = jsString(vm, WTFMove(nameString)); + auto nameValue = jsString(vm, WTF::move(nameString)); auto typeValue = jsNumber(type); object->putDirectOffset(vm, 0, nameValue); object->putDirectOffset(vm, 1, pathValue); diff --git a/src/bun.js/bindings/NodeHTTP.cpp b/src/bun.js/bindings/NodeHTTP.cpp index 33fcc4e1c6e8c0..d315e752495ee3 100644 --- a/src/bun.js/bindings/NodeHTTP.cpp +++ b/src/bun.js/bindings/NodeHTTP.cpp @@ -115,14 +115,14 @@ static void assignHeadersFromUWebSocketsForCall(uWS::HttpRequest* request, JSVal { std::string_view fullURLStdStr = request->getFullUrl(); String fullURL = String::fromUTF8ReplacingInvalidSequences({ reinterpret_cast(fullURLStdStr.data()), fullURLStdStr.length() }); - args.append(jsString(vm, WTFMove(fullURL))); + args.append(jsString(vm, WTF::move(fullURL))); } // Get the method. if (methodString.isUndefinedOrNull()) [[unlikely]] { std::string_view methodView = request->getMethod(); WTF::String methodString = String::fromUTF8ReplacingInvalidSequences({ reinterpret_cast(methodView.data()), methodView.length() }); - args.append(jsString(vm, WTFMove(methodString))); + args.append(jsString(vm, WTF::move(methodString))); } else { args.append(methodString); } @@ -216,7 +216,7 @@ static EncodedJSValue assignHeadersFromUWebSockets(uWS::HttpRequest* request, JS std::string_view fullURLStdStr = request->getFullUrl(); String fullURL = String::fromUTF8ReplacingInvalidSequences({ reinterpret_cast(fullURLStdStr.data()), fullURLStdStr.length() }); PutPropertySlot slot(objectValue, false); - objectValue->put(objectValue, globalObject, builtinNames.urlPublicName(), jsString(vm, WTFMove(fullURL)), slot); + objectValue->put(objectValue, globalObject, builtinNames.urlPublicName(), jsString(vm, WTF::move(fullURL)), slot); RETURN_IF_EXCEPTION(scope, {}); } diff --git a/src/bun.js/bindings/NodeVM.cpp b/src/bun.js/bindings/NodeVM.cpp index baf305f5b45506..c8e10536725810 100644 --- a/src/bun.js/bindings/NodeVM.cpp +++ b/src/bun.js/bindings/NodeVM.cpp @@ -146,7 +146,7 @@ JSC::JSFunction* constructAnonymousFunction(JSC::JSGlobalObject* globalObject, c EXCEPTION_ASSERT(!!throwScope.exception() == code.isNull()); SourceCode sourceCode( - JSC::StringSourceProvider::create(code, sourceOrigin, WTFMove(options.filename), sourceTaintOrigin, position, SourceProviderSourceType::Program), + JSC::StringSourceProvider::create(code, sourceOrigin, WTF::move(options.filename), sourceTaintOrigin, position, SourceProviderSourceType::Program), position.m_line.oneBasedInt(), position.m_column.oneBasedInt()); CodeCache* cache = vm.codeCache(); @@ -1276,7 +1276,7 @@ JSC_DEFINE_HOST_FUNCTION(vmModuleCompileFunction, (JSGlobalObject * globalObject options.parsingContext->setGlobalScopeExtension(functionScope); // Create the function using constructAnonymousFunction with the appropriate scope chain - JSFunction* function = constructAnonymousFunction(globalObject, ArgList(constructFunctionArgs), sourceOrigin, WTFMove(options), JSC::SourceTaintedOrigin::Untainted, functionScope); + JSFunction* function = constructAnonymousFunction(globalObject, ArgList(constructFunctionArgs), sourceOrigin, WTF::move(options), JSC::SourceTaintedOrigin::Untainted, functionScope); RETURN_IF_EXCEPTION(scope, {}); if (!function) { @@ -1573,12 +1573,12 @@ void configureNodeVM(JSC::VM& vm, Zig::GlobalObject* globalObject) } BaseVMOptions::BaseVMOptions(String filename) - : filename(WTFMove(filename)) + : filename(WTF::move(filename)) { } BaseVMOptions::BaseVMOptions(String filename, OrdinalNumber lineOffset, OrdinalNumber columnOffset) - : filename(WTFMove(filename)) + : filename(WTF::move(filename)) , lineOffset(lineOffset) , columnOffset(columnOffset) { diff --git a/src/bun.js/bindings/NodeVMModule.cpp b/src/bun.js/bindings/NodeVMModule.cpp index ff9489c006394e..202692f1f5d544 100644 --- a/src/bun.js/bindings/NodeVMModule.cpp +++ b/src/bun.js/bindings/NodeVMModule.cpp @@ -12,14 +12,14 @@ namespace Bun { NodeVMModuleRequest::NodeVMModuleRequest(WTF::String specifier, WTF::HashMap importAttributes) - : m_specifier(WTFMove(specifier)) - , m_importAttributes(WTFMove(importAttributes)) + : m_specifier(WTF::move(specifier)) + , m_importAttributes(WTF::move(importAttributes)) { } void NodeVMModuleRequest::addImportAttribute(WTF::String key, WTF::String value) { - m_importAttributes.set(WTFMove(key), WTFMove(value)); + m_importAttributes.set(WTF::move(key), WTF::move(value)); } JSArray* NodeVMModuleRequest::toJS(JSGlobalObject* globalObject) const @@ -152,7 +152,7 @@ JSValue NodeVMModule::evaluate(JSGlobalObject* globalObject, uint32_t timeout, b NodeVMModule::NodeVMModule(JSC::VM& vm, JSC::Structure* structure, WTF::String identifier, JSValue context, JSValue moduleWrapper) : Base(vm, structure) - , m_identifier(WTFMove(identifier)) + , m_identifier(WTF::move(identifier)) , m_context(context && context.isObject() ? asObject(context) : nullptr, JSC::WriteBarrierEarlyInit) , m_moduleWrapper(vm, this, moduleWrapper) { diff --git a/src/bun.js/bindings/NodeVMModule.h b/src/bun.js/bindings/NodeVMModule.h index 57179d37f81e4c..67ce3d5ef17582 100644 --- a/src/bun.js/bindings/NodeVMModule.h +++ b/src/bun.js/bindings/NodeVMModule.h @@ -56,7 +56,7 @@ class NodeVMModule : public JSC::JSDestructibleObject, public SigintReceiver { void namespaceObject(JSC::VM& vm, JSModuleNamespaceObject* value) { m_namespaceObject.set(vm, this, value); } const WTF::Vector& moduleRequests() const { return m_moduleRequests; } - void addModuleRequest(NodeVMModuleRequest request) { m_moduleRequests.append(WTFMove(request)); } + void addModuleRequest(NodeVMModuleRequest request) { m_moduleRequests.append(WTF::move(request)); } // Purposely not virtual. Dispatches to the correct subclass. JSValue createModuleRecord(JSC::JSGlobalObject* globalObject); diff --git a/src/bun.js/bindings/NodeVMScript.cpp b/src/bun.js/bindings/NodeVMScript.cpp index 7602c80a5003e2..b6ae742d67d223 100644 --- a/src/bun.js/bindings/NodeVMScript.cpp +++ b/src/bun.js/bindings/NodeVMScript.cpp @@ -133,7 +133,7 @@ constructScript(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue newT const bool produceCachedData = options.produceCachedData; auto filename = options.filename; - NodeVMScript* script = NodeVMScript::create(vm, globalObject, structure, WTFMove(source), WTFMove(options)); + NodeVMScript* script = NodeVMScript::create(vm, globalObject, structure, WTF::move(source), WTF::move(options)); RETURN_IF_EXCEPTION(scope, {}); fetcher->owner(vm, script); @@ -150,7 +150,7 @@ constructScript(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue newT JSC::LexicallyScopedFeatures lexicallyScopedFeatures = globalObject->globalScopeExtension() ? JSC::TaintedByWithScopeLexicallyScopedFeature : JSC::NoLexicallyScopedFeatures; JSC::SourceCodeKey key(script->source(), {}, JSC::SourceCodeType::ProgramType, lexicallyScopedFeatures, JSC::JSParserScriptMode::Classic, JSC::DerivedContextType::None, JSC::EvalContextType::None, false, {}, std::nullopt); Ref cachedBytecode = JSC::CachedBytecode::create(std::span(cachedData), nullptr, {}); - JSC::UnlinkedProgramCodeBlock* unlinkedBlock = JSC::decodeCodeBlock(vm, key, WTFMove(cachedBytecode)); + JSC::UnlinkedProgramCodeBlock* unlinkedBlock = JSC::decodeCodeBlock(vm, key, WTF::move(cachedBytecode)); if (!unlinkedBlock) { script->cachedDataRejected(TriState::True); @@ -264,7 +264,7 @@ void NodeVMScriptConstructor::finishCreation(VM& vm, JSObject* prototype) NodeVMScript* NodeVMScript::create(VM& vm, JSGlobalObject* globalObject, Structure* structure, SourceCode source, ScriptOptions options) { - NodeVMScript* ptr = new (NotNull, allocateCell(vm)) NodeVMScript(vm, structure, WTFMove(source), WTFMove(options)); + NodeVMScript* ptr = new (NotNull, allocateCell(vm)) NodeVMScript(vm, structure, WTF::move(source), WTF::move(options)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/NodeVMScript.h b/src/bun.js/bindings/NodeVMScript.h index 5637ae939a25a9..356d247a8b7817 100644 --- a/src/bun.js/bindings/NodeVMScript.h +++ b/src/bun.js/bindings/NodeVMScript.h @@ -91,8 +91,8 @@ class NodeVMScript final : public JSC::JSDestructibleObject, public SigintReceiv NodeVMScript(JSC::VM& vm, JSC::Structure* structure, JSC::SourceCode source, ScriptOptions options) : Base(vm, structure) - , m_source(WTFMove(source)) - , m_options(WTFMove(options)) + , m_source(WTF::move(source)) + , m_options(WTF::move(options)) { } diff --git a/src/bun.js/bindings/NodeVMSourceTextModule.cpp b/src/bun.js/bindings/NodeVMSourceTextModule.cpp index af84196723396a..5c3ad694ec75df 100644 --- a/src/bun.js/bindings/NodeVMSourceTextModule.cpp +++ b/src/bun.js/bindings/NodeVMSourceTextModule.cpp @@ -97,17 +97,17 @@ NodeVMSourceTextModule* NodeVMSourceTextModule::create(VM& vm, JSGlobalObject* g WTF::String sourceText = sourceTextValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, nullptr); - Ref sourceProvider = StringSourceProvider::create(WTFMove(sourceText), sourceOrigin, String {}, SourceTaintedOrigin::Untainted, + Ref sourceProvider = StringSourceProvider::create(WTF::move(sourceText), sourceOrigin, String {}, SourceTaintedOrigin::Untainted, TextPosition { OrdinalNumber::fromZeroBasedInt(lineOffset), OrdinalNumber::fromZeroBasedInt(columnOffset) }, SourceProviderSourceType::Module); - SourceCode sourceCode(WTFMove(sourceProvider), lineOffset, columnOffset); + SourceCode sourceCode(WTF::move(sourceProvider), lineOffset, columnOffset); auto* zigGlobalObject = defaultGlobalObject(globalObject); WTF::String identifier = identifierValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, nullptr); NodeVMSourceTextModule* ptr = new (NotNull, allocateCell(vm)) NodeVMSourceTextModule( - vm, zigGlobalObject->NodeVMSourceTextModuleStructure(), WTFMove(identifier), contextValue, - WTFMove(sourceCode), moduleWrapper, initializeImportMeta); + vm, zigGlobalObject->NodeVMSourceTextModuleStructure(), WTF::move(identifier), contextValue, + WTF::move(sourceCode), moduleWrapper, initializeImportMeta); RETURN_IF_EXCEPTION(scope, nullptr); ptr->finishCreation(vm); @@ -127,7 +127,7 @@ NodeVMSourceTextModule* NodeVMSourceTextModule::create(VM& vm, JSGlobalObject* g SourceCodeKey key(ptr->sourceCode(), {}, SourceCodeType::ProgramType, lexicallyScopedFeatures, JSParserScriptMode::Classic, DerivedContextType::None, EvalContextType::None, false, {}, std::nullopt); Ref cachedBytecode = CachedBytecode::create(std::span(cachedData), nullptr, {}); RETURN_IF_EXCEPTION(scope, nullptr); - UnlinkedModuleProgramCodeBlock* unlinkedBlock = decodeCodeBlock(vm, key, WTFMove(cachedBytecode)); + UnlinkedModuleProgramCodeBlock* unlinkedBlock = decodeCodeBlock(vm, key, WTF::move(cachedBytecode)); RETURN_IF_EXCEPTION(scope, nullptr); if (unlinkedBlock) { @@ -274,7 +274,7 @@ JSValue NodeVMSourceTextModule::createModuleRecord(JSGlobalObject* globalObject) break; } - attributeMap.set("type"_s, WTFMove(attributesTypeString)); + attributeMap.set("type"_s, WTF::move(attributesTypeString)); attributesObject->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s), attributesType); if (const String& hostDefinedImportType = request.m_attributes->hostDefinedImportType(); !hostDefinedImportType.isEmpty()) { @@ -291,7 +291,7 @@ JSValue NodeVMSourceTextModule::createModuleRecord(JSGlobalObject* globalObject) } requestObject->putDirect(vm, attributesIdentifier, attributesObject); - addModuleRequest({ WTF::String(*request.m_specifier), WTFMove(attributeMap) }); + addModuleRequest({ WTF::String(*request.m_specifier), WTF::move(attributeMap) }); requestsArray->putDirectIndex(globalObject, i, requestObject); } @@ -347,7 +347,7 @@ JSValue NodeVMSourceTextModule::link(JSGlobalObject* globalObject, JSArray* spec record->setImportedModule(globalObject, Identifier::fromString(vm, specifier), resolvedRecord); RETURN_IF_EXCEPTION(scope, {}); - m_resolveCache.set(WTFMove(specifier), WriteBarrier { vm, this, moduleNative }); + m_resolveCache.set(WTF::move(specifier), WriteBarrier { vm, this, moduleNative }); RETURN_IF_EXCEPTION(scope, {}); } } diff --git a/src/bun.js/bindings/NodeVMSourceTextModule.h b/src/bun.js/bindings/NodeVMSourceTextModule.h index e7e27cfdfcd2e7..790c1b5cc53d50 100644 --- a/src/bun.js/bindings/NodeVMSourceTextModule.h +++ b/src/bun.js/bindings/NodeVMSourceTextModule.h @@ -58,9 +58,9 @@ class NodeVMSourceTextModule final : public NodeVMModule { SourceCode m_sourceCode; NodeVMSourceTextModule(JSC::VM& vm, JSC::Structure* structure, WTF::String identifier, JSValue context, SourceCode sourceCode, JSValue moduleWrapper, JSValue initializeImportMeta) - : Base(vm, structure, WTFMove(identifier), context, moduleWrapper) + : Base(vm, structure, WTF::move(identifier), context, moduleWrapper) , m_initializeImportMeta(initializeImportMeta && !initializeImportMeta.isUndefined() ? initializeImportMeta : JSValue(), JSC::WriteBarrierEarlyInit) - , m_sourceCode(WTFMove(sourceCode)) + , m_sourceCode(WTF::move(sourceCode)) { } diff --git a/src/bun.js/bindings/NodeVMSyntheticModule.cpp b/src/bun.js/bindings/NodeVMSyntheticModule.cpp index 8455d7d88ce080..7cc66b429efd49 100644 --- a/src/bun.js/bindings/NodeVMSyntheticModule.cpp +++ b/src/bun.js/bindings/NodeVMSyntheticModule.cpp @@ -80,7 +80,7 @@ NodeVMSyntheticModule* NodeVMSyntheticModule::create(VM& vm, JSGlobalObject* glo auto* structure = zigGlobalObject->NodeVMSyntheticModuleStructure(); WTF::String identifier = identifierValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(scope, nullptr); - auto* ptr = new (NotNull, allocateCell(vm)) NodeVMSyntheticModule(vm, structure, WTFMove(identifier), contextValue, moduleWrapperValue, WTFMove(exportNames), syntheticEvaluationStepsValue); + auto* ptr = new (NotNull, allocateCell(vm)) NodeVMSyntheticModule(vm, structure, WTF::move(identifier), contextValue, moduleWrapperValue, WTF::move(exportNames), syntheticEvaluationStepsValue); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/NodeVMSyntheticModule.h b/src/bun.js/bindings/NodeVMSyntheticModule.h index 3d005d804dd996..e269bd94dc792a 100644 --- a/src/bun.js/bindings/NodeVMSyntheticModule.h +++ b/src/bun.js/bindings/NodeVMSyntheticModule.h @@ -52,8 +52,8 @@ class NodeVMSyntheticModule final : public NodeVMModule { WTF::HashSet m_exportNames; NodeVMSyntheticModule(JSC::VM& vm, JSC::Structure* structure, WTF::String identifier, JSValue context, JSValue moduleWrapper, WTF::HashSet exportNames, JSValue syntheticEvaluationSteps) - : Base(vm, structure, WTFMove(identifier), context, moduleWrapper) - , m_exportNames(WTFMove(exportNames)) + : Base(vm, structure, WTF::move(identifier), context, moduleWrapper) + , m_exportNames(WTF::move(exportNames)) , m_syntheticEvaluationSteps(vm, this, syntheticEvaluationSteps) { } diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/bun.js/bindings/ScriptExecutionContext.cpp index e546e7fc293ac5..c314bddd16530d 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.cpp +++ b/src/bun.js/bindings/ScriptExecutionContext.cpp @@ -137,7 +137,7 @@ ScriptExecutionContext::~ScriptExecutionContext() m_inScriptExecutionContextDestructor = true; #endif // ASSERT_ENABLED - auto postMessageCompletionHandlers = WTFMove(m_processMessageWithMessagePortsSoonHandlers); + auto postMessageCompletionHandlers = WTF::move(m_processMessageWithMessagePortsSoonHandlers); for (auto& completionHandler : postMessageCompletionHandlers) completionHandler(); @@ -157,7 +157,7 @@ bool ScriptExecutionContext::postTaskTo(ScriptExecutionContextIdentifier identif if (!context) return false; - context->postTaskConcurrently(WTFMove(task)); + context->postTaskConcurrently(WTF::move(task)); return true; } @@ -201,7 +201,7 @@ bool ScriptExecutionContext::ensureOnContextThread(ScriptExecutionContextIdentif return false; if (!context->isContextThread()) { - context->postTaskConcurrently(WTFMove(task)); + context->postTaskConcurrently(WTF::move(task)); return true; } } @@ -218,7 +218,7 @@ bool ScriptExecutionContext::ensureOnMainThread(FunctionpostTaskConcurrently(WTFMove(task)); + context->postTaskConcurrently(WTF::move(task)); return true; } @@ -231,7 +231,7 @@ ScriptExecutionContext* ScriptExecutionContext::getMainThreadScriptExecutionCont void ScriptExecutionContext::processMessageWithMessagePortsSoon(CompletionHandler&& completionHandler) { ASSERT(isContextThread()); - m_processMessageWithMessagePortsSoonHandlers.append(WTFMove(completionHandler)); + m_processMessageWithMessagePortsSoonHandlers.append(WTF::move(completionHandler)); if (m_willProcessMessageWithMessagePortsSoon) { return; @@ -368,13 +368,13 @@ ScriptExecutionContext* executionContext(JSC::JSGlobalObject* globalObject) void ScriptExecutionContext::postTaskConcurrently(Function&& lambda) { - auto* task = new EventLoopTask(WTFMove(lambda)); + auto* task = new EventLoopTask(WTF::move(lambda)); static_cast(m_globalObject)->queueTaskConcurrently(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(Function&& lambda) { - auto* task = new EventLoopTask(WTFMove(lambda)); + auto* task = new EventLoopTask(WTF::move(lambda)); static_cast(m_globalObject)->queueTask(task); } // Executes the task on context's thread asynchronously. diff --git a/src/bun.js/bindings/Serialization.cpp b/src/bun.js/bindings/Serialization.cpp index 9af0d6a492f97c..caaec599f81b45 100644 --- a/src/bun.js/bindings/Serialization.cpp +++ b/src/bun.js/bindings/Serialization.cpp @@ -33,7 +33,7 @@ extern "C" SerializedValueSlice Bun__serializeJSValue(JSGlobalObject* globalObje auto forStorage = (static_cast(flags) & static_cast(SerializedFlags::ForStorage)) ? SerializationForStorage::Yes : SerializationForStorage::No; auto context = SerializationContext::Default; auto forTransferEnum = (static_cast(flags) & static_cast(SerializedFlags::ForCrossProcessTransfer)) ? SerializationForCrossProcessTransfer::Yes : SerializationForCrossProcessTransfer::No; - ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTFMove(transferList), dummyPorts, forStorage, context, forTransferEnum); + ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTF::move(transferList), dummyPorts, forStorage, context, forTransferEnum); EXCEPTION_ASSERT(!!scope.exception() == serialized.hasException()); if (serialized.hasException()) { @@ -54,13 +54,15 @@ extern "C" SerializedValueSlice Bun__serializeJSValue(JSGlobalObject* globalObje extern "C" void Bun__SerializedScriptSlice__free(SerializedScriptValue* value) { - delete value; + // Use deref() instead of delete to properly handle CHECK_REF_COUNTED_LIFECYCLE. + // The value was leaked via leakRef() which leaves refcount at 1, so deref() will delete it. + value->deref(); } extern "C" EncodedJSValue Bun__JSValue__deserialize(JSGlobalObject* globalObject, const uint8_t* bytes, size_t size) { Vector vector(std::span { bytes, size }); /// ?! did i just give ownership of these bytes to JSC? - auto scriptValue = SerializedScriptValue::createFromWireBytes(WTFMove(vector)); + auto scriptValue = SerializedScriptValue::createFromWireBytes(WTF::move(vector)); return JSValue::encode(scriptValue->deserialize(*globalObject, globalObject)); } diff --git a/src/bun.js/bindings/ShellBindings.cpp b/src/bun.js/bindings/ShellBindings.cpp index 5d8cc9d6929d60..db11b91f750680 100644 --- a/src/bun.js/bindings/ShellBindings.cpp +++ b/src/bun.js/bindings/ShellBindings.cpp @@ -22,7 +22,7 @@ extern "C" SYSV_ABI EncodedJSValue Bun__createShellInterpreter(Zig::GlobalObject auto* structure = globalObject->JSShellInterpreterStructure(); ASSERT(structure); - auto* result = WebCore::JSShellInterpreter::create(vm, globalObject, structure, ptr, WTFMove(args), resolveFn, rejectFn); + auto* result = WebCore::JSShellInterpreter::create(vm, globalObject, structure, ptr, WTF::move(args), resolveFn, rejectFn); size_t size = ShellInterpreter__estimatedSize(ptr); vm.heap.reportExtraMemoryAllocated(result, size); diff --git a/src/bun.js/bindings/TextCodecCJK.cpp b/src/bun.js/bindings/TextCodecCJK.cpp index c2dc80f2766736..b09ee6188982ce 100644 --- a/src/bun.js/bindings/TextCodecCJK.cpp +++ b/src/bun.js/bindings/TextCodecCJK.cpp @@ -1081,7 +1081,7 @@ static Vector gbEncodeShared(StringView string, Function gb18030Encode(StringView string, Function&)>&& unencodableHandler) { - return gbEncodeShared(string, WTFMove(unencodableHandler), IsGBK::No); + return gbEncodeShared(string, WTF::move(unencodableHandler), IsGBK::No); } // https://encoding.spec.whatwg.org/#gbk-decoder @@ -1092,7 +1092,7 @@ String TextCodecCJK::gbkDecode(std::span bytes, bool flush, bool static Vector gbkEncode(StringView string, Function&)>&& unencodableHandler) { - return gbEncodeShared(string, WTFMove(unencodableHandler), IsGBK::Yes); + return gbEncodeShared(string, WTF::move(unencodableHandler), IsGBK::Yes); } constexpr size_t maxUChar32Digits = 10; diff --git a/src/bun.js/bindings/TextEncodingRegistry.cpp b/src/bun.js/bindings/TextEncodingRegistry.cpp index cab9ba628fe500..356537245b0691 100644 --- a/src/bun.js/bindings/TextEncodingRegistry.cpp +++ b/src/bun.js/bindings/TextEncodingRegistry.cpp @@ -174,7 +174,7 @@ static void addToTextCodecMap(ASCIILiteral name, NewTextCodecFunction&& function { ASCIILiteral atomName = textEncodingNameMap().get(name); ASSERT(!atomName.isNull()); - textCodecMap().add(atomName, WTFMove(function)); + textCodecMap().add(atomName, WTF::move(function)); } static void pruneBlocklistedCodecs() WTF_REQUIRES_LOCK(encodingRegistryLock) diff --git a/src/bun.js/bindings/URLSearchParams.cpp b/src/bun.js/bindings/URLSearchParams.cpp index e8a15e51948785..7d5f9d225d8ed3 100644 --- a/src/bun.js/bindings/URLSearchParams.cpp +++ b/src/bun.js/bindings/URLSearchParams.cpp @@ -35,7 +35,7 @@ extern "C" JSC::EncodedJSValue URLSearchParams__create(JSDOMGlobalObject* global { String str = Zig::toString(*input); auto result = URLSearchParams::create(str, nullptr); - return JSC::JSValue::encode(WebCore::toJSNewlyCreated(globalObject, globalObject, WTFMove(result))); + return JSC::JSValue::encode(WebCore::toJSNewlyCreated(globalObject, globalObject, WTF::move(result))); } extern "C" WebCore::URLSearchParams* URLSearchParams__fromJS(JSC::EncodedJSValue value) @@ -75,7 +75,7 @@ ExceptionOr> URLSearchParams::create(std::variant>& pairs) -> ExceptionOr> { return adoptRef(*new URLSearchParams(pairs)); }, [&](const String& string) -> ExceptionOr> { return adoptRef(*new URLSearchParams(string, nullptr)); }); + return adoptRef(*new URLSearchParams(WTF::move(pairs))); }, [&](const Vector>& pairs) -> ExceptionOr> { return adoptRef(*new URLSearchParams(pairs)); }, [&](const String& string) -> ExceptionOr> { return adoptRef(*new URLSearchParams(string, nullptr)); }); return std::visit(visitor, variant); } diff --git a/src/bun.js/bindings/Uint8Array.cpp b/src/bun.js/bindings/Uint8Array.cpp index 9e37d9225f249d..53feafee1e83e7 100644 --- a/src/bun.js/bindings/Uint8Array.cpp +++ b/src/bun.js/bindings/Uint8Array.cpp @@ -15,7 +15,7 @@ extern "C" JSC::EncodedJSValue JSUint8Array__fromDefaultAllocator(JSC::JSGlobalO mi_free(p); })); - uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructureWithTypedArrayType(), WTFMove(buffer), 0, length); + uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructureWithTypedArrayType(), WTF::move(buffer), 0, length); } else { uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructureWithTypedArrayType(), 0); } @@ -36,7 +36,7 @@ extern "C" JSC::EncodedJSValue JSArrayBuffer__fromDefaultAllocator(JSC::JSGlobal buffer = ArrayBuffer::create(0, 1); } - auto arrayBuffer = JSC::JSArrayBuffer::create(lexicalGlobalObject->vm(), lexicalGlobalObject->arrayBufferStructure(), WTFMove(buffer)); + auto arrayBuffer = JSC::JSArrayBuffer::create(lexicalGlobalObject->vm(), lexicalGlobalObject->arrayBufferStructure(), WTF::move(buffer)); return JSC::JSValue::encode(arrayBuffer); } diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 0e9e1161e2649f..dbbe784ad0db04 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -531,7 +531,7 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, auto& options = worker.options(); if (options.env.has_value()) { - HashMap map = WTFMove(*std::exchange(options.env, std::nullopt)); + HashMap map = *std::exchange(options.env, std::nullopt); auto size = map.size(); // In theory, a GC could happen before we finish putting all the properties on the object. @@ -547,7 +547,7 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, for (auto k : map) { // They can have environment variables with numbers as keys. // So we must use putDirectMayBeIndex to handle that. - env->putDirectMayBeIndex(globalObject, JSC::Identifier::fromString(vm, WTFMove(k.key)), strings.at(i++)); + env->putDirectMayBeIndex(globalObject, JSC::Identifier::fromString(vm, WTF::move(k.key)), strings.at(i++)); } globalObject->m_processEnvObject.set(vm, globalObject, env); } @@ -1073,7 +1073,7 @@ JSC_DEFINE_HOST_FUNCTION(functionQueueMicrotask, // The runtime inspects argumentCount to determine which arguments are present, so callers may pass only the subset they need. // Here we pass: function, callback, asyncContext. JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, function, callback, asyncContext }; - globalObject->vm().queueMicrotask(WTFMove(task)); + globalObject->vm().queueMicrotask(WTF::move(task)); return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -1130,7 +1130,7 @@ JSC_DEFINE_HOST_FUNCTION(functionBTOA, return {}; } WTF::StringImpl::copyCharacters(ptr, encodedString.span16()); - encodedString = WTFMove(dest); + encodedString = WTF::move(dest); } unsigned length = encodedString.length(); @@ -1198,7 +1198,7 @@ extern "C" JSC::EncodedJSValue ArrayBuffer__fromSharedMemfd(int64_t fd, JSC::JSG })); if (type == JSC::Uint8ArrayType) { - auto uint8array = JSC::JSUint8Array::create(globalObject, globalObject->m_typedArrayUint8.get(globalObject), WTFMove(buffer), 0, byteLength); + auto uint8array = JSC::JSUint8Array::create(globalObject, globalObject->m_typedArrayUint8.get(globalObject), WTF::move(buffer), 0, byteLength); return JSValue::encode(uint8array); } @@ -1210,7 +1210,7 @@ extern "C" JSC::EncodedJSValue ArrayBuffer__fromSharedMemfd(int64_t fd, JSC::JSG return JSC::JSValue::encode(JSC::JSValue {}); } - return JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), structure, WTFMove(buffer))); + return JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), structure, WTF::move(buffer))); } else { RELEASE_ASSERT_NOT_REACHED(); } @@ -1232,7 +1232,7 @@ extern "C" JSC::EncodedJSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject if (len > 0) memcpy(arrayBuffer->data(), ptr, len); - RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer)))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTF::move(arrayBuffer)))); } extern "C" JSC::EncodedJSValue Bun__allocUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, size_t len, void** ptr) @@ -1286,7 +1286,7 @@ extern "C" JSC::EncodedJSValue Bun__makeArrayBufferWithBytesNoCopy(JSC::JSGlobal if (deallocator) deallocator(p, deallocatorContext); })); - JSArrayBuffer* jsBuffer = JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTFMove(buffer)); + JSArrayBuffer* jsBuffer = JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTF::move(buffer)); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(jsBuffer); } @@ -1299,7 +1299,7 @@ extern "C" JSC::EncodedJSValue Bun__makeTypedArrayWithBytesNoCopy(JSC::JSGlobalO auto buffer_ = ArrayBuffer::createFromBytes({ static_cast(ptr), len }, createSharedTask([=](void* p) { if (deallocator) deallocator(p, deallocatorContext); })); - RefPtr&& buffer = WTFMove(buffer_); + RefPtr&& buffer = WTF::move(buffer_); if (!buffer) { throwOutOfMemoryError(globalObject, scope); return {}; @@ -1313,7 +1313,7 @@ extern "C" JSC::EncodedJSValue Bun__makeTypedArrayWithBytesNoCopy(JSC::JSGlobalO switch (ty) { #define JSC_TYPED_ARRAY_FACTORY(type) \ case Type##type: \ - RELEASE_AND_RETURN(scope, JSValue::encode(JS##type##Array::create(globalObject, globalObject->typedArrayStructure(Type##type, isResizableOrGrowableShared), WTFMove(buffer), offset, length))); + RELEASE_AND_RETURN(scope, JSValue::encode(JS##type##Array::create(globalObject, globalObject->typedArrayStructure(Type##type, isResizableOrGrowableShared), WTF::move(buffer), offset, length))); #undef JSC_TYPED_ARRAY_CHECK FOR_EACH_TYPED_ARRAY_TYPE_EXCLUDING_DATA_VIEW(JSC_TYPED_ARRAY_FACTORY) case NotTypedArray: @@ -1337,7 +1337,7 @@ JSC_DEFINE_HOST_FUNCTION(functionCreateUninitializedArrayBuffer, return {}; } - RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer)))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTF::move(arrayBuffer)))); } static inline JSC::EncodedJSValue jsFunctionAddEventListenerBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, Zig::GlobalObject* castedThis) @@ -1358,7 +1358,7 @@ static inline JSC::EncodedJSValue jsFunctionAddEventListenerBody(JSC::JSGlobalOb EnsureStillAliveScope argument2 = callFrame->argument(2); auto options = argument2.value().isUndefined() ? false : convert, IDLBoolean>>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto result = JSValue::encode(WebCore::toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl->addEventListenerForBindings(WTFMove(type), WTFMove(listener), WTFMove(options)); })); + auto result = JSValue::encode(WebCore::toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl->addEventListenerForBindings(WTF::move(type), WTF::move(listener), WTF::move(options)); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); return result; @@ -1387,7 +1387,7 @@ static inline JSC::EncodedJSValue jsFunctionRemoveEventListenerBody(JSC::JSGloba EnsureStillAliveScope argument2 = callFrame->argument(2); auto options = argument2.value().isUndefined() ? false : convert, IDLBoolean>>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto result = JSValue::encode(WebCore::toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl->removeEventListenerForBindings(WTFMove(type), WTFMove(listener), WTFMove(options)); })); + auto result = JSValue::encode(WebCore::toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl->removeEventListenerForBindings(WTF::move(type), WTF::move(listener), WTF::move(options)); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); return result; @@ -1503,7 +1503,7 @@ JSC_DEFINE_HOST_FUNCTION(createWritableStreamFromInternal, (JSGlobalObject * glo auto* jsDOMGlobalObject = JSC::jsCast(globalObject); auto internalWritableStream = InternalWritableStream::fromObject(*jsDOMGlobalObject, *callFrame->uncheckedArgument(0).toObject(globalObject)); - return JSValue::encode(toJSNewlyCreated(globalObject, jsDOMGlobalObject, WritableStream::create(WTFMove(internalWritableStream)))); + return JSValue::encode(toJSNewlyCreated(globalObject, jsDOMGlobalObject, WritableStream::create(WTF::move(internalWritableStream)))); } JSC_DEFINE_HOST_FUNCTION(addAbortAlgorithmToSignal, (JSGlobalObject * globalObject, CallFrame* callFrame)) @@ -1518,7 +1518,7 @@ JSC_DEFINE_HOST_FUNCTION(addAbortAlgorithmToSignal, (JSGlobalObject * globalObje Ref abortAlgorithm = JSAbortAlgorithm::create(vm, callFrame->uncheckedArgument(1).getObject()); - auto algorithmIdentifier = AbortSignal::addAbortAlgorithmToSignal(abortSignal->wrapped(), WTFMove(abortAlgorithm)); + auto algorithmIdentifier = AbortSignal::addAbortAlgorithmToSignal(abortSignal->wrapped(), WTF::move(abortAlgorithm)); return JSValue::encode(JSC::jsNumber(algorithmIdentifier)); } @@ -3104,7 +3104,7 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskCallback(Zig::GlobalObject* g // Do not use JSCell* here because the GC will try to visit it. // Use BunInvokeJobWithArguments to pass the two arguments (ptr and callback) to the trampoline function JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunInvokeJobWithArguments, globalObject, function, JSValue(std::bit_cast(reinterpret_cast(ptr))), JSValue(std::bit_cast(reinterpret_cast(callback))) }; - globalObject->vm().queueMicrotask(WTFMove(task)); + globalObject->vm().queueMicrotask(WTF::move(task)); } JSC::Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* jsGlobalObject, @@ -3450,7 +3450,7 @@ static JSC::JSPromise* handleResponseOnStreamingAction(JSGlobalObject* lexicalGl return promise; } - auto wrapper = WebCore::toJSNewlyCreated(globalObject, globalObject, WTFMove(compiler)); + auto wrapper = WebCore::toJSNewlyCreated(globalObject, globalObject, WTF::move(compiler)); auto builtin = globalObject->wasmStreamingConsumeStreamFunction(); auto callData = JSC::getCallData(builtin); MarkedArgumentBuffer arguments; diff --git a/src/bun.js/bindings/ZigSourceProvider.cpp b/src/bun.js/bindings/ZigSourceProvider.cpp index 021b567551f52a..ff17060d39a163 100644 --- a/src/bun.js/bindings/ZigSourceProvider.cpp +++ b/src/bun.js/bindings/ZigSourceProvider.cpp @@ -110,7 +110,7 @@ Ref SourceProvider::create( toSourceOrigin(sourceURLString, isBuiltin), sourceURLString.impl(), TextPosition(), sourceType)); - provider->m_cachedBytecode = WTFMove(bytecode); + provider->m_cachedBytecode = WTF::move(bytecode); return provider; } @@ -348,11 +348,11 @@ int SourceProvider::readCache(JSC::VM& vm, const JSC::SourceCode& sourceCode) // if (fileTotalSize == 0) // return 0; - // Ref cachedBytecode = JSC::CachedBytecode::create(WTFMove(mappedFile)); + // Ref cachedBytecode = JSC::CachedBytecode::create(WTF::move(mappedFile)); // // auto key = JSC::sourceCodeKeyForSerializedModule(vm, sourceCode); // // if (isCachedBytecodeStillValid(vm, cachedBytecode.copyRef(), key, // // JSC::SourceCodeType::ModuleType)) { - // m_cachedBytecode = WTFMove(cachedBytecode); + // m_cachedBytecode = WTF::move(cachedBytecode); // return 1; // } else { // FileSystem::truncateFile(fd, 0); diff --git a/src/bun.js/bindings/ZigSourceProvider.h b/src/bun.js/bindings/ZigSourceProvider.h index 2379c883c47204..b1d036791dc957 100644 --- a/src/bun.js/bindings/ZigSourceProvider.h +++ b/src/bun.js/bindings/ZigSourceProvider.h @@ -64,7 +64,7 @@ class SourceProvider final : public JSC::SourceProvider { JSC::SourceTaintedOrigin taintedness, const SourceOrigin& sourceOrigin, WTF::String&& sourceURL, const TextPosition& startPosition, JSC::SourceProviderSourceType sourceType) - : Base(sourceOrigin, WTFMove(sourceURL), String(), taintedness, startPosition, sourceType) + : Base(sourceOrigin, WTF::move(sourceURL), String(), taintedness, startPosition, sourceType) , m_globalObject(globalObject) , m_source(sourceImpl) { diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 0f3b3d07e73efe..3a4130c9838b4f 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -722,9 +722,9 @@ bool Bun__deepEquals(JSC::JSGlobalObject* globalObject, JSValue v1, JSValue v2, ASSERT(c2); std::optional isSpecialEqual = specialObjectsDequal(globalObject, gcBuffer, stack, scope, c1, c2); RETURN_IF_EXCEPTION(scope, false); - if (isSpecialEqual.has_value()) return std::move(*isSpecialEqual); + if (isSpecialEqual.has_value()) return WTF::move(*isSpecialEqual); isSpecialEqual = specialObjectsDequal(globalObject, gcBuffer, stack, scope, c2, c1); - if (isSpecialEqual.has_value()) return std::move(*isSpecialEqual); + if (isSpecialEqual.has_value()) return WTF::move(*isSpecialEqual); JSObject* o1 = v1.getObject(); JSObject* o2 = v2.getObject(); @@ -1806,7 +1806,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject* // `fill` doesn't set an exception on the VM if it fails, it returns an // ExceptionOr. So we need to check for the exception and, if set, // translate it to JSValue and throw it. - WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->fill(WTFMove(init.value()))); + WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->fill(WTF::move(init.value()))); // If there's an exception, it will be thrown by the above call to fill(). // in that case, let's also free the headers to make memory leaks harder. @@ -1841,7 +1841,7 @@ JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers, Zig::GlobalObject* globalObject = static_cast(arg1); auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); WebCore::propagateException(*arg1, throwScope, clone->fill(*headers)); - return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTFMove(clone))); + return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTF::move(clone))); } WebCore::FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject) @@ -1972,7 +1972,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void* } } - headers->setInternalHeaders(WTFMove(map)); + headers->setInternalHeaders(WTF::move(map)); } return headers; } @@ -1995,12 +1995,12 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1) HTTPHeaderName name; if (WebCore::findHTTPHeaderName(nameView, name)) { - map.add(name, WTFMove(value)); + map.add(name, WTF::move(value)); } else { - map.setUncommonHeader(nameView.toString().isolatedCopy(), WTFMove(value)); + map.setUncommonHeader(nameView.toString().isolatedCopy(), WTF::move(value)); } } - headers->setInternalHeaders(WTFMove(map)); + headers->setInternalHeaders(WTF::move(map)); return headers; } void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0) @@ -2022,7 +2022,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createValueNotJS(JSC::JSGlobalObje auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); headers->relaxAdoptionRequirement(); - WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTFMove(pairs)))); + WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTF::move(pairs)))); if (throwScope.exception()) { headers->deref(); return nullptr; @@ -2043,9 +2043,9 @@ JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0 } Ref headers = WebCore::FetchHeaders::create(); - WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTFMove(pairs)))); + WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTF::move(pairs)))); - JSValue value = WebCore::toJSNewlyCreated(arg0, static_cast(arg0), WTFMove(headers)); + JSValue value = WebCore::toJSNewlyCreated(arg0, static_cast(arg0), WTF::move(headers)); JSFetchHeaders* fetchHeaders = jsCast(value); fetchHeaders->computeMemoryCost(); @@ -2552,6 +2552,22 @@ void JSC__JSValue__jsonStringify(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObje RETURN_IF_EXCEPTION(scope, ); *arg3 = Bun::toStringRef(str); } + +// Fast version of JSON.stringify that uses JSC's FastStringifier optimization. +// When space is undefined, JSC uses FastStringifier which is significantly faster +// than the general Stringifier used when space is a number (even 0). +void JSC__JSValue__jsonStringifyFast(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, + BunString* arg3) +{ + ASSERT_NO_PENDING_EXCEPTION(arg1); + auto& vm = JSC::getVM(arg1); + auto scope = DECLARE_THROW_SCOPE(vm); + JSC::JSValue value = JSC::JSValue::decode(JSValue0); + // Passing jsUndefined() for space triggers JSC's FastStringifier optimization + WTF::String str = JSC::JSONStringify(arg1, value, JSC::jsUndefined()); + RETURN_IF_EXCEPTION(scope, ); + *arg3 = Bun::toStringRef(str); +} unsigned char JSC__JSValue__jsType(JSC::EncodedJSValue JSValue0) { JSC::JSValue jsValue = JSC::JSValue::decode(JSValue0); @@ -2908,7 +2924,7 @@ JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObj JSC::SourceCode sourceCode = JSC::makeSource( src, JSC::SourceOrigin { origin }, JSC::SourceTaintedOrigin::Untainted, origin.fileSystemPath(), WTF::TextPosition(), JSC::SourceProviderSourceType::Module); - globalObject->moduleLoader()->provideFetch(globalObject, jsString(vm, origin.fileSystemPath()), WTFMove(sourceCode)); + globalObject->moduleLoader()->provideFetch(globalObject, jsString(vm, origin.fileSystemPath()), WTF::move(sourceCode)); auto* promise = JSC::importModule(globalObject, JSC::Identifier::fromString(vm, origin.fileSystemPath()), JSValue(jsString(vm, referrer.fileSystemPath())), JSValue(), JSValue()); auto scope = DECLARE_THROW_SCOPE(vm); @@ -3138,8 +3154,8 @@ JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObjec auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); - JSC::JSValue message = JSC::jsOwnedString(vm, Zig::toString(*arg3)); - JSC::JSValue options = JSC::jsUndefined(); + WTF::String message = Zig::toString(*arg3); + JSC::JSValue cause = JSC::jsUndefined(); JSC::JSArray* array = nullptr; { JSC::ObjectInitializationScope initializationScope(vm); @@ -3160,14 +3176,14 @@ JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObjec JSC::Structure* errorStructure = globalObject->errorStructure(JSC::ErrorType::AggregateError); - RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::createAggregateError(globalObject, vm, errorStructure, array, message, options, nullptr, JSC::TypeNothing, false))); + RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::createAggregateError(vm, errorStructure, array, message, cause, nullptr, JSC::TypeNothing, false))); } -JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateErrorWithArray(JSC::JSGlobalObject* global, JSC::JSArray* array, BunString message, JSValue options) +JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateErrorWithArray(JSC::JSGlobalObject* global, JSC::JSArray* array, BunString message, JSValue cause) { auto& vm = JSC::getVM(global); JSC::Structure* errorStructure = global->errorStructure(JSC::ErrorType::AggregateError); WTF::String messageString = message.toWTFString(); - return JSC::JSValue::encode(JSC::createAggregateError(global, vm, errorStructure, array, JSC::jsString(vm, messageString), options, nullptr, JSC::TypeNothing, false)); + return JSC::JSValue::encode(JSC::createAggregateError(vm, errorStructure, array, messageString, cause, nullptr, JSC::TypeNothing, false)); } JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) @@ -3178,11 +3194,11 @@ JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGloba if (isTaggedUTF16Ptr(arg0->ptr)) { if (auto impl = WTF::AtomStringImpl::lookUp(std::span { reinterpret_cast(untag(arg0->ptr)), arg0->len })) { - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(WTFMove(impl)))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(WTF::move(impl)))); } } else { if (auto impl = WTF::AtomStringImpl::lookUp(std::span { untag(arg0->ptr), arg0->len })) { - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(WTFMove(impl)))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::String(WTF::move(impl)))); } } @@ -3203,7 +3219,7 @@ JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, J auto ref = String(ExternalStringImpl::create({ reinterpret_cast(arg0), len }, reinterpret_cast(const_cast(arg0)), free_global_string)); - return JSC::JSValue::encode(JSC::jsString(global->vm(), WTFMove(ref))); + return JSC::JSValue::encode(JSC::jsString(global->vm(), WTF::move(ref))); } // This must be a globally allocated string @@ -3215,10 +3231,10 @@ JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, J } if (Zig::isTaggedUTF16Ptr(str.ptr)) { auto ref = String(ExternalStringImpl::create({ reinterpret_cast(Zig::untag(str.ptr)), str.len }, Zig::untagVoid(str.ptr), free_global_string)); - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTFMove(ref))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::move(ref))); } else { auto ref = String(ExternalStringImpl::create({ Zig::untag(str.ptr), str.len }, Zig::untagVoid(str.ptr), free_global_string)); - return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTFMove(ref))); + return JSC::JSValue::encode(JSC::jsString(arg1->vm(), WTF::move(ref))); } } @@ -3525,7 +3541,7 @@ void JSC__JSPromise__rejectOnNextTickWithHandled(JSC::JSPromise* promise, JSC::J } JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, microtaskFunction, rejectPromiseFunction, globalObject->m_asyncContextData.get()->getInternalField(0), promise, value }; - globalObject->vm().queueMicrotask(WTFMove(task)); + globalObject->vm().queueMicrotask(WTF::move(task)); RETURN_IF_EXCEPTION(scope, ); } } @@ -5412,8 +5428,8 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0 #endif - JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, microTaskFunction, WTFMove(microtaskArgs[0]), WTFMove(microtaskArgs[1]), WTFMove(microtaskArgs[2]), WTFMove(microtaskArgs[3]) }; - globalObject->vm().queueMicrotask(WTFMove(task)); + JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, microTaskFunction, WTF::move(microtaskArgs[0]), WTF::move(microtaskArgs[1]), WTF::move(microtaskArgs[2]), WTF::move(microtaskArgs[3]) }; + globalObject->vm().queueMicrotask(WTF::move(task)); } extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC::JSGlobalObject* globalObject) @@ -5430,7 +5446,7 @@ extern "C" JSC::EncodedJSValue WebCore__AbortSignal__create(JSC::JSGlobalObject* auto* context = thisObject->scriptExecutionContext(); auto abortSignal = WebCore::AbortSignal::create(context); - return JSValue::encode(toJSNewlyCreated>(*globalObject, *jsCast(globalObject), WTFMove(abortSignal))); + return JSValue::encode(toJSNewlyCreated>(*globalObject, *jsCast(globalObject), WTF::move(abortSignal))); } extern "C" JSC::EncodedJSValue WebCore__AbortSignal__toJS(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* globalObject) { @@ -5697,15 +5713,15 @@ CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlo auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); return Bun::ERR::STRING_TOO_LONG(scope, globalObject); } - auto formData = DOMFormData::create(globalObject->scriptExecutionContext(), WTFMove(str)); - return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); + auto formData = DOMFormData::create(globalObject->scriptExecutionContext(), WTF::move(str)); + return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTF::move(formData))); } CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0) { Zig::GlobalObject* globalObject = static_cast(arg0); auto formData = DOMFormData::create(globalObject->scriptExecutionContext()); - return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); + return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTF::move(formData))); } CPP_DECL WebCore::DOMFormData* WebCore__DOMFormData__fromJS(JSC::EncodedJSValue JSValue1) diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 06e1a7f96a26ae..895bb4f078646f 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -265,6 +265,7 @@ CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromDouble(double arg0); CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0); CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0); CPP_DECL void JSC__JSValue__jsonStringify(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, BunString* arg3); +CPP_DECL void JSC__JSValue__jsonStringifyFast(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, BunString* arg3); CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsTDZValue(); CPP_DECL unsigned char JSC__JSValue__jsType(JSC::EncodedJSValue JSValue0); CPP_DECL JSC::EncodedJSValue JSC__JSValue__keys(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue arg1); diff --git a/src/bun.js/bindings/helpers.h b/src/bun.js/bindings/helpers.h index 4e69126a00165a..16411881e07b82 100644 --- a/src/bun.js/bindings/helpers.h +++ b/src/bun.js/bindings/helpers.h @@ -208,14 +208,14 @@ static const WTF::String toStringCopy(ZigString str) return WTF::String(); } memcpy(out.data(), untag(str.ptr), str.len * sizeof(char16_t)); - return WTF::String(WTFMove(impl)); + return WTF::String(WTF::move(impl)); } else { std::span out; auto impl = WTF::StringImpl::tryCreateUninitialized(str.len, out); if (!impl) [[unlikely]] return WTF::String(); memcpy(out.data(), untag(str.ptr), str.len * sizeof(Latin1Character)); - return WTF::String(WTFMove(impl)); + return WTF::String(WTF::move(impl)); } } diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index c68618adf356a4..447287be0e8882 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -606,7 +606,7 @@ extern "C" napi_status napi_set_named_property(napi_env env, napi_value object, JSC::EnsureStillAliveScope ensureAlive2(target); auto nameStr = WTF::String::fromUTF8({ utf8name, strlen(utf8name) }); - auto name = JSC::PropertyName(JSC::Identifier::fromString(vm, WTFMove(nameStr))); + auto name = JSC::PropertyName(JSC::Identifier::fromString(vm, WTF::move(nameStr))); PutPropertySlot slot(target, false); target->putInline(globalObject, name, jsValue, slot); @@ -632,7 +632,7 @@ extern "C" napi_status napi_create_arraybuffer(napi_env env, return napi_set_last_error(env, napi_generic_failure); } - auto* jsArrayBuffer = JSC::JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTFMove(arrayBuffer)); + auto* jsArrayBuffer = JSC::JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTF::move(arrayBuffer)); NAPI_RETURN_IF_EXCEPTION(env); if (data && jsArrayBuffer->impl()) [[likely]] { @@ -1451,7 +1451,7 @@ node_api_create_external_string_latin1(napi_env env, }); Zig::GlobalObject* globalObject = toJS(env); - JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTFMove(impl))); + JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTF::move(impl))); ensureStillAliveHere(out); *result = toNapi(out, globalObject); ensureStillAliveHere(out); @@ -1487,7 +1487,7 @@ node_api_create_external_string_utf16(napi_env env, }); Zig::GlobalObject* globalObject = toJS(env); - JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTFMove(impl))); + JSString* out = JSC::jsString(JSC::getVM(globalObject), WTF::String(WTF::move(impl))); ensureStillAliveHere(out); *result = toNapi(out, globalObject); ensureStillAliveHere(out); @@ -1714,27 +1714,27 @@ static JSC::JSArrayBufferView* createArrayBufferView( Structure* structure = globalObject->typedArrayStructure(getTypedArrayTypeFromNAPI(type), arrayBuffer->isResizableOrGrowableShared()); switch (type) { case napi_int8_array: - return JSC::JSInt8Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSInt8Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_uint8_array: - return JSC::JSUint8Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSUint8Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_uint8_clamped_array: - return JSC::JSUint8ClampedArray::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSUint8ClampedArray::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_int16_array: - return JSC::JSInt16Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSInt16Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_uint16_array: - return JSC::JSUint16Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSUint16Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_int32_array: - return JSC::JSInt32Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSInt32Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_uint32_array: - return JSC::JSUint32Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSUint32Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_float32_array: - return JSC::JSFloat32Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSFloat32Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_float64_array: - return JSC::JSFloat64Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSFloat64Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_bigint64_array: - return JSC::JSBigInt64Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSBigInt64Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); case napi_biguint64_array: - return JSC::JSBigUint64Array::create(globalObject, structure, WTFMove(arrayBuffer), byteOffset, length); + return JSC::JSBigUint64Array::create(globalObject, structure, WTF::move(arrayBuffer), byteOffset, length); default: ASSERT_NOT_REACHED_WITH_MESSAGE("Unexpected napi_typedarray_type"); } @@ -2031,7 +2031,7 @@ extern "C" napi_status napi_create_external_buffer(napi_env env, size_t length, // TODO: is there a way to create a detached uint8 array? auto arrayBuffer = JSC::ArrayBuffer::createUninitialized(0, 1); - auto* buffer = JSC::JSUint8Array::create(globalObject, subclassStructure, WTFMove(arrayBuffer), 0, 0); + auto* buffer = JSC::JSUint8Array::create(globalObject, subclassStructure, WTF::move(arrayBuffer), 0, 0); NAPI_RETURN_IF_EXCEPTION(env); buffer->existingBuffer()->detach(vm); @@ -2048,7 +2048,7 @@ extern "C" napi_status napi_create_external_buffer(napi_env env, size_t length, // do nothing })); - auto* buffer = JSC::JSUint8Array::create(globalObject, subclassStructure, WTFMove(arrayBuffer), 0, length); + auto* buffer = JSC::JSUint8Array::create(globalObject, subclassStructure, WTF::move(arrayBuffer), 0, length); NAPI_RETURN_IF_EXCEPTION(env); // setup finalizer after creating the array. if it throws callers of napi_create_external_buffer are expected @@ -2076,7 +2076,7 @@ extern "C" napi_status napi_create_external_arraybuffer(napi_env env, void* exte env->doFinalizer(finalize_cb, p, finalize_hint); })); - auto* buffer = JSC::JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTFMove(arrayBuffer)); + auto* buffer = JSC::JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTF::move(arrayBuffer)); *result = toNapi(buffer, globalObject); NAPI_RETURN_SUCCESS(env); diff --git a/src/bun.js/bindings/napi.h b/src/bun.js/bindings/napi.h index 56346cd0194e92..30efadbcdd987c 100644 --- a/src/bun.js/bindings/napi.h +++ b/src/bun.js/bindings/napi.h @@ -669,7 +669,7 @@ class NapiRef { NapiRef(Ref&& env, uint32_t count, Bun::NapiFinalizer finalizer) : env(env) , globalObject(JSC::Weak(env->globalObject())) - , finalizer(WTFMove(finalizer)) + , finalizer(WTF::move(finalizer)) , refCount(count) { } diff --git a/src/bun.js/bindings/ncrypto.cpp b/src/bun.js/bindings/ncrypto.cpp index 446ee74a643591..e1e747ed780651 100644 --- a/src/bun.js/bindings/ncrypto.cpp +++ b/src/bun.js/bindings/ncrypto.cpp @@ -206,7 +206,7 @@ DataPointer& DataPointer::operator=(DataPointer&& other) noexcept { if (this == &other) return *this; this->~DataPointer(); - return *new (this) DataPointer(WTFMove(other)); + return *new (this) DataPointer(WTF::move(other)); } DataPointer::~DataPointer() @@ -337,7 +337,7 @@ BignumPointer& BignumPointer::operator=(BignumPointer&& other) noexcept { if (this == &other) return *this; this->~BignumPointer(); - return *new (this) BignumPointer(WTFMove(other)); + return *new (this) BignumPointer(WTF::move(other)); } BignumPointer::~BignumPointer() @@ -515,7 +515,7 @@ BignumPointer BignumPointer::NewPrime(const PrimeConfig& params, PrimeCheckCallback cb) { BignumPointer prime(BN_new()); - if (!prime || !prime.generate(params, WTFMove(cb))) { + if (!prime || !prime.generate(params, WTF::move(cb))) { return {}; } return prime; @@ -1039,7 +1039,7 @@ X509Pointer& X509Pointer::operator=(X509Pointer&& other) noexcept { if (this == &other) return *this; this->~X509Pointer(); - return *new (this) X509Pointer(WTFMove(other)); + return *new (this) X509Pointer(WTF::move(other)); } X509Pointer::~X509Pointer() @@ -1276,7 +1276,7 @@ X509View::CheckMatch X509View::checkHost(const std::span host, case 1: { if (peername != nullptr) { DataPointer name(peername, strlen(peername)); - if (peerName != nullptr) *peerName = WTFMove(name); + if (peerName != nullptr) *peerName = WTF::move(name); } return CheckMatch::MATCH; } @@ -1384,11 +1384,11 @@ Result X509Pointer::Parse( X509Pointer pem( PEM_read_bio_X509_AUX(bio.get(), nullptr, NoPasswordCallback, nullptr)); - if (pem) return Result(WTFMove(pem)); + if (pem) return Result(WTF::move(pem)); BIO_reset(bio.get()); X509Pointer der(d2i_X509_bio(bio.get(), nullptr)); - if (der) return Result(WTFMove(der)); + if (der) return Result(WTF::move(der)); return Result(ERR_get_error()); } @@ -1537,7 +1537,7 @@ BIOPointer& BIOPointer::operator=(BIOPointer&& other) noexcept { if (this == &other) return *this; this->~BIOPointer(); - return *new (this) BIOPointer(WTFMove(other)); + return *new (this) BIOPointer(WTF::move(other)); } BIOPointer::~BIOPointer() @@ -1638,7 +1638,7 @@ DHPointer& DHPointer::operator=(DHPointer&& other) noexcept { if (this == &other) return *this; this->~DHPointer(); - return *new (this) DHPointer(WTFMove(other)); + return *new (this) DHPointer(WTF::move(other)); } DHPointer::~DHPointer() @@ -1695,7 +1695,7 @@ DHPointer DHPointer::FromGroup(const WTF::StringView name, auto generator = GetStandardGenerator(); if (!generator) return {}; // Unable to create the generator. - return New(WTFMove(group), WTFMove(generator)); + return New(WTF::move(group), WTF::move(generator)); } DHPointer DHPointer::New(BignumPointer&& p, BignumPointer&& g) @@ -2131,7 +2131,7 @@ EVPKeyPointer::PrivateKeyEncodingConfig::PrivateKeyEncodingConfig( auto& otherPassphrase = other.passphrase.value(); auto newPassphrase = DataPointer::Alloc(otherPassphrase.size()); memcpy(newPassphrase.get(), otherPassphrase.get(), otherPassphrase.size()); - passphrase = WTFMove(newPassphrase); + passphrase = WTF::move(newPassphrase); } } @@ -2209,7 +2209,7 @@ EVPKeyPointer& EVPKeyPointer::operator=(EVPKeyPointer&& other) noexcept { if (this == &other) return *this; this->~EVPKeyPointer(); - return *new (this) EVPKeyPointer(WTFMove(other)); + return *new (this) EVPKeyPointer(WTF::move(other)); } EVPKeyPointer::~EVPKeyPointer() @@ -2361,7 +2361,7 @@ EVPKeyPointer::ParseKeyResult TryParsePublicKeyInner(const BIOPointer& bp, EVPKeyPointer pkey(parse(&p, der_len)); if (!pkey) return EVPKeyPointer::ParseKeyResult(EVPKeyPointer::PKParseError::FAILED); - return EVPKeyPointer::ParseKeyResult(WTFMove(pkey)); + return EVPKeyPointer::ParseKeyResult(WTF::move(pkey)); } constexpr bool IsASN1Sequence(const unsigned char* data, @@ -2523,7 +2523,7 @@ EVPKeyPointer::ParseKeyResult EVPKeyPointer::TryParsePrivateKey( return ParseKeyResult(PKParseError::FAILED, err); } if (!pkey) return ParseKeyResult(PKParseError::FAILED); - return ParseKeyResult(WTFMove(pkey)); + return ParseKeyResult(WTF::move(pkey)); }; auto bio = BIOPointer::New(buffer); @@ -2865,7 +2865,7 @@ SSLPointer& SSLPointer::operator=(SSLPointer&& other) noexcept { if (this == &other) return *this; this->~SSLPointer(); - return *new (this) SSLPointer(WTFMove(other)); + return *new (this) SSLPointer(WTF::move(other)); } SSLPointer::~SSLPointer() @@ -3092,7 +3092,7 @@ SSLCtxPointer& SSLCtxPointer::operator=(SSLCtxPointer&& other) noexcept { if (this == &other) return *this; this->~SSLCtxPointer(); - return *new (this) SSLCtxPointer(WTFMove(other)); + return *new (this) SSLCtxPointer(WTF::move(other)); } SSLCtxPointer::~SSLCtxPointer() @@ -3400,7 +3400,7 @@ CipherCtxPointer& CipherCtxPointer::operator=( { if (this == &other) return *this; this->~CipherCtxPointer(); - return *new (this) CipherCtxPointer(WTFMove(other)); + return *new (this) CipherCtxPointer(WTF::move(other)); } CipherCtxPointer::~CipherCtxPointer() @@ -4470,7 +4470,7 @@ void Cipher::ForEach(Cipher::CipherNameCallback&& callback) { ClearErrorOnReturn clearErrorOnReturn; CipherCallbackContext context; - context.cb = WTFMove(callback); + context.cb = WTF::move(callback); EVP_CIPHER_do_all_sorted( #if OPENSSL_VERSION_MAJOR >= 3 @@ -4885,7 +4885,7 @@ std::pair X509Name::Iterator::operator*() const int value_str_size = ASN1_STRING_to_UTF8(&value_str, value); return { - WTFMove(name_str), + WTF::move(name_str), WTF::String::fromUTF8(std::span(value_str, value_str_size)), }; } diff --git a/src/bun.js/bindings/ncrypto.h b/src/bun.js/bindings/ncrypto.h index 3a5e2307f552f4..358b89d58e0064 100644 --- a/src/bun.js/bindings/ncrypto.h +++ b/src/bun.js/bindings/ncrypto.h @@ -182,13 +182,13 @@ struct Result final { std::optional openssl_error = std::nullopt; Result(T&& value) : has_value(true) - , value(WTFMove(value)) + , value(WTF::move(value)) { } Result(E&& error, std::optional openssl_error = std::nullopt) : has_value(false) - , error(WTFMove(error)) - , openssl_error(WTFMove(openssl_error)) + , error(WTF::move(error)) + , openssl_error(WTF::move(openssl_error)) { } inline operator bool() const { return has_value; } diff --git a/src/bun.js/bindings/node/crypto/CryptoDhJob.cpp b/src/bun.js/bindings/node/crypto/CryptoDhJob.cpp index e0f0ea144afe45..b6f50aa61fc661 100644 --- a/src/bun.js/bindings/node/crypto/CryptoDhJob.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoDhJob.cpp @@ -64,7 +64,7 @@ void DhJobCtx::runFromJS(JSGlobalObject* lexicalGlobalObject, JSValue callback) extern "C" DhJob* Bun__DhJob__create(JSGlobalObject* globalObject, DhJobCtx* ctx, EncodedJSValue callback); DhJob* DhJob::create(JSGlobalObject* globalObject, DhJobCtx&& ctx, JSValue callback) { - DhJobCtx* ctxCopy = new DhJobCtx(WTFMove(ctx)); + DhJobCtx* ctxCopy = new DhJobCtx(WTF::move(ctx)); return Bun__DhJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -77,7 +77,7 @@ void DhJob::schedule() extern "C" void Bun__DhJob__createAndSchedule(JSGlobalObject* globalObject, DhJobCtx* ctx, EncodedJSValue callback); void DhJob::createAndSchedule(JSGlobalObject* globalObject, DhJobCtx&& ctx, JSValue callback) { - DhJobCtx* ctxCopy = new DhJobCtx(WTFMove(ctx)); + DhJobCtx* ctxCopy = new DhJobCtx(WTF::move(ctx)); Bun__DhJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -152,7 +152,7 @@ JSC_DEFINE_HOST_FUNCTION(jsDiffieHellman, (JSGlobalObject * lexicalGlobalObject, RETURN_IF_EXCEPTION(scope, {}); if (!callbackValue.isUndefined()) { - DhJob::createAndSchedule(lexicalGlobalObject, WTFMove(*ctx), callbackValue); + DhJob::createAndSchedule(lexicalGlobalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } diff --git a/src/bun.js/bindings/node/crypto/CryptoDhJob.h b/src/bun.js/bindings/node/crypto/CryptoDhJob.h index cb2f04e83afb91..575597d5e5c2c7 100644 --- a/src/bun.js/bindings/node/crypto/CryptoDhJob.h +++ b/src/bun.js/bindings/node/crypto/CryptoDhJob.h @@ -13,15 +13,15 @@ struct DhJobCtx { public: DhJobCtx(RefPtr&& privateKey, RefPtr&& publicKey) - : m_privateKey(WTFMove(privateKey)) - , m_publicKey(WTFMove(publicKey)) + : m_privateKey(WTF::move(privateKey)) + , m_publicKey(WTF::move(publicKey)) { } DhJobCtx(DhJobCtx&& other) - : m_privateKey(WTFMove(other.m_privateKey)) - , m_publicKey(WTFMove(other.m_publicKey)) - , m_result(WTFMove(other.m_result)) + : m_privateKey(WTF::move(other.m_privateKey)) + , m_publicKey(WTF::move(other.m_publicKey)) + , m_result(WTF::move(other.m_result)) { } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp index b73602daf1274b..58cb7a6192a44f 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp @@ -33,7 +33,7 @@ extern "C" void Bun__DhKeyPairJobCtx__runFromJS(DhKeyPairJobCtx* ctx, JSGlobalOb extern "C" DhKeyPairJob* Bun__DhKeyPairJob__create(JSGlobalObject* globalObject, DhKeyPairJobCtx* ctx, EncodedJSValue callback); DhKeyPairJob* DhKeyPairJob::create(JSGlobalObject* globalObject, DhKeyPairJobCtx&& ctx, JSValue callback) { - DhKeyPairJobCtx* ctxCopy = new DhKeyPairJobCtx(WTFMove(ctx)); + DhKeyPairJobCtx* ctxCopy = new DhKeyPairJobCtx(WTF::move(ctx)); return Bun__DhKeyPairJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -46,7 +46,7 @@ void DhKeyPairJob::schedule() extern "C" void Bun__DhKeyPairJob__createAndSchedule(JSGlobalObject* globalObject, DhKeyPairJobCtx* ctx, EncodedJSValue callback); void DhKeyPairJob::createAndSchedule(JSGlobalObject* globalObject, DhKeyPairJobCtx&& ctx, JSValue callback) { - DhKeyPairJobCtx* ctxCopy = new DhKeyPairJobCtx(WTFMove(ctx)); + DhKeyPairJobCtx* ctxCopy = new DhKeyPairJobCtx(WTF::move(ctx)); Bun__DhKeyPairJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -61,13 +61,13 @@ ncrypto::EVPKeyCtxPointer DhKeyPairJobCtx::setup() m_opensslError = ERR_get_error(); return {}; } - auto dh = ncrypto::DHPointer::New(WTFMove(prime), WTFMove(bnG)); + auto dh = ncrypto::DHPointer::New(WTF::move(prime), WTF::move(bnG)); if (!dh) { m_opensslError = ERR_get_error(); return {}; } - keyParams = ncrypto::EVPKeyPointer::NewDH(WTFMove(dh)); + keyParams = ncrypto::EVPKeyPointer::NewDH(WTF::move(dh)); } else if (std::get_if(&m_prime)) { auto paramCtx = ncrypto::EVPKeyCtxPointer::NewFromID(EVP_PKEY_DH); @@ -139,7 +139,7 @@ std::optional DhKeyPairJobCtx::fromJS(JSGlobalObject* globalObj } return DhKeyPairJobCtx( - WTFMove(group), + WTF::move(group), config); } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h b/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h index 845cb4b90cc894..9ea6fa7cea0fa1 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h +++ b/src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.h @@ -12,7 +12,7 @@ struct DhKeyPairJobCtx : KeyPairJobCtx { public: DhKeyPairJobCtx(ncrypto::DHPointer&& group, const KeyEncodingConfig& config) : KeyPairJobCtx(config.publicKeyEncoding, config.privateKeyEncoding) - , m_prime(WTFMove(group)) + , m_prime(WTF::move(group)) { } @@ -25,7 +25,7 @@ struct DhKeyPairJobCtx : KeyPairJobCtx { DhKeyPairJobCtx(ncrypto::BignumPointer&& prime, const KeyEncodingConfig& config) : KeyPairJobCtx(config.publicKeyEncoding, config.privateKeyEncoding) - , m_prime(WTFMove(prime)) + , m_prime(WTF::move(prime)) { } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp index 2eb41bae026c37..23b38a6f4aec4c 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp @@ -32,7 +32,7 @@ extern "C" void Bun__DsaKeyPairJobCtx__runFromJS(DsaKeyPairJobCtx* ctx, JSGlobal extern "C" DsaKeyPairJob* Bun__DsaKeyPairJob__create(JSGlobalObject* globalObject, DsaKeyPairJobCtx* ctx, EncodedJSValue callback); DsaKeyPairJob* DsaKeyPairJob::create(JSGlobalObject* globalObject, DsaKeyPairJobCtx&& ctx, JSValue callback) { - DsaKeyPairJobCtx* ctxCopy = new DsaKeyPairJobCtx(WTFMove(ctx)); + DsaKeyPairJobCtx* ctxCopy = new DsaKeyPairJobCtx(WTF::move(ctx)); return Bun__DsaKeyPairJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -45,7 +45,7 @@ void DsaKeyPairJob::schedule() extern "C" void Bun__DsaKeyPairJob__createAndSchedule(JSGlobalObject* globalObject, DsaKeyPairJobCtx* ctx, EncodedJSValue callback); void DsaKeyPairJob::createAndSchedule(JSGlobalObject* globalObject, DsaKeyPairJobCtx&& ctx, JSValue callback) { - DsaKeyPairJobCtx* ctxCopy = new DsaKeyPairJobCtx(WTFMove(ctx)); + DsaKeyPairJobCtx* ctxCopy = new DsaKeyPairJobCtx(WTF::move(ctx)); Bun__DsaKeyPairJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp index 854a55457c9508..17614c93ee03ac 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp @@ -33,7 +33,7 @@ extern "C" void Bun__EcKeyPairJobCtx__runFromJS(EcKeyPairJobCtx* ctx, JSGlobalOb extern "C" EcKeyPairJob* Bun__EcKeyPairJob__create(JSGlobalObject* globalObject, EcKeyPairJobCtx* ctx, EncodedJSValue callback); EcKeyPairJob* EcKeyPairJob::create(JSGlobalObject* globalObject, EcKeyPairJobCtx&& ctx, JSValue callback) { - EcKeyPairJobCtx* ctxCopy = new EcKeyPairJobCtx(WTFMove(ctx)); + EcKeyPairJobCtx* ctxCopy = new EcKeyPairJobCtx(WTF::move(ctx)); return Bun__EcKeyPairJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -46,7 +46,7 @@ void EcKeyPairJob::schedule() extern "C" void Bun__EcKeyPairJob__createAndSchedule(JSGlobalObject* globalObject, EcKeyPairJobCtx* ctx, EncodedJSValue callback); void EcKeyPairJob::createAndSchedule(JSGlobalObject* globalObject, EcKeyPairJobCtx&& ctx, JSValue callback) { - EcKeyPairJobCtx* ctxCopy = new EcKeyPairJobCtx(WTFMove(ctx)); + EcKeyPairJobCtx* ctxCopy = new EcKeyPairJobCtx(WTF::move(ctx)); Bun__EcKeyPairJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp index 004168bad74140..a551f1fbba8464 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp @@ -26,7 +26,7 @@ void KeyPairJobCtx::runTask(JSGlobalObject* globalObject, ncrypto::EVPKeyCtxPoin } ncrypto::EVPKeyPointer key = ncrypto::EVPKeyPointer(pkey); - m_keyObj = KeyObject::create(CryptoKeyType::Private, WTFMove(key)); + m_keyObj = KeyObject::create(CryptoKeyType::Private, WTF::move(key)); } void KeyPairJobCtx::runFromJS(JSGlobalObject* lexicalGlobalObject, JSValue callback) @@ -150,21 +150,21 @@ JSC_DEFINE_HOST_FUNCTION(jsGenerateKeyPair, (JSC::JSGlobalObject * globalObject, std::optional ctx = RsaKeyPairJobCtx::fromJS(globalObject, scope, typeView, optionsValue, config); EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - RsaKeyPairJob::createAndSchedule(globalObject, WTFMove(*ctx), callbackValue); + RsaKeyPairJob::createAndSchedule(globalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } if (typeView == "dsa"_s) { std::optional ctx = DsaKeyPairJobCtx::fromJS(globalObject, scope, typeView, optionsValue, config); EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - DsaKeyPairJob::createAndSchedule(globalObject, WTFMove(*ctx), callbackValue); + DsaKeyPairJob::createAndSchedule(globalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } if (typeView == "ec"_s) { std::optional ctx = EcKeyPairJobCtx::fromJS(globalObject, scope, typeView, optionsValue, config); EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - EcKeyPairJob::createAndSchedule(globalObject, WTFMove(*ctx), callbackValue); + EcKeyPairJob::createAndSchedule(globalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } // TODO: should just get `id` here @@ -172,14 +172,14 @@ JSC_DEFINE_HOST_FUNCTION(jsGenerateKeyPair, (JSC::JSGlobalObject * globalObject, std::optional ctx = NidKeyPairJobCtx::fromJS(globalObject, scope, typeView, optionsValue, config); EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - NidKeyPairJob::createAndSchedule(globalObject, WTFMove(*ctx), callbackValue); + NidKeyPairJob::createAndSchedule(globalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } if (typeView == "dh"_s) { std::optional ctx = DhKeyPairJobCtx::fromJS(globalObject, scope, typeView, optionsValue, config); EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - DhKeyPairJob::createAndSchedule(globalObject, WTFMove(*ctx), callbackValue); + DhKeyPairJob::createAndSchedule(globalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp index 6d7a3c4bbd8a84..eb10af213aedcf 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp @@ -33,7 +33,7 @@ extern "C" void Bun__NidKeyPairJobCtx__runFromJS(NidKeyPairJobCtx* ctx, JSGlobal extern "C" NidKeyPairJob* Bun__NidKeyPairJob__create(JSGlobalObject* globalObject, NidKeyPairJobCtx* ctx, EncodedJSValue callback); NidKeyPairJob* NidKeyPairJob::create(JSGlobalObject* globalObject, NidKeyPairJobCtx&& ctx, JSValue callback) { - NidKeyPairJobCtx* ctxCopy = new NidKeyPairJobCtx(WTFMove(ctx)); + NidKeyPairJobCtx* ctxCopy = new NidKeyPairJobCtx(WTF::move(ctx)); return Bun__NidKeyPairJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -46,7 +46,7 @@ void NidKeyPairJob::schedule() extern "C" void Bun__NidKeyPairJob__createAndSchedule(JSGlobalObject* globalObject, NidKeyPairJobCtx* ctx, EncodedJSValue callback); void NidKeyPairJob::createAndSchedule(JSGlobalObject* globalObject, NidKeyPairJobCtx&& ctx, JSValue callback) { - NidKeyPairJobCtx* ctxCopy = new NidKeyPairJobCtx(WTFMove(ctx)); + NidKeyPairJobCtx* ctxCopy = new NidKeyPairJobCtx(WTF::move(ctx)); Bun__NidKeyPairJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } diff --git a/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp b/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp index 49a683ad9bc567..856f11f39314bf 100644 --- a/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp @@ -34,7 +34,7 @@ extern "C" void Bun__RsaKeyPairJobCtx__runFromJS(RsaKeyPairJobCtx* ctx, JSGlobal extern "C" RsaKeyPairJob* Bun__RsaKeyPairJob__create(JSGlobalObject* globalObject, RsaKeyPairJobCtx* ctx, EncodedJSValue callback); RsaKeyPairJob* RsaKeyPairJob::create(JSGlobalObject* globalObject, RsaKeyPairJobCtx&& ctx, JSValue callback) { - RsaKeyPairJobCtx* ctxCopy = new RsaKeyPairJobCtx(WTFMove(ctx)); + RsaKeyPairJobCtx* ctxCopy = new RsaKeyPairJobCtx(WTF::move(ctx)); return Bun__RsaKeyPairJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -47,7 +47,7 @@ void RsaKeyPairJob::schedule() extern "C" void Bun__RsaKeyPairJob__createAndSchedule(JSGlobalObject* globalObject, RsaKeyPairJobCtx* ctx, EncodedJSValue callback); void RsaKeyPairJob::createAndSchedule(JSGlobalObject* globalObject, RsaKeyPairJobCtx&& ctx, JSValue callback) { - RsaKeyPairJobCtx* ctxCopy = new RsaKeyPairJobCtx(WTFMove(ctx)); + RsaKeyPairJobCtx* ctxCopy = new RsaKeyPairJobCtx(WTF::move(ctx)); Bun__RsaKeyPairJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -61,7 +61,7 @@ ncrypto::EVPKeyCtxPointer RsaKeyPairJobCtx::setup() if (m_exponent != ncrypto::EVPKeyCtxPointer::kDefaultRsaExponent) { auto bn = ncrypto::BignumPointer::New(); - if (!bn.setWord(m_exponent) || !ctx.setRsaKeygenPubExp(WTFMove(bn))) { + if (!bn.setWord(m_exponent) || !ctx.setRsaKeygenPubExp(WTF::move(bn))) { m_opensslError = ERR_get_error(); return {}; } diff --git a/src/bun.js/bindings/node/crypto/CryptoHkdf.cpp b/src/bun.js/bindings/node/crypto/CryptoHkdf.cpp index 653e14ff0c3a15..031df5209d0be3 100644 --- a/src/bun.js/bindings/node/crypto/CryptoHkdf.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoHkdf.cpp @@ -17,19 +17,19 @@ namespace Bun { HkdfJobCtx::HkdfJobCtx(Digest digest, size_t length, KeyObject&& key, WTF::Vector&& info, WTF::Vector&& salt) : m_digest(digest) , m_length(length) - , m_key(WTFMove(key)) - , m_info(WTFMove(info)) - , m_salt(WTFMove(salt)) + , m_key(WTF::move(key)) + , m_info(WTF::move(info)) + , m_salt(WTF::move(salt)) { } HkdfJobCtx::HkdfJobCtx(HkdfJobCtx&& other) : m_digest(other.m_digest) , m_length(other.m_length) - , m_key(WTFMove(other.m_key)) - , m_info(WTFMove(other.m_info)) - , m_salt(WTFMove(other.m_salt)) - , m_result(WTFMove(other.m_result)) + , m_key(WTF::move(other.m_key)) + , m_info(WTF::move(other.m_info)) + , m_salt(WTF::move(other.m_salt)) + , m_result(WTF::move(other.m_result)) { } @@ -113,7 +113,7 @@ void HkdfJobCtx::deinit() extern "C" HkdfJob* Bun__HkdfJob__create(JSGlobalObject* globalObject, HkdfJobCtx* ctx, EncodedJSValue callback); HkdfJob* HkdfJob::create(JSGlobalObject* globalObject, HkdfJobCtx&& ctx, JSValue callback) { - HkdfJobCtx* ctxCopy = new HkdfJobCtx(WTFMove(ctx)); + HkdfJobCtx* ctxCopy = new HkdfJobCtx(WTF::move(ctx)); return Bun__HkdfJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -126,7 +126,7 @@ void HkdfJob::schedule() extern "C" void Bun__HkdfJob__createAndSchedule(JSGlobalObject* globalObject, HkdfJobCtx* ctx, EncodedJSValue callback); void HkdfJob::createAndSchedule(JSGlobalObject* globalObject, HkdfJobCtx&& ctx, JSValue callback) { - HkdfJobCtx* ctxCopy = new HkdfJobCtx(WTFMove(ctx)); + HkdfJobCtx* ctxCopy = new HkdfJobCtx(WTF::move(ctx)); return Bun__HkdfJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -151,21 +151,21 @@ KeyObject prepareKey(JSGlobalObject* globalObject, ThrowScope& scope, JSValue ke Vector copy; copy.append(view->span()); - return KeyObject::create(WTFMove(copy)); + return KeyObject::create(WTF::move(copy)); } // Handle ArrayBuffer types if (auto* view = jsDynamicCast(key)) { Vector copy; copy.append(view->span()); - return KeyObject::create(WTFMove(copy)); + return KeyObject::create(WTF::move(copy)); } if (auto* buf = jsDynamicCast(key)) { auto* impl = buf->impl(); Vector copy; copy.append(impl->span()); - return KeyObject::create(WTFMove(copy)); + return KeyObject::create(WTF::move(copy)); } ERR::INVALID_ARG_TYPE(scope, globalObject, "ikm"_s, "string or an instance of SecretKeyObject, ArrayBuffer, TypedArray, DataView, or Buffer"_s, key); @@ -236,7 +236,7 @@ std::optional HkdfJobCtx::fromJS(JSGlobalObject* lexicalGlobalObject return std::nullopt; } - return HkdfJobCtx(hash, length, WTFMove(keyObject), WTFMove(info), WTFMove(salt)); + return HkdfJobCtx(hash, length, WTF::move(keyObject), WTF::move(info), WTF::move(salt)); } JSC_DEFINE_HOST_FUNCTION(jsHkdf, (JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) @@ -251,7 +251,7 @@ JSC_DEFINE_HOST_FUNCTION(jsHkdf, (JSGlobalObject * lexicalGlobalObject, JSC::Cal V::validateFunction(scope, lexicalGlobalObject, callback, "callback"_s); RETURN_IF_EXCEPTION(scope, {}); - HkdfJob::createAndSchedule(lexicalGlobalObject, WTFMove(ctx.value()), callback); + HkdfJob::createAndSchedule(lexicalGlobalObject, WTF::move(ctx.value()), callback); return JSValue::encode(jsUndefined()); } diff --git a/src/bun.js/bindings/node/crypto/CryptoKeygen.cpp b/src/bun.js/bindings/node/crypto/CryptoKeygen.cpp index 6c49a5c6c9760f..d3f73952e173b1 100644 --- a/src/bun.js/bindings/node/crypto/CryptoKeygen.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoKeygen.cpp @@ -32,7 +32,7 @@ void SecretKeyJobCtx::runTask(JSGlobalObject* lexicalGlobalObject) return; } - m_result = WTFMove(key); + m_result = WTF::move(key); } extern "C" void Bun__SecretKeyJobCtx__runFromJS(SecretKeyJobCtx* ctx, JSGlobalObject* lexicalGlobalObject, JSC::JSValue callback) @@ -51,10 +51,10 @@ void SecretKeyJobCtx::runFromJS(JSGlobalObject* lexicalGlobalObject, JSC::JSValu return; } - KeyObject keyObject = KeyObject::create(WTFMove(*m_result)); + KeyObject keyObject = KeyObject::create(WTF::move(*m_result)); Structure* structure = globalObject->m_JSSecretKeyObjectClassStructure.get(lexicalGlobalObject); - JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); Bun__EventLoop__runCallback2(lexicalGlobalObject, JSValue::encode(callback), @@ -88,7 +88,7 @@ void SecretKeyJob::schedule() extern "C" void Bun__SecretKeyJob__createAndSchedule(JSC::JSGlobalObject*, SecretKeyJobCtx*, EncodedJSValue callback); void SecretKeyJob::createAndSchedule(JSC::JSGlobalObject* lexicalGlobalObject, SecretKeyJobCtx&& ctx, JSC::JSValue callback) { - SecretKeyJobCtx* ctxCopy = new SecretKeyJobCtx(WTFMove(ctx)); + SecretKeyJobCtx* ctxCopy = new SecretKeyJobCtx(WTF::move(ctx)); return Bun__SecretKeyJob__createAndSchedule(lexicalGlobalObject, ctxCopy, JSValue::encode(callback)); } @@ -150,7 +150,7 @@ JSC_DEFINE_HOST_FUNCTION(jsGenerateKey, (JSC::JSGlobalObject * lexicalGlobalObje EXCEPTION_ASSERT(ctx.has_value() == !scope.exception()); RETURN_IF_EXCEPTION(scope, {}); - SecretKeyJob::createAndSchedule(lexicalGlobalObject, WTFMove(ctx.value()), callbackValue); + SecretKeyJob::createAndSchedule(lexicalGlobalObject, WTF::move(ctx.value()), callbackValue); return JSValue::encode(jsUndefined()); } @@ -176,9 +176,9 @@ JSC_DEFINE_HOST_FUNCTION(jsGenerateKeySync, (JSC::JSGlobalObject * lexicalGlobal auto& result = ctx->m_result.value(); auto* globalObject = defaultGlobalObject(lexicalGlobalObject); - KeyObject keyObject = KeyObject::create(WTFMove(result)); + KeyObject keyObject = KeyObject::create(WTF::move(result)); Structure* structure = globalObject->m_JSSecretKeyObjectClassStructure.get(lexicalGlobalObject); - JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return JSValue::encode(secretKey); } diff --git a/src/bun.js/bindings/node/crypto/CryptoKeys.cpp b/src/bun.js/bindings/node/crypto/CryptoKeys.cpp index 799954e7c71e0b..1ef0cfe0a44c8b 100644 --- a/src/bun.js/bindings/node/crypto/CryptoKeys.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoKeys.cpp @@ -23,7 +23,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCreateSecretKey, (JSC::JSGlobalObject * lexicalGlobal RETURN_IF_EXCEPTION(scope, {}); Structure* structure = globalObject->m_JSSecretKeyObjectClassStructure.get(lexicalGlobalObject); - JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSSecretKeyObject* secretKey = JSSecretKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return JSValue::encode(secretKey); } @@ -43,7 +43,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCreatePublicKey, (JSC::JSGlobalObject * lexicalGlobal if (prepareResult.keyData) { RefPtr keyData = *prepareResult.keyData; - keyObject = KeyObject::create(CryptoKeyType::Public, WTFMove(keyData)); + keyObject = KeyObject::create(CryptoKeyType::Public, WTF::move(keyData)); } else { keyObject = KeyObject::getPublicOrPrivateKey( globalObject, @@ -53,12 +53,12 @@ JSC_DEFINE_HOST_FUNCTION(jsCreatePublicKey, (JSC::JSGlobalObject * lexicalGlobal prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } Structure* structure = globalObject->m_JSPublicKeyObjectClassStructure.get(lexicalGlobalObject); - JSPublicKeyObject* publicKey = JSPublicKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSPublicKeyObject* publicKey = JSPublicKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return JSValue::encode(publicKey); } @@ -78,7 +78,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCreatePrivateKey, (JSGlobalObject * lexicalGlobalObje if (prepareResult.keyData) { auto keyData = *prepareResult.keyData; - keyObject = KeyObject::create(CryptoKeyType::Private, WTFMove(keyData)); + keyObject = KeyObject::create(CryptoKeyType::Private, WTF::move(keyData)); } else { keyObject = KeyObject::getPublicOrPrivateKey( globalObject, @@ -88,12 +88,12 @@ JSC_DEFINE_HOST_FUNCTION(jsCreatePrivateKey, (JSGlobalObject * lexicalGlobalObje prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } Structure* structure = globalObject->m_JSPrivateKeyObjectClassStructure.get(lexicalGlobalObject); - JSPrivateKeyObject* privateKey = JSPrivateKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSPrivateKeyObject* privateKey = JSPrivateKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return JSValue::encode(privateKey); } diff --git a/src/bun.js/bindings/node/crypto/CryptoPrimes.cpp b/src/bun.js/bindings/node/crypto/CryptoPrimes.cpp index 39f6ac8a67ff2a..a900b56f1ec43c 100644 --- a/src/bun.js/bindings/node/crypto/CryptoPrimes.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoPrimes.cpp @@ -10,7 +10,7 @@ using namespace ncrypto; using namespace JSC; CheckPrimeJobCtx::CheckPrimeJobCtx(ncrypto::BignumPointer candidate, int32_t checks) - : m_candidate(WTFMove(candidate)) + : m_candidate(WTF::move(candidate)) , m_checks(checks) { } @@ -54,7 +54,7 @@ void CheckPrimeJobCtx::deinit() extern "C" CheckPrimeJob* Bun__CheckPrimeJob__create(JSGlobalObject*, CheckPrimeJobCtx*, EncodedJSValue callback); CheckPrimeJob* CheckPrimeJob::create(JSGlobalObject* globalObject, ncrypto::BignumPointer candidate, int32_t checks, JSValue callback) { - CheckPrimeJobCtx* ctx = new CheckPrimeJobCtx(WTFMove(candidate), checks); + CheckPrimeJobCtx* ctx = new CheckPrimeJobCtx(WTF::move(candidate), checks); return Bun__CheckPrimeJob__create(globalObject, ctx, JSValue::encode(callback)); } @@ -67,7 +67,7 @@ void CheckPrimeJob::schedule() extern "C" void Bun__CheckPrimeJob__createAndSchedule(JSGlobalObject*, CheckPrimeJobCtx*, EncodedJSValue callback); void CheckPrimeJob::createAndSchedule(JSGlobalObject* globalObject, ncrypto::BignumPointer candidate, int32_t checks, JSValue callback) { - CheckPrimeJobCtx* ctx = new CheckPrimeJobCtx(WTFMove(candidate), checks); + CheckPrimeJobCtx* ctx = new CheckPrimeJobCtx(WTF::move(candidate), checks); return Bun__CheckPrimeJob__createAndSchedule(globalObject, ctx, JSValue::encode(callback)); } @@ -165,7 +165,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCheckPrime, (JSC::JSGlobalObject * lexicalGlobalObjec return {}; } - CheckPrimeJob::createAndSchedule(lexicalGlobalObject, WTFMove(candidate), checks, callback); + CheckPrimeJob::createAndSchedule(lexicalGlobalObject, WTF::move(candidate), checks, callback); return JSValue::encode(jsUndefined()); } @@ -174,9 +174,9 @@ GeneratePrimeJobCtx::GeneratePrimeJobCtx(int32_t size, bool safe, ncrypto::Bignu : m_size(size) , m_safe(safe) , m_bigint(bigint) - , m_add(WTFMove(add)) - , m_rem(WTFMove(rem)) - , m_prime(WTFMove(prime)) + , m_add(WTF::move(add)) + , m_rem(WTF::move(rem)) + , m_prime(WTF::move(prime)) { } @@ -239,7 +239,7 @@ void GeneratePrimeJobCtx::deinit() extern "C" GeneratePrimeJob* Bun__GeneratePrimeJob__create(JSGlobalObject*, GeneratePrimeJobCtx*, EncodedJSValue callback); GeneratePrimeJob* GeneratePrimeJob::create(JSGlobalObject* globalObject, int32_t size, bool safe, ncrypto::BignumPointer prime, ncrypto::BignumPointer add, ncrypto::BignumPointer rem, bool bigint, JSValue callback) { - GeneratePrimeJobCtx* ctx = new GeneratePrimeJobCtx(size, safe, WTFMove(prime), WTFMove(add), WTFMove(rem), bigint); + GeneratePrimeJobCtx* ctx = new GeneratePrimeJobCtx(size, safe, WTF::move(prime), WTF::move(add), WTF::move(rem), bigint); return Bun__GeneratePrimeJob__create(globalObject, ctx, JSValue::encode(callback)); } @@ -252,7 +252,7 @@ void GeneratePrimeJob::schedule() extern "C" void Bun__GeneratePrimeJob__createAndSchedule(JSGlobalObject*, GeneratePrimeJobCtx*, EncodedJSValue callback); void GeneratePrimeJob::createAndSchedule(JSGlobalObject* globalObject, int32_t size, bool safe, ncrypto::BignumPointer prime, ncrypto::BignumPointer add, ncrypto::BignumPointer rem, bool bigint, JSValue callback) { - GeneratePrimeJobCtx* ctx = new GeneratePrimeJobCtx(size, safe, WTFMove(prime), WTFMove(add), WTFMove(rem), bigint); + GeneratePrimeJobCtx* ctx = new GeneratePrimeJobCtx(size, safe, WTF::move(prime), WTF::move(add), WTF::move(rem), bigint); Bun__GeneratePrimeJob__createAndSchedule(globalObject, ctx, JSValue::encode(callback)); } @@ -286,7 +286,7 @@ JSValue GeneratePrimeJob::result(JSGlobalObject* globalObject, JSC::ThrowScope& BignumPointer::EncodePaddedInto(prime.get(), reinterpret_cast(buf->data()), buf->byteLength()); - return JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTFMove(buf)); + return JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTF::move(buf)); } JSC_DEFINE_HOST_FUNCTION(jsGeneratePrime, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) @@ -393,7 +393,7 @@ JSC_DEFINE_HOST_FUNCTION(jsGeneratePrime, (JSC::JSGlobalObject * lexicalGlobalOb return ERR::CRYPTO_OPERATION_FAILED(scope, lexicalGlobalObject, "could not generate prime"_s); } - GeneratePrimeJob::createAndSchedule(lexicalGlobalObject, size, safe, WTFMove(prime), WTFMove(add), WTFMove(rem), bigint, callback); + GeneratePrimeJob::createAndSchedule(lexicalGlobalObject, size, safe, WTF::move(prime), WTF::move(add), WTF::move(rem), bigint, callback); return JSValue::encode(jsUndefined()); } diff --git a/src/bun.js/bindings/node/crypto/CryptoSignJob.cpp b/src/bun.js/bindings/node/crypto/CryptoSignJob.cpp index 77899d2e9288c9..1b9d80177a86e0 100644 --- a/src/bun.js/bindings/node/crypto/CryptoSignJob.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoSignJob.cpp @@ -25,7 +25,7 @@ JSC_DEFINE_HOST_FUNCTION(jsVerifyOneShot, (JSGlobalObject * lexicalGlobalObject, RETURN_IF_EXCEPTION(scope, {}); if (!callbackValue.isUndefined()) { - SignJob::createAndSchedule(lexicalGlobalObject, WTFMove(*ctx), callbackValue); + SignJob::createAndSchedule(lexicalGlobalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } @@ -53,7 +53,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSignOneShot, (JSGlobalObject * lexicalGlobalObject, C RETURN_IF_EXCEPTION(scope, {}); if (!callbackValue.isUndefined()) { - SignJob::createAndSchedule(lexicalGlobalObject, WTFMove(*ctx), callbackValue); + SignJob::createAndSchedule(lexicalGlobalObject, WTF::move(*ctx), callbackValue); return JSValue::encode(jsUndefined()); } @@ -69,7 +69,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSignOneShot, (JSGlobalObject * lexicalGlobalObject, C auto sigBuf = ArrayBuffer::createUninitialized(result.size(), 1); memcpy(sigBuf->data(), result.data(), result.size()); - auto* signature = JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(sigBuf), 0, result.size()); + auto* signature = JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(sigBuf), 0, result.size()); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(signature); } @@ -182,7 +182,7 @@ void SignJobCtx::runTask(JSGlobalObject* globalObject) m_signResult = ByteSource::allocated(p1363Buffer.release()); } else { - m_signResult = WTFMove(bs); + m_signResult = WTF::move(bs); } } break; @@ -226,7 +226,7 @@ void SignJobCtx::runFromJS(JSGlobalObject* lexicalGlobalObject, JSValue callback auto sigBuf = ArrayBuffer::createUninitialized(m_signResult->size(), 1); memcpy(sigBuf->data(), m_signResult->data(), m_signResult->size()); - auto* signature = JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(sigBuf), 0, m_signResult->size()); + auto* signature = JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(sigBuf), 0, m_signResult->size()); RETURN_IF_EXCEPTION(scope, ); Bun__EventLoop__runCallback2( @@ -259,7 +259,7 @@ void SignJobCtx::runFromJS(JSGlobalObject* lexicalGlobalObject, JSValue callback extern "C" SignJob* Bun__SignJob__create(JSGlobalObject* globalObject, SignJobCtx* ctx, EncodedJSValue callback); SignJob* SignJob::create(JSGlobalObject* globalObject, SignJobCtx&& ctx, JSValue callback) { - SignJobCtx* ctxCopy = new SignJobCtx(WTFMove(ctx)); + SignJobCtx* ctxCopy = new SignJobCtx(WTF::move(ctx)); return Bun__SignJob__create(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -272,7 +272,7 @@ void SignJob::schedule() extern "C" void Bun__SignJob__createAndSchedule(JSGlobalObject* globalObject, SignJobCtx* ctx, EncodedJSValue callback); void SignJob::createAndSchedule(JSGlobalObject* globalObject, SignJobCtx&& ctx, JSValue callback) { - SignJobCtx* ctxCopy = new SignJobCtx(WTFMove(ctx)); + SignJobCtx* ctxCopy = new SignJobCtx(WTF::move(ctx)); Bun__SignJob__createAndSchedule(globalObject, ctxCopy, JSValue::encode(callback)); } @@ -333,7 +333,7 @@ std::optional SignJobCtx::fromJS(JSGlobalObject* globalObject, Throw KeyObject keyObject; if (prepareResult.keyData) { - keyObject = KeyObject::create(keyType, WTFMove(*prepareResult.keyData)); + keyObject = KeyObject::create(keyType, WTF::move(*prepareResult.keyData)); } else { keyObject = KeyObject::getPublicOrPrivateKey( @@ -344,7 +344,7 @@ std::optional SignJobCtx::fromJS(JSGlobalObject* globalObject, Throw prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } @@ -424,18 +424,18 @@ std::optional SignJobCtx::fromJS(JSGlobalObject* globalObject, Throw return SignJobCtx( mode, keyObject.data(), - WTFMove(data), + WTF::move(data), digest, padding, pssSaltLength, dsaSigEnc, - WTFMove(signature)); + WTF::move(signature)); } return SignJobCtx( mode, keyObject.data(), - WTFMove(data), + WTF::move(data), digest, padding, pssSaltLength, diff --git a/src/bun.js/bindings/node/crypto/CryptoSignJob.h b/src/bun.js/bindings/node/crypto/CryptoSignJob.h index ac029b09cbed1a..f3bf6a53130d63 100644 --- a/src/bun.js/bindings/node/crypto/CryptoSignJob.h +++ b/src/bun.js/bindings/node/crypto/CryptoSignJob.h @@ -22,8 +22,8 @@ struct SignJobCtx { SignJobCtx(Mode mode, RefPtr keyData, Vector&& data, ncrypto::Digest digest, std::optional padding, std::optional saltLength, DSASigEnc dsaSigEnc, Vector&& signature = {}) : m_mode(mode) , m_keyData(keyData) - , m_data(WTFMove(data)) - , m_signature(WTFMove(signature)) + , m_data(WTF::move(data)) + , m_signature(WTF::move(signature)) , m_digest(digest) , m_padding(padding) , m_saltLength(saltLength) @@ -34,9 +34,9 @@ struct SignJobCtx { SignJobCtx(SignJobCtx&& other) : m_mode(other.m_mode) - , m_keyData(WTFMove(other.m_keyData)) - , m_data(WTFMove(other.m_data)) - , m_signature(WTFMove(other.m_signature)) + , m_keyData(WTF::move(other.m_keyData)) + , m_data(WTF::move(other.m_data)) + , m_signature(WTF::move(other.m_signature)) , m_digest(other.m_digest) , m_padding(other.m_padding) , m_saltLength(other.m_saltLength) diff --git a/src/bun.js/bindings/node/crypto/CryptoUtil.cpp b/src/bun.js/bindings/node/crypto/CryptoUtil.cpp index 2c8d73c0ee2344..29b2b9c5385534 100644 --- a/src/bun.js/bindings/node/crypto/CryptoUtil.cpp +++ b/src/bun.js/bindings/node/crypto/CryptoUtil.cpp @@ -82,7 +82,7 @@ EncodedJSValue encode(JSGlobalObject* lexicalGlobalObject, ThrowScope& scope, st memcpy(buffer->data(), bytes.data(), bytes.size()); - return JSValue::encode(JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, bytes.size())); + return JSValue::encode(JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(buffer), 0, bytes.size())); } default: { return jsBufferToStringFromBytes(lexicalGlobalObject, scope, bytes, encoding); @@ -157,7 +157,7 @@ std::optional keyFromString(JSGlobalObject* lexicalGloba }; auto res = ncrypto::EVPKeyPointer::TryParsePrivateKey(config, ncryptoBuf); if (res) { - ncrypto::EVPKeyPointer keyPtr(WTFMove(res.value)); + ncrypto::EVPKeyPointer keyPtr(WTF::move(res.value)); return keyPtr; } @@ -255,7 +255,7 @@ std::optional passphraseFromBufferSource(JSC::JSGlobalObje auto span = utf8.span(); if (auto ptr = ncrypto::DataPointer::Alloc(span.size())) { memcpy(ptr.get(), span.data(), span.size()); - return WTFMove(ptr); + return WTF::move(ptr); } throwOutOfMemoryError(globalObject, scope); @@ -271,7 +271,7 @@ std::optional passphraseFromBufferSource(JSC::JSGlobalObje auto length = array->byteLength(); if (auto ptr = ncrypto::DataPointer::Alloc(length)) { memcpy(ptr.get(), array->vector(), length); - return WTFMove(ptr); + return WTF::move(ptr); } throwOutOfMemoryError(globalObject, scope); @@ -481,7 +481,7 @@ bool convertP1363ToDER(const ncrypto::Buffer& p1363Sig, return false; } - if (!asn1_sig.setParams(WTFMove(r), WTFMove(s))) { + if (!asn1_sig.setParams(WTF::move(r), WTF::move(s))) { return false; } diff --git a/src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h b/src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h index feb50dae6d4afe..778b8592b70d33 100644 --- a/src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h +++ b/src/bun.js/bindings/node/crypto/DiffieHellmanFunctions.h @@ -251,7 +251,7 @@ JSC::EncodedJSValue jsDiffieHellmanProtoFuncSetPublicKeyTemplate(JSC::JSGlobalOb auto& dh = thisObject->getImpl(); - if (!dh.setPublicKey(WTFMove(key))) { + if (!dh.setPublicKey(WTF::move(key))) { throwError(globalObject, scope, ErrorCode::ERR_CRYPTO_OPERATION_FAILED, "Failed to set public key"_s); return {}; } @@ -286,7 +286,7 @@ JSC::EncodedJSValue jsDiffieHellmanProtoFuncSetPrivateKeyTemplate(JSC::JSGlobalO auto& dh = thisObject->getImpl(); - if (!dh.setPrivateKey(WTFMove(key))) { + if (!dh.setPrivateKey(WTF::move(key))) { throwError(globalObject, scope, ErrorCode::ERR_CRYPTO_OPERATION_FAILED, "Failed to set private key"_s); return {}; } diff --git a/src/bun.js/bindings/node/crypto/JSCipher.cpp b/src/bun.js/bindings/node/crypto/JSCipher.cpp index d593ace4b27cc7..4b1b9a4c575a1d 100644 --- a/src/bun.js/bindings/node/crypto/JSCipher.cpp +++ b/src/bun.js/bindings/node/crypto/JSCipher.cpp @@ -76,7 +76,7 @@ JSValue rsaFunction(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* ca RETURN_IF_EXCEPTION(scope, {}); if (prepareResult.keyData) { RefPtr data = *prepareResult.keyData; - keyObject = KeyObject::create(CryptoKeyType::Public, WTFMove(data)); + keyObject = KeyObject::create(CryptoKeyType::Public, WTF::move(data)); } else { keyObject = KeyObject::getPublicOrPrivateKey( globalObject, @@ -86,7 +86,7 @@ JSValue rsaFunction(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* ca prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } break; @@ -97,7 +97,7 @@ JSValue rsaFunction(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* ca RETURN_IF_EXCEPTION(scope, {}); if (prepareResult.keyData) { RefPtr data = *prepareResult.keyData; - keyObject = KeyObject::create(CryptoKeyType::Private, WTFMove(data)); + keyObject = KeyObject::create(CryptoKeyType::Private, WTF::move(data)); } else { keyObject = KeyObject::getPublicOrPrivateKey( globalObject, @@ -107,7 +107,7 @@ JSValue rsaFunction(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* ca prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } break; @@ -215,7 +215,7 @@ JSValue rsaFunction(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* ca return {}; } - RELEASE_AND_RETURN(scope, JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(outBuf), 0, result.size())); + RELEASE_AND_RETURN(scope, JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(outBuf), 0, result.size())); } JSC_DEFINE_HOST_FUNCTION(jsPublicEncrypt, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) diff --git a/src/bun.js/bindings/node/crypto/JSCipher.h b/src/bun.js/bindings/node/crypto/JSCipher.h index 7c0a4dd625c0b8..75d105ae28d9a5 100644 --- a/src/bun.js/bindings/node/crypto/JSCipher.h +++ b/src/bun.js/bindings/node/crypto/JSCipher.h @@ -43,7 +43,7 @@ class JSCipher final : public JSC::JSDestructibleObject { static JSCipher* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, CipherKind kind, ncrypto::CipherCtxPointer&& ctx, std::optional authTagLen, int32_t maxMessageSize) { - JSCipher* instance = new (NotNull, JSC::allocateCell(vm)) JSCipher(vm, structure, kind, WTFMove(ctx), authTagLen, maxMessageSize); + JSCipher* instance = new (NotNull, JSC::allocateCell(vm)) JSCipher(vm, structure, kind, WTF::move(ctx), authTagLen, maxMessageSize); instance->finishCreation(vm, globalObject); return instance; } @@ -109,7 +109,7 @@ class JSCipher final : public JSC::JSDestructibleObject { , m_authTagLen(authTagLen) , m_pendingAuthFailed(false) , m_maxMessageSize(maxMessageSize) - , m_ctx(WTFMove(ctx)) + , m_ctx(WTF::move(ctx)) { } diff --git a/src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp b/src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp index 063e95407de3e4..6261433f5fb0d9 100644 --- a/src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp +++ b/src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp @@ -219,7 +219,7 @@ JSC_DEFINE_HOST_FUNCTION(constructCipher, (JSC::JSGlobalObject * globalObject, J auto* zigGlobalObject = defaultGlobalObject(globalObject); JSC::Structure* structure = zigGlobalObject->m_JSCipherClassStructure.get(zigGlobalObject); - return JSC::JSValue::encode(JSCipher::create(vm, structure, globalObject, cipherKind, WTFMove(ctx), authTagLength, maxMessageSize)); + return JSC::JSValue::encode(JSCipher::create(vm, structure, globalObject, cipherKind, WTF::move(ctx), authTagLength, maxMessageSize)); } } // namespace Bun diff --git a/src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp b/src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp index bc9f5276ca1c25..76b6103931d11c 100644 --- a/src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp +++ b/src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp @@ -116,7 +116,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCipherUpdate, (JSC::JSGlobalObject * lexicalGlobalObj if (!res && cipher->m_kind == CipherKind::Decipher && cipher->m_ctx.isCcmMode()) { cipher->m_pendingAuthFailed = true; - RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(outBuf), 0, bufLen))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(outBuf), 0, bufLen))); } if (res != 1) { @@ -124,7 +124,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCipherUpdate, (JSC::JSGlobalObject * lexicalGlobalObj return {}; } - RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(outBuf), 0, bufLen))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(outBuf), 0, bufLen))); } JSC_DEFINE_HOST_FUNCTION(jsCipherFinal, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) @@ -192,7 +192,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCipherFinal, (JSC::JSGlobalObject * lexicalGlobalObje return {}; } - RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(outBuf), 0, outLen))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(outBuf), 0, outLen))); } JSC_DEFINE_HOST_FUNCTION(jsCipherSetAutoPadding, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellman.h b/src/bun.js/bindings/node/crypto/JSDiffieHellman.h index 3645d59084fe55..5e21d846933cfa 100644 --- a/src/bun.js/bindings/node/crypto/JSDiffieHellman.h +++ b/src/bun.js/bindings/node/crypto/JSDiffieHellman.h @@ -24,7 +24,7 @@ class JSDiffieHellman final : public JSC::JSDestructibleObject { static JSDiffieHellman* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, ncrypto::DHPointer&& dh) { - JSDiffieHellman* instance = new (NotNull, JSC::allocateCell(vm)) JSDiffieHellman(vm, structure, WTFMove(dh)); + JSDiffieHellman* instance = new (NotNull, JSC::allocateCell(vm)) JSDiffieHellman(vm, structure, WTF::move(dh)); instance->finishCreation(vm, globalObject); return instance; } @@ -48,7 +48,7 @@ class JSDiffieHellman final : public JSC::JSDestructibleObject { private: JSDiffieHellman(JSC::VM& vm, JSC::Structure* structure, ncrypto::DHPointer&& dh) : Base(vm, structure) - , m_dh(WTFMove(dh)) + , m_dh(WTF::move(dh)) { } diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp b/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp index 2dba02a4379140..8c281c45ce902a 100644 --- a/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp +++ b/src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp @@ -160,7 +160,7 @@ JSC_DEFINE_HOST_FUNCTION(constructDiffieHellman, (JSC::JSGlobalObject * globalOb } } - dh = ncrypto::DHPointer::New(WTFMove(bn_p), WTFMove(bn_g)); + dh = ncrypto::DHPointer::New(WTF::move(bn_p), WTF::move(bn_g)); if (!dh) { return JSValue::encode(createError(globalObject, ErrorCode::ERR_INVALID_ARG_VALUE, "Invalid DH parameters"_s)); } @@ -170,7 +170,7 @@ JSC_DEFINE_HOST_FUNCTION(constructDiffieHellman, (JSC::JSGlobalObject * globalOb auto* zigGlobalObject = defaultGlobalObject(globalObject); JSC::Structure* structure = zigGlobalObject->m_JSDiffieHellmanClassStructure.get(zigGlobalObject); - return JSC::JSValue::encode(JSDiffieHellman::create(vm, structure, globalObject, WTFMove(dh))); + return JSC::JSValue::encode(JSDiffieHellman::create(vm, structure, globalObject, WTF::move(dh))); } } // namespace Bun diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h b/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h index cb3d544fd6fe34..57679296027bf8 100644 --- a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h +++ b/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.h @@ -23,7 +23,7 @@ class JSDiffieHellmanGroup final : public JSC::JSDestructibleObject { static JSDiffieHellmanGroup* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, ncrypto::DHPointer&& dh) { - JSDiffieHellmanGroup* instance = new (NotNull, JSC::allocateCell(vm)) JSDiffieHellmanGroup(vm, structure, WTFMove(dh)); + JSDiffieHellmanGroup* instance = new (NotNull, JSC::allocateCell(vm)) JSDiffieHellmanGroup(vm, structure, WTF::move(dh)); instance->finishCreation(vm, globalObject); return instance; } @@ -49,7 +49,7 @@ class JSDiffieHellmanGroup final : public JSC::JSDestructibleObject { private: JSDiffieHellmanGroup(JSC::VM& vm, JSC::Structure* structure, ncrypto::DHPointer&& dh) : Base(vm, structure) - , m_dh(WTFMove(dh)) + , m_dh(WTF::move(dh)) { } diff --git a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp b/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp index 408dbc82a4b4e9..bbdc90ac9205dd 100644 --- a/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp +++ b/src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp @@ -61,7 +61,7 @@ JSC_DEFINE_HOST_FUNCTION(constructDiffieHellmanGroup, (JSC::JSGlobalObject * glo RETURN_IF_EXCEPTION(scope, {}); } - return JSC::JSValue::encode(JSDiffieHellmanGroup::create(vm, structure, globalObject, WTFMove(dh))); + return JSC::JSValue::encode(JSDiffieHellmanGroup::create(vm, structure, globalObject, WTF::move(dh))); } } // namespace Bun diff --git a/src/bun.js/bindings/node/crypto/JSECDH.h b/src/bun.js/bindings/node/crypto/JSECDH.h index ea0907e37eff5a..9b1594117bea94 100644 --- a/src/bun.js/bindings/node/crypto/JSECDH.h +++ b/src/bun.js/bindings/node/crypto/JSECDH.h @@ -25,7 +25,7 @@ class JSECDH final : public JSC::JSDestructibleObject { static JSECDH* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, ncrypto::ECKeyPointer&& key, const EC_GROUP* group) { - JSECDH* instance = new (NotNull, JSC::allocateCell(vm)) JSECDH(vm, structure, WTFMove(key), group); + JSECDH* instance = new (NotNull, JSC::allocateCell(vm)) JSECDH(vm, structure, WTF::move(key), group); instance->finishCreation(vm, globalObject); return instance; } @@ -53,7 +53,7 @@ class JSECDH final : public JSC::JSDestructibleObject { private: JSECDH(JSC::VM& vm, JSC::Structure* structure, ncrypto::ECKeyPointer&& key, const EC_GROUP* group) : Base(vm, structure) - , m_key(WTFMove(key)) + , m_key(WTF::move(key)) , m_group(group) { ASSERT(m_group); diff --git a/src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp b/src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp index 2e0d80edcc8ae2..f65e45710dee50 100644 --- a/src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp +++ b/src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp @@ -72,7 +72,7 @@ JSC_DEFINE_HOST_FUNCTION(constructECDH, (JSC::JSGlobalObject * globalObject, JSC JSC::Structure* structure = zigGlobalObject->m_JSECDHClassStructure.get(zigGlobalObject); const EC_GROUP* group = key.getGroup(); - return JSC::JSValue::encode(JSECDH::create(vm, structure, globalObject, WTFMove(key), group)); + return JSC::JSValue::encode(JSECDH::create(vm, structure, globalObject, WTF::move(key), group)); } JSC_DEFINE_HOST_FUNCTION(jsECDHConvertKey, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) diff --git a/src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp b/src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp index 4441e85219d663..0205462001eb74 100644 --- a/src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp +++ b/src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp @@ -346,7 +346,7 @@ JSC_DEFINE_HOST_FUNCTION(jsECDHProtoFuncSetPrivateKey, (JSC::JSGlobalObject * gl } // Replace the old key with the new one - ecdh->m_key = WTFMove(newKey); + ecdh->m_key = WTF::move(newKey); ecdh->m_group = ecdh->m_key.getGroup(); // Return this for chaining diff --git a/src/bun.js/bindings/node/crypto/JSKeyObject.h b/src/bun.js/bindings/node/crypto/JSKeyObject.h index 49af4225ee9771..5d7af7ae3bc64c 100644 --- a/src/bun.js/bindings/node/crypto/JSKeyObject.h +++ b/src/bun.js/bindings/node/crypto/JSKeyObject.h @@ -26,7 +26,7 @@ class JSKeyObject : public JSC::JSDestructibleObject { static JSKeyObject* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, KeyObject&& keyObject) { - JSKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSKeyObject(vm, structure, WTFMove(keyObject)); + JSKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSKeyObject(vm, structure, WTF::move(keyObject)); instance->finishCreation(vm, globalObject); return instance; } @@ -46,7 +46,7 @@ class JSKeyObject : public JSC::JSDestructibleObject { JSKeyObject(JSC::VM& vm, JSC::Structure* structure, KeyObject&& keyObject) : Base(vm, structure) - , m_handle(WTFMove(keyObject)) + , m_handle(WTF::move(keyObject)) { } diff --git a/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h b/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h index 1b97bf3ddfc076..3573f76f1c7045 100644 --- a/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h +++ b/src/bun.js/bindings/node/crypto/JSPrivateKeyObject.h @@ -24,7 +24,7 @@ class JSPrivateKeyObject final : public JSKeyObject { static JSPrivateKeyObject* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, KeyObject&& keyObject) { - JSPrivateKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSPrivateKeyObject(vm, structure, WTFMove(keyObject)); + JSPrivateKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSPrivateKeyObject(vm, structure, WTF::move(keyObject)); instance->finishCreation(vm, globalObject); return instance; } @@ -50,7 +50,7 @@ class JSPrivateKeyObject final : public JSKeyObject { void finishCreation(JSC::VM&, JSC::JSGlobalObject*); JSPrivateKeyObject(JSC::VM& vm, JSC::Structure* structure, KeyObject&& keyObject) - : Base(vm, structure, WTFMove(keyObject)) + : Base(vm, structure, WTF::move(keyObject)) { } }; diff --git a/src/bun.js/bindings/node/crypto/JSPublicKeyObject.h b/src/bun.js/bindings/node/crypto/JSPublicKeyObject.h index 4354f6a57cfe7e..0dd04f20c9c66d 100644 --- a/src/bun.js/bindings/node/crypto/JSPublicKeyObject.h +++ b/src/bun.js/bindings/node/crypto/JSPublicKeyObject.h @@ -25,7 +25,7 @@ class JSPublicKeyObject final : public JSKeyObject { static JSPublicKeyObject* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, KeyObject&& keyObject) { - JSPublicKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSPublicKeyObject(vm, structure, WTFMove(keyObject)); + JSPublicKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSPublicKeyObject(vm, structure, WTF::move(keyObject)); instance->finishCreation(vm, globalObject); return instance; } @@ -51,7 +51,7 @@ class JSPublicKeyObject final : public JSKeyObject { void finishCreation(JSC::VM&, JSC::JSGlobalObject*); JSPublicKeyObject(JSC::VM& vm, JSC::Structure* structure, KeyObject&& keyObject) - : Base(vm, structure, WTFMove(keyObject)) + : Base(vm, structure, WTF::move(keyObject)) { } }; diff --git a/src/bun.js/bindings/node/crypto/JSSecretKeyObject.h b/src/bun.js/bindings/node/crypto/JSSecretKeyObject.h index e0a2d95664d145..72a18a8acb8026 100644 --- a/src/bun.js/bindings/node/crypto/JSSecretKeyObject.h +++ b/src/bun.js/bindings/node/crypto/JSSecretKeyObject.h @@ -24,7 +24,7 @@ class JSSecretKeyObject final : public JSKeyObject { static JSSecretKeyObject* create(JSC::VM& vm, JSC::Structure* structure, JSC::JSGlobalObject* globalObject, KeyObject&& keyObject) { - JSSecretKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSSecretKeyObject(vm, structure, WTFMove(keyObject)); + JSSecretKeyObject* instance = new (NotNull, JSC::allocateCell(vm)) JSSecretKeyObject(vm, structure, WTF::move(keyObject)); instance->finishCreation(vm, globalObject); return instance; } @@ -48,7 +48,7 @@ class JSSecretKeyObject final : public JSKeyObject { void finishCreation(JSC::VM&, JSC::JSGlobalObject*); JSSecretKeyObject(JSC::VM& vm, JSC::Structure* structure, KeyObject&& keyObject) - : Base(vm, structure, WTFMove(keyObject)) + : Base(vm, structure, WTF::move(keyObject)) { } }; diff --git a/src/bun.js/bindings/node/crypto/JSSign.cpp b/src/bun.js/bindings/node/crypto/JSSign.cpp index 7bb627dc5d06aa..e5878a0baaf261 100644 --- a/src/bun.js/bindings/node/crypto/JSSign.cpp +++ b/src/bun.js/bindings/node/crypto/JSSign.cpp @@ -194,7 +194,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSignProtoFuncInit, (JSC::JSGlobalObject * globalObjec } // Store the initialized context in the JSSign object - thisObject->m_mdCtx = WTFMove(mdCtx); + thisObject->m_mdCtx = WTF::move(mdCtx); return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -303,7 +303,7 @@ JSUint8Array* signWithKey(JSC::JSGlobalObject* lexicalGlobalObject, JSSign* this } // Move mdCtx out of JSSign object - ncrypto::EVPMDCtxPointer mdCtx = WTFMove(thisObject->m_mdCtx); + ncrypto::EVPMDCtxPointer mdCtx = WTF::move(thisObject->m_mdCtx); // Validate DSA parameters if (!pkey.validateDsaParameters()) { @@ -394,7 +394,7 @@ JSUint8Array* signWithKey(JSC::JSGlobalObject* lexicalGlobalObject, JSSign* this // Create and return JSUint8Array auto* globalObject = defaultGlobalObject(lexicalGlobalObject); - RELEASE_AND_RETURN(scope, JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(sigBuffer), 0, finalSignatureLength)); + RELEASE_AND_RETURN(scope, JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(sigBuffer), 0, finalSignatureLength)); } JSC_DEFINE_HOST_FUNCTION(jsSignProtoFuncSign, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) @@ -446,7 +446,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSignProtoFuncSign, (JSC::JSGlobalObject * lexicalGlob KeyObject keyObject; if (prepareResult.keyData) { - keyObject = KeyObject::create(CryptoKeyType::Private, WTFMove(*prepareResult.keyData)); + keyObject = KeyObject::create(CryptoKeyType::Private, WTF::move(*prepareResult.keyData)); } else { keyObject = KeyObject::getPublicOrPrivateKey( lexicalGlobalObject, @@ -456,7 +456,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSignProtoFuncSign, (JSC::JSGlobalObject * lexicalGlob prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } diff --git a/src/bun.js/bindings/node/crypto/JSVerify.cpp b/src/bun.js/bindings/node/crypto/JSVerify.cpp index c019c06f36010f..7d566662d7e4b5 100644 --- a/src/bun.js/bindings/node/crypto/JSVerify.cpp +++ b/src/bun.js/bindings/node/crypto/JSVerify.cpp @@ -200,7 +200,7 @@ JSC_DEFINE_HOST_FUNCTION(jsVerifyProtoFuncInit, (JSGlobalObject * globalObject, } // Store the initialized context in the JSVerify object - thisObject->m_mdCtx = WTFMove(mdCtx); + thisObject->m_mdCtx = WTF::move(mdCtx); return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -339,7 +339,7 @@ JSC_DEFINE_HOST_FUNCTION(jsVerifyProtoFuncVerify, (JSGlobalObject * globalObject KeyObject keyObject; if (prepareResult.keyData) { - keyObject = KeyObject::create(CryptoKeyType::Public, WTFMove(*prepareResult.keyData)); + keyObject = KeyObject::create(CryptoKeyType::Public, WTF::move(*prepareResult.keyData)); } else { keyObject = KeyObject::getPublicOrPrivateKey( globalObject, @@ -349,7 +349,7 @@ JSC_DEFINE_HOST_FUNCTION(jsVerifyProtoFuncVerify, (JSGlobalObject * globalObject prepareResult.formatType, prepareResult.encodingType, prepareResult.cipher, - WTFMove(prepareResult.passphrase)); + WTF::move(prepareResult.passphrase)); RETURN_IF_EXCEPTION(scope, {}); } @@ -367,7 +367,7 @@ JSC_DEFINE_HOST_FUNCTION(jsVerifyProtoFuncVerify, (JSGlobalObject * globalObject RETURN_IF_EXCEPTION(scope, {}); // Move mdCtx out of JSVerify object to finalize it - ncrypto::EVPMDCtxPointer mdCtx = WTFMove(thisObject->m_mdCtx); + ncrypto::EVPMDCtxPointer mdCtx = WTF::move(thisObject->m_mdCtx); // Validate DSA parameters if (!keyPtr.validateDsaParameters()) { @@ -485,7 +485,7 @@ std::optional keyFromPublicString(JSGlobalObject* lexica auto publicRes = ncrypto::EVPKeyPointer::TryParsePublicKey(publicConfig, ncryptoBuf); if (publicRes) { - ncrypto::EVPKeyPointer keyPtr(WTFMove(publicRes.value)); + ncrypto::EVPKeyPointer keyPtr(WTF::move(publicRes.value)); return keyPtr; } @@ -494,7 +494,7 @@ std::optional keyFromPublicString(JSGlobalObject* lexica privateConfig.format = ncrypto::EVPKeyPointer::PKFormatType::PEM; auto privateRes = ncrypto::EVPKeyPointer::TryParsePrivateKey(privateConfig, ncryptoBuf); if (privateRes) { - ncrypto::EVPKeyPointer keyPtr(WTFMove(privateRes.value)); + ncrypto::EVPKeyPointer keyPtr(WTF::move(privateRes.value)); return keyPtr; } } diff --git a/src/bun.js/bindings/node/crypto/KeyObject.cpp b/src/bun.js/bindings/node/crypto/KeyObject.cpp index 0a1d9658b62f64..601f607ba29193 100644 --- a/src/bun.js/bindings/node/crypto/KeyObject.cpp +++ b/src/bun.js/bindings/node/crypto/KeyObject.cpp @@ -298,7 +298,7 @@ JSValue toJS(JSGlobalObject* lexicalGlobalObject, ThrowScope& scope, const ncryp } memcpy(buf->data(), bptr->data, bptr->length); - return JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buf), 0, bptr->length); + return JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(buf), 0, bptr->length); } JSC::JSValue KeyObject::exportPublic(JSC::JSGlobalObject* lexicalGlobalObject, JSC::ThrowScope& scope, const ncrypto::EVPKeyPointer::PublicKeyEncodingConfig& config) @@ -312,7 +312,7 @@ JSC::JSValue KeyObject::exportPublic(JSC::JSGlobalObject* lexicalGlobalObject, J KeyObject keyObject = *this; keyObject.type() = CryptoKeyType::Public; Structure* structure = globalObject->m_JSPublicKeyObjectClassStructure.get(lexicalGlobalObject); - JSPublicKeyObject* publicKey = JSPublicKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSPublicKeyObject* publicKey = JSPublicKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return publicKey; } @@ -340,7 +340,7 @@ JSValue KeyObject::exportPrivate(JSGlobalObject* lexicalGlobalObject, ThrowScope if (config.output_key_object) { KeyObject keyObject = *this; Structure* structure = globalObject->m_JSPrivateKeyObjectClassStructure.get(lexicalGlobalObject); - JSPrivateKeyObject* privateKey = JSPrivateKeyObject::create(vm, structure, lexicalGlobalObject, WTFMove(keyObject)); + JSPrivateKeyObject* privateKey = JSPrivateKeyObject::create(vm, structure, lexicalGlobalObject, WTF::move(keyObject)); return privateKey; } @@ -420,7 +420,7 @@ JSValue KeyObject::exportSecret(JSGlobalObject* lexicalGlobalObject, ThrowScope& return {}; } memcpy(buf->data(), key.begin(), key.size()); - return JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buf), 0, key.size()); + return JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTF::move(buf), 0, key.size()); }; if (!optionsValue.isUndefined()) { @@ -648,7 +648,7 @@ static std::optional*> getSymmetricKey(const WebCore::Cryp KeyObject KeyObject::create(CryptoKeyType type, RefPtr&& data) { - return KeyObject(type, WTFMove(data)); + return KeyObject(type, WTF::move(data)); } WebCore::ExceptionOr KeyObject::create(WebCore::CryptoKey& key) @@ -664,7 +664,7 @@ WebCore::ExceptionOr KeyObject::create(WebCore::CryptoKey& key) WTF::Vector copy; copy.appendVector(*keyData.value()); - return create(WTFMove(copy)); + return create(WTF::move(copy)); } case WebCore::CryptoKeyType::Public: { @@ -678,7 +678,7 @@ WebCore::ExceptionOr KeyObject::create(WebCore::CryptoKey& key) EVP_PKEY_up_ref(keyValue.key); ncrypto::EVPKeyPointer keyPtr(keyValue.key); - return create(CryptoKeyType::Public, WTFMove(keyPtr)); + return create(CryptoKeyType::Public, WTF::move(keyPtr)); } case WebCore::CryptoKeyType::Private: { @@ -692,7 +692,7 @@ WebCore::ExceptionOr KeyObject::create(WebCore::CryptoKey& key) EVP_PKEY_up_ref(keyValue.key); ncrypto::EVPKeyPointer keyPtr(keyValue.key); - return create(CryptoKeyType::Private, WTFMove(keyPtr)); + return create(CryptoKeyType::Private, WTF::move(keyPtr)); } } @@ -701,14 +701,14 @@ WebCore::ExceptionOr KeyObject::create(WebCore::CryptoKey& key) KeyObject KeyObject::create(WTF::Vector&& symmetricKey) { - RefPtr data = KeyObjectData::create(WTFMove(symmetricKey)); - return KeyObject(CryptoKeyType::Secret, WTFMove(data)); + RefPtr data = KeyObjectData::create(WTF::move(symmetricKey)); + return KeyObject(CryptoKeyType::Secret, WTF::move(data)); } KeyObject KeyObject::create(CryptoKeyType type, ncrypto::EVPKeyPointer&& asymmetricKey) { - RefPtr data = KeyObjectData::create(WTFMove(asymmetricKey)); - return KeyObject(type, WTFMove(data)); + RefPtr data = KeyObjectData::create(WTF::move(asymmetricKey)); + return KeyObject(type, WTF::move(data)); } void KeyObject::getKeyObjectFromHandle(JSGlobalObject* globalObject, ThrowScope& scope, JSValue keyValue, const KeyObject& handle, PrepareAsymmetricKeyMode mode) @@ -880,7 +880,7 @@ KeyObject KeyObject::getKeyObjectHandleFromJwk(JSGlobalObject* globalObject, Thr return {}; } - return create(keyType, WTFMove(key)); + return create(keyType, WTF::move(key)); } case Kty::Ec: { auto crvView = getJwkStringView(globalObject, scope, jwk, "crv"_s, "key.crv"_s); @@ -942,7 +942,7 @@ KeyObject KeyObject::getKeyObjectHandleFromJwk(JSGlobalObject* globalObject, Thr auto key = EVPKeyPointer::New(); key.set(ec); - return create(keyType, WTFMove(key)); + return create(keyType, WTF::move(key)); } case Kty::Rsa: { auto nView = getJwkStringView(globalObject, scope, jwk, "n"_s, "key.n"_s); @@ -989,8 +989,8 @@ KeyObject KeyObject::getKeyObjectHandleFromJwk(JSGlobalObject* globalObject, Thr } } - auto key = EVPKeyPointer::NewRSA(WTFMove(rsa)); - return create(keyType, WTFMove(key)); + auto key = EVPKeyPointer::NewRSA(WTF::move(rsa)); + return create(keyType, WTF::move(key)); } } @@ -1041,7 +1041,7 @@ EVPKeyPointer::PrivateKeyEncodingConfig KeyObject::getPrivateKeyEncoding( } if (passphrase) { - config.passphrase = WTFMove(*passphrase); + config.passphrase = WTF::move(*passphrase); } } @@ -1071,13 +1071,13 @@ KeyObject KeyObject::getPublicOrPrivateKey( formatType, encodingType, cipher, - WTFMove(passphrase), + WTF::move(passphrase), KeyEncodingContext::Input); RETURN_IF_EXCEPTION(scope, {}); auto res = EVPKeyPointer::TryParsePrivateKey(config, buf); if (res) { - return create(CryptoKeyType::Private, WTFMove(res.value)); + return create(CryptoKeyType::Private, WTF::move(res.value)); } if (res.error.value() == EVPKeyPointer::PKParseError::NEED_PASSPHRASE) { @@ -1099,20 +1099,20 @@ KeyObject KeyObject::getPublicOrPrivateKey( formatType, encodingType, cipher, - WTFMove(passphrase), + WTF::move(passphrase), KeyEncodingContext::Input); RETURN_IF_EXCEPTION(scope, {}); if (config.format == EVPKeyPointer::PKFormatType::PEM) { auto publicRes = EVPKeyPointer::TryParsePublicKeyPEM(buf); if (publicRes) { - return create(CryptoKeyType::Public, WTFMove(publicRes.value)); + return create(CryptoKeyType::Public, WTF::move(publicRes.value)); } if (publicRes.error.value() == EVPKeyPointer::PKParseError::NOT_RECOGNIZED) { auto privateRes = EVPKeyPointer::TryParsePrivateKey(config, buf); if (privateRes) { - return create(CryptoKeyType::Public, WTFMove(privateRes.value)); + return create(CryptoKeyType::Public, WTF::move(privateRes.value)); } if (privateRes.error.value() == EVPKeyPointer::PKParseError::NEED_PASSPHRASE) { @@ -1145,7 +1145,7 @@ KeyObject KeyObject::getPublicOrPrivateKey( if (isPublic(config, buf)) { auto res = EVPKeyPointer::TryParsePublicKey(config, buf); if (res) { - return create(CryptoKeyType::Public, WTFMove(res.value)); + return create(CryptoKeyType::Public, WTF::move(res.value)); } throwCryptoError(globalObject, scope, res.openssl_error.value_or(0), "Failed to read asymmetric key"_s); @@ -1154,7 +1154,7 @@ KeyObject KeyObject::getPublicOrPrivateKey( auto res = EVPKeyPointer::TryParsePrivateKey(config, buf); if (res) { - return create(CryptoKeyType::Private, WTFMove(res.value)); + return create(CryptoKeyType::Private, WTF::move(res.value)); } if (res.error.value() == EVPKeyPointer::PKParseError::NEED_PASSPHRASE) { @@ -1343,7 +1343,7 @@ KeyObject::PrepareAsymmetricKeyResult KeyObject::prepareAsymmetricKey(JSC::JSGlo .formatType = config.format, .encodingType = config.type, .cipher = config.cipher, - .passphrase = WTFMove(config.passphrase), + .passphrase = WTF::move(config.passphrase), }; } } @@ -1360,7 +1360,7 @@ KeyObject::PrepareAsymmetricKeyResult KeyObject::prepareAsymmetricKey(JSC::JSGlo .formatType = config.format, .encodingType = config.type, .cipher = config.cipher, - .passphrase = WTFMove(config.passphrase), + .passphrase = WTF::move(config.passphrase), }; } @@ -1377,7 +1377,7 @@ KeyObject::PrepareAsymmetricKeyResult KeyObject::prepareAsymmetricKey(JSC::JSGlo .formatType = config.format, .encodingType = config.type, .cipher = config.cipher, - .passphrase = WTFMove(config.passphrase), + .passphrase = WTF::move(config.passphrase), }; } @@ -1460,14 +1460,14 @@ KeyObject KeyObject::prepareSecretKey(JSGlobalObject* globalObject, ThrowScope& Vector copy; copy.append(view->span()); - return create(WTFMove(copy)); + return create(WTF::move(copy)); } // TODO(dylan-conway): avoid copying by keeping the buffer alive if (auto* view = jsDynamicCast(keyValue)) { Vector copy; copy.append(view->span()); - return create(WTFMove(copy)); + return create(WTF::move(copy)); } // TODO(dylan-conway): avoid copying by keeping the buffer alive @@ -1475,7 +1475,7 @@ KeyObject KeyObject::prepareSecretKey(JSGlobalObject* globalObject, ThrowScope& auto* impl = arrayBuffer->impl(); Vector copy; copy.append(impl->span()); - return create(WTFMove(copy)); + return create(WTF::move(copy)); } if (bufferOnly) { diff --git a/src/bun.js/bindings/node/crypto/KeyObject.h b/src/bun.js/bindings/node/crypto/KeyObject.h index f33fb40382c768..d783cf9102f1ca 100644 --- a/src/bun.js/bindings/node/crypto/KeyObject.h +++ b/src/bun.js/bindings/node/crypto/KeyObject.h @@ -16,7 +16,7 @@ class KeyObject { WTF_MAKE_TZONE_ALLOCATED(KeyObject); KeyObject(WebCore::CryptoKeyType type, RefPtr&& data) - : m_data(WTFMove(data)) + : m_data(WTF::move(data)) , m_type(type) { } diff --git a/src/bun.js/bindings/node/crypto/KeyObjectData.h b/src/bun.js/bindings/node/crypto/KeyObjectData.h index 46ccfda7e29ce5..ce7450afb18dfb 100644 --- a/src/bun.js/bindings/node/crypto/KeyObjectData.h +++ b/src/bun.js/bindings/node/crypto/KeyObjectData.h @@ -8,12 +8,12 @@ struct KeyObjectData : ThreadSafeRefCounted { WTF_MAKE_TZONE_ALLOCATED(KeyObjectData); KeyObjectData(WTF::Vector&& symmetricKey) - : symmetricKey(WTFMove(symmetricKey)) + : symmetricKey(WTF::move(symmetricKey)) { } KeyObjectData(ncrypto::EVPKeyPointer&& asymmetricKey) - : asymmetricKey(WTFMove(asymmetricKey)) + : asymmetricKey(WTF::move(asymmetricKey)) { } @@ -22,12 +22,12 @@ struct KeyObjectData : ThreadSafeRefCounted { static RefPtr create(WTF::Vector&& symmetricKey) { - return adoptRef(*new KeyObjectData(WTFMove(symmetricKey))); + return adoptRef(*new KeyObjectData(WTF::move(symmetricKey))); } static RefPtr create(ncrypto::EVPKeyPointer&& asymmetricKey) { - return adoptRef(*new KeyObjectData(WTFMove(asymmetricKey))); + return adoptRef(*new KeyObjectData(WTF::move(asymmetricKey))); } WTF::Vector symmetricKey; diff --git a/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp b/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp index e490ebfabde6aa..e8c2d019dad4f4 100644 --- a/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp +++ b/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp @@ -197,7 +197,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCertExportChallenge, (JSC::JSGlobalObject * lexicalGl return JSValue::encode(jsEmptyString(vm)); } - auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTFMove(result), 0, cert.len); + auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTF::move(result), 0, cert.len); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(bufferResult); diff --git a/src/bun.js/bindings/webcore/AbortSignal.cpp b/src/bun.js/bindings/webcore/AbortSignal.cpp index 3b4f2217c6aa4b..1e36c497db74f1 100644 --- a/src/bun.js/bindings/webcore/AbortSignal.cpp +++ b/src/bun.js/bindings/webcore/AbortSignal.cpp @@ -191,7 +191,7 @@ void AbortSignal::signalAbort(JSC::JSValue reason) for (Ref dependentSignal : std::exchange(m_dependentSignals, {})) { if (!dependentSignal->aborted()) { dependentSignal->markAborted(reason); - dependentSignalsToAbort.append(WTFMove(dependentSignal)); + dependentSignalsToAbort.append(WTF::move(dependentSignal)); } } @@ -222,7 +222,7 @@ void AbortSignal::cleanNativeBindings(void* ref) return ctx == ref; }); - std::exchange(m_native_callbacks, WTFMove(callbacks)); + std::exchange(m_native_callbacks, WTF::move(callbacks)); this->eventListenersDidChange(); } @@ -257,7 +257,7 @@ uint32_t AbortSignal::addAbortAlgorithmToSignal(AbortSignal& signal, RefhandleEvent(signal.jsReason(*signal.scriptExecutionContext()->jsGlobalObject())); return 0; } - return signal.addAlgorithm([algorithm = WTFMove(algorithm)](JSC::JSValue value) mutable { + return signal.addAlgorithm([algorithm = WTF::move(algorithm)](JSC::JSValue value) mutable { algorithm->handleEvent(value); }); } @@ -269,7 +269,7 @@ void AbortSignal::removeAbortAlgorithmFromSignal(AbortSignal& signal, uint32_t a uint32_t AbortSignal::addAlgorithm(Algorithm&& algorithm) { - m_algorithms.append(std::make_pair(++m_algorithmIdentifier, WTFMove(algorithm))); + m_algorithms.append(std::make_pair(++m_algorithmIdentifier, WTF::move(algorithm))); return m_algorithmIdentifier; } diff --git a/src/bun.js/bindings/webcore/ActiveDOMObject.cpp b/src/bun.js/bindings/webcore/ActiveDOMObject.cpp index d2662f8e9f3f38..39eb5d4d0261c6 100644 --- a/src/bun.js/bindings/webcore/ActiveDOMObject.cpp +++ b/src/bun.js/bindings/webcore/ActiveDOMObject.cpp @@ -134,7 +134,7 @@ // auto* context = scriptExecutionContext(); // if (!context) // return; -// context->eventLoop().queueTask(source, WTFMove(function)); +// context->eventLoop().queueTask(source, WTF::move(function)); // } // class ActiveDOMObjectEventDispatchTask : public EventLoopTask { @@ -142,7 +142,7 @@ // ActiveDOMObjectEventDispatchTask(TaskSource source, EventLoopTaskGroup& group, ActiveDOMObject& object, Function&& dispatchEvent) // : EventLoopTask(source, group) // , m_object(object) -// , m_dispatchEvent(WTFMove(dispatchEvent)) +// , m_dispatchEvent(WTF::move(dispatchEvent)) // { // ++m_object.m_pendingActivityInstanceCount; // } @@ -173,10 +173,10 @@ // if (!context) // return; // auto& eventLoopTaskGroup = context->eventLoop(); -// auto task = makeUnique(source, eventLoopTaskGroup, *this, [target = Ref { target }, event = WTFMove(event)] { +// auto task = makeUnique(source, eventLoopTaskGroup, *this, [target = Ref { target }, event = WTF::move(event)] { // target->dispatchEvent(event); // }); -// eventLoopTaskGroup.queueTask(WTFMove(task)); +// eventLoopTaskGroup.queueTask(WTF::move(task)); // } // void ActiveDOMObject::queueCancellableTaskToDispatchEventInternal(EventTarget& target, TaskSource source, TaskCancellationGroup& cancellationGroup, Ref&& event) @@ -186,10 +186,10 @@ // if (!context) // return; // auto& eventLoopTaskGroup = context->eventLoop(); -// auto task = makeUnique(source, eventLoopTaskGroup, *this, CancellableTask(cancellationGroup, [target = Ref { target }, event = WTFMove(event)] { +// auto task = makeUnique(source, eventLoopTaskGroup, *this, CancellableTask(cancellationGroup, [target = Ref { target }, event = WTF::move(event)] { // target->dispatchEvent(event); // })); -// eventLoopTaskGroup.queueTask(WTFMove(task)); +// eventLoopTaskGroup.queueTask(WTF::move(task)); // } // } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/ActiveDOMObject.h b/src/bun.js/bindings/webcore/ActiveDOMObject.h index 52daebc6faa845..99a444e352feeb 100644 --- a/src/bun.js/bindings/webcore/ActiveDOMObject.h +++ b/src/bun.js/bindings/webcore/ActiveDOMObject.h @@ -106,7 +106,7 @@ // template // static void queueTaskKeepingObjectAlive(T& object, TaskSource source, Function&& task) // { -// object.queueTaskInEventLoop(source, [protectedObject = Ref { object }, activity = object.ActiveDOMObject::makePendingActivity(object), task = WTFMove(task)] () { +// object.queueTaskInEventLoop(source, [protectedObject = Ref { object }, activity = object.ActiveDOMObject::makePendingActivity(object), task = WTF::move(task)] () { // task(); // }); // } @@ -114,8 +114,8 @@ // template // static void queueCancellableTaskKeepingObjectAlive(T& object, TaskSource source, TaskCancellationGroup& cancellationGroup, Function&& task) // { -// CancellableTask cancellableTask(cancellationGroup, WTFMove(task)); -// object.queueTaskInEventLoop(source, [protectedObject = Ref { object }, activity = object.ActiveDOMObject::makePendingActivity(object), cancellableTask = WTFMove(cancellableTask)]() mutable { +// CancellableTask cancellableTask(cancellationGroup, WTF::move(task)); +// object.queueTaskInEventLoop(source, [protectedObject = Ref { object }, activity = object.ActiveDOMObject::makePendingActivity(object), cancellableTask = WTF::move(cancellableTask)]() mutable { // cancellableTask(); // }); // } @@ -123,13 +123,13 @@ // template // static void queueTaskToDispatchEvent(EventTargetType& target, TaskSource source, Ref&& event) // { -// target.queueTaskToDispatchEventInternal(target, source, WTFMove(event)); +// target.queueTaskToDispatchEventInternal(target, source, WTF::move(event)); // } // template // static void queueCancellableTaskToDispatchEvent(EventTargetType& target, TaskSource source, TaskCancellationGroup& cancellationGroup, Ref&& event) // { -// target.queueCancellableTaskToDispatchEventInternal(target, source, cancellationGroup, WTFMove(event)); +// target.queueCancellableTaskToDispatchEventInternal(target, source, cancellationGroup, WTF::move(event)); // } // protected: diff --git a/src/bun.js/bindings/webcore/AddEventListenerOptions.h b/src/bun.js/bindings/webcore/AddEventListenerOptions.h index 79128ee15260c8..ddf74b529b3055 100644 --- a/src/bun.js/bindings/webcore/AddEventListenerOptions.h +++ b/src/bun.js/bindings/webcore/AddEventListenerOptions.h @@ -36,7 +36,7 @@ struct AddEventListenerOptions : EventListenerOptions { : EventListenerOptions(capture) , passive(passive) , once(once) - , signal(WTFMove(signal)) + , signal(WTF::move(signal)) { } diff --git a/src/bun.js/bindings/webcore/BroadcastChannel.cpp b/src/bun.js/bindings/webcore/BroadcastChannel.cpp index bf4dab991eb176..f0b3ebbbb56f96 100644 --- a/src/bun.js/bindings/webcore/BroadcastChannel.cpp +++ b/src/bun.js/bindings/webcore/BroadcastChannel.cpp @@ -71,7 +71,7 @@ static UncheckedKeyHashMap, public Identified { @@ -123,7 +123,7 @@ void BroadcastChannel::MainThreadBridge::ensureOnMainThread(Functionm_name, protectedThis->identifier()); channelToContextIdentifier().add(protectedThis->identifier(), contextId); }); @@ -142,7 +142,7 @@ void BroadcastChannel::MainThreadBridge::unregisterChannel() { Ref protectedThis { *this }; - ScriptExecutionContext::ensureOnMainThread([protectedThis = WTFMove(protectedThis)](auto& context) { + ScriptExecutionContext::ensureOnMainThread([protectedThis = WTF::move(protectedThis)](auto& context) { context.broadcastChannelRegistry().unregisterChannel(protectedThis->m_name, protectedThis->identifier()); channelToContextIdentifier().remove(protectedThis->identifier()); }); @@ -152,8 +152,8 @@ void BroadcastChannel::MainThreadBridge::postMessage(Ref& { Ref protectedThis { *this }; - ScriptExecutionContext::ensureOnMainThread([protectedThis = WTFMove(protectedThis), message = WTFMove(message)](auto& context) mutable { - context.broadcastChannelRegistry().postMessage(protectedThis->m_name, protectedThis->identifier(), WTFMove(message)); + ScriptExecutionContext::ensureOnMainThread([protectedThis = WTF::move(protectedThis), message = WTF::move(message)](auto& context) mutable { + context.broadcastChannelRegistry().postMessage(protectedThis->m_name, protectedThis->identifier(), WTF::move(message)); }); } @@ -237,14 +237,14 @@ void BroadcastChannel::dispatchMessageTo(BroadcastChannelIdentifier channelIdent if (!contextIdentifier) return; - ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [channelIdentifier, message = WTFMove(message)](auto&) mutable { + ScriptExecutionContext::ensureOnContextThread(contextIdentifier, [channelIdentifier, message = WTF::move(message)](auto&) mutable { RefPtr channel; { Locker locker { allBroadcastChannelsLock }; channel = allBroadcastChannels().get(channelIdentifier); } if (channel) - channel->dispatchMessage(WTFMove(message)); + channel->dispatchMessage(WTF::move(message)); }); } @@ -256,7 +256,7 @@ void BroadcastChannel::dispatchMessage(Ref&& message) if (m_isClosed) return; - ScriptExecutionContext::postTaskTo(contextIdForBroadcastChannelId(m_mainThreadBridge->identifier()), [this, message = WTFMove(message)](ScriptExecutionContext& context) mutable { + ScriptExecutionContext::postTaskTo(contextIdForBroadcastChannelId(m_mainThreadBridge->identifier()), [this, message = WTF::move(message)](ScriptExecutionContext& context) mutable { if (m_isClosed) return; @@ -267,7 +267,7 @@ void BroadcastChannel::dispatchMessage(Ref&& message) auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_CATCH_SCOPE(vm); Vector> dummyPorts; - auto event = MessageEvent::create(*globalObject, WTFMove(message), {}, {}, nullptr, WTFMove(dummyPorts)); + auto event = MessageEvent::create(*globalObject, WTF::move(message), {}, {}, nullptr, WTF::move(dummyPorts)); if (scope.exception()) [[unlikely]] { // Currently, we assume that the only way we can get here is if we have a termination. RELEASE_ASSERT(vm.hasPendingTerminationException()); diff --git a/src/bun.js/bindings/webcore/BufferSource.h b/src/bun.js/bindings/webcore/BufferSource.h index 5e8f688a3d06c2..2915b6f6d15991 100644 --- a/src/bun.js/bindings/webcore/BufferSource.h +++ b/src/bun.js/bindings/webcore/BufferSource.h @@ -39,7 +39,7 @@ class BufferSource { BufferSource() {} BufferSource(VariantType&& variant) - : m_variant(WTFMove(variant)) + : m_variant(WTF::move(variant)) { } diff --git a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp b/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp index 258d297170bded..e8155aa9935e85 100644 --- a/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp +++ b/src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp @@ -45,7 +45,7 @@ void BunBroadcastChannelRegistry::postMessageLocally(const String& name, Broadca void BunBroadcastChannelRegistry::postMessageToRemote(const String& name, MessageWithMessagePorts&& message) { - // auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); + // auto callbackAggregator = CallbackAggregator::create(WTF::move(completionHandler)); // PartitionedSecurityOrigin origin { clientOrigin.topOrigin.securityOrigin(), clientOrigin.clientOrigin.securityOrigin() }; // postMessageLocally(origin, name, std::nullopt, *message.message, callbackAggregator.copyRef()); } diff --git a/src/bun.js/bindings/webcore/CallbackResult.h b/src/bun.js/bindings/webcore/CallbackResult.h index abedf5a2ff20b4..f0ce0cc7d6e9ac 100644 --- a/src/bun.js/bindings/webcore/CallbackResult.h +++ b/src/bun.js/bindings/webcore/CallbackResult.h @@ -64,7 +64,7 @@ template inline CallbackResult::CallbackResult( } template inline CallbackResult::CallbackResult(ReturnType&& returnValue) - : m_value(WTFMove(returnValue)) + : m_value(WTF::move(returnValue)) { } @@ -76,7 +76,7 @@ template inline CallbackResultType CallbackResult inline auto CallbackResult::releaseReturnValue() -> ReturnType&& { ASSERT(m_value.has_value()); - return WTFMove(m_value.value()); + return WTF::move(m_value.value()); } // Void specialization diff --git a/src/bun.js/bindings/webcore/DOMPromiseProxy.h b/src/bun.js/bindings/webcore/DOMPromiseProxy.h index 765528460b3eae..573ee5d51726c0 100644 --- a/src/bun.js/bindings/webcore/DOMPromiseProxy.h +++ b/src/bun.js/bindings/webcore/DOMPromiseProxy.h @@ -206,7 +206,7 @@ inline void DOMPromiseProxy::reject(Exception exception, RejectAsHandle { ASSERT(!m_valueOrException); - m_valueOrException = ExceptionOr { WTFMove(exception) }; + m_valueOrException = ExceptionOr { WTF::move(exception) }; for (auto& deferredPromise : m_deferredPromises) deferredPromise->reject(m_valueOrException->exception(), rejectAsHandled); } @@ -260,7 +260,7 @@ inline void DOMPromiseProxy::resolve() inline void DOMPromiseProxy::reject(Exception exception, RejectAsHandled rejectAsHandled) { ASSERT(!m_valueOrException); - m_valueOrException = ExceptionOr { WTFMove(exception) }; + m_valueOrException = ExceptionOr { WTF::move(exception) }; for (auto& deferredPromise : m_deferredPromises) deferredPromise->reject(m_valueOrException->exception(), rejectAsHandled); } @@ -276,7 +276,7 @@ inline DOMPromiseProxyWithResolveCallback::DOMPromiseProxyWithResolveCa template inline DOMPromiseProxyWithResolveCallback::DOMPromiseProxyWithResolveCallback(ResolveCallback&& function) - : m_resolveCallback(WTFMove(function)) + : m_resolveCallback(WTF::move(function)) { } @@ -344,7 +344,7 @@ inline void DOMPromiseProxyWithResolveCallback::reject(Exception except { ASSERT(!m_valueOrException); - m_valueOrException = ExceptionOr { WTFMove(exception) }; + m_valueOrException = ExceptionOr { WTF::move(exception) }; for (auto& deferredPromise : m_deferredPromises) deferredPromise->reject(m_valueOrException->exception(), rejectAsHandled); } diff --git a/src/bun.js/bindings/webcore/ErrorCallback.cpp b/src/bun.js/bindings/webcore/ErrorCallback.cpp index 5c9aab344c7e19..f54160caa25ce1 100644 --- a/src/bun.js/bindings/webcore/ErrorCallback.cpp +++ b/src/bun.js/bindings/webcore/ErrorCallback.cpp @@ -33,7 +33,7 @@ namespace WebCore { void ErrorCallback::scheduleCallback(ScriptExecutionContext& context, Ref&& exception) { - context.postTask([protectedThis = Ref { *this }, exception = WTFMove(exception)](ScriptExecutionContext&) { + context.postTask([protectedThis = Ref { *this }, exception = WTF::move(exception)](ScriptExecutionContext&) { protectedThis->handleEvent(exception); }); } diff --git a/src/bun.js/bindings/webcore/Event.cpp b/src/bun.js/bindings/webcore/Event.cpp index 0e4bd33690b5ec..f2619e598b39fa 100644 --- a/src/bun.js/bindings/webcore/Event.cpp +++ b/src/bun.js/bindings/webcore/Event.cpp @@ -126,7 +126,7 @@ void Event::setTarget(RefPtr&& target) if (m_target == target) return; - m_target = WTFMove(target); + m_target = WTF::move(target); if (m_target) receivedTarget(); } diff --git a/src/bun.js/bindings/webcore/EventContext.h b/src/bun.js/bindings/webcore/EventContext.h index 41214c9d3c1bbe..98c1479bb19187 100644 --- a/src/bun.js/bindings/webcore/EventContext.h +++ b/src/bun.js/bindings/webcore/EventContext.h @@ -106,7 +106,7 @@ class EventContext { inline EventContext::EventContext(Type type, Node* node, RefPtr&& currentTarget, EventTarget* origin, int closedShadowDepth, bool currentTargetIsInShadowTree) : m_node { node } - , m_currentTarget { WTFMove(currentTarget) } + , m_currentTarget { WTF::move(currentTarget) } , m_target { origin } , m_closedShadowDepth { closedShadowDepth } , m_currentTargetIsInShadowTree { currentTargetIsInShadowTree } diff --git a/src/bun.js/bindings/webcore/EventEmitter.cpp b/src/bun.js/bindings/webcore/EventEmitter.cpp index afdbedab4c1cf4..c9ab566b410314 100644 --- a/src/bun.js/bindings/webcore/EventEmitter.cpp +++ b/src/bun.js/bindings/webcore/EventEmitter.cpp @@ -265,7 +265,7 @@ bool EventEmitter::innerInvokeEventListeners(const Identifier& eventType, Simple errorValue = JSC::jsUndefined(); } expcep.append(errorValue); - fireEventListeners(errorIdentifier, WTFMove(expcep)); + fireEventListeners(errorIdentifier, WTF::move(expcep)); } } } diff --git a/src/bun.js/bindings/webcore/EventFactory.cpp b/src/bun.js/bindings/webcore/EventFactory.cpp index e920afe2175169..062a6aac8e8263 100644 --- a/src/bun.js/bindings/webcore/EventFactory.cpp +++ b/src/bun.js/bindings/webcore/EventFactory.cpp @@ -37,277 +37,277 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj { switch (impl->eventInterface()) { // case AnimationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case AnimationPlaybackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(APPLE_PAY) // case ApplePayCancelEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY_COUPON_CODE) // case ApplePayCouponCodeChangedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY) // case ApplePayPaymentAuthorizedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY) // case ApplePayPaymentMethodSelectedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY) // case ApplePayShippingContactSelectedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY) // case ApplePayShippingMethodSelectedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(APPLE_PAY) // case ApplePayValidateMerchantEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_AUDIO) // case AudioProcessingEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif case EventInterfaceType: { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } // case BeforeUnloadEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(MEDIA_RECORDER) // case BlobEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case ClipboardEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); case CloseEventInterfaceType: { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } // case CompositionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case CustomEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(DEVICE_ORIENTATION) // case DeviceMotionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(DEVICE_ORIENTATION) // case DeviceOrientationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case DragEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); case ErrorEventInterfaceType: { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } // #if ENABLE(SERVICE_WORKER) // case ExtendableEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(SERVICE_WORKER) // case ExtendableMessageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(SERVICE_WORKER) // case FetchEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case FocusEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case FormDataEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(GAMEPAD) // case GamepadEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS) // case GestureEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case HashChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case IDBVersionChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case InputEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case KeyboardEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(ENCRYPTED_MEDIA) // case MediaEncryptedEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(ENCRYPTED_MEDIA) // case MediaKeyMessageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case MediaQueryListEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(MEDIA_RECORDER) // case MediaRecorderErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(MEDIA_STREAM) // case MediaStreamTrackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(PAYMENT_REQUEST) // case MerchantValidationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif case MessageEventInterfaceType: - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); // case MouseEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case MutationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(NOTIFICATION_EVENT) // case NotificationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_AUDIO) // case OfflineAudioCompletionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(MEDIA_STREAM) // case OverconstrainedErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case OverflowEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case PageTransitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(PAYMENT_REQUEST) // case PaymentMethodChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(PAYMENT_REQUEST) // case PaymentRequestUpdateEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(PICTURE_IN_PICTURE_API) // case PictureInPictureEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case PointerEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case PopStateEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case ProgressEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case PromiseRejectionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(SERVICE_WORKER) // case PushEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(SERVICE_WORKER) // case PushSubscriptionChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCDTMFToneChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCDataChannelEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCPeerConnectionIceErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCPeerConnectionIceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCRtpSFrameTransformErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCTrackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEB_RTC) // case RTCTransformEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case SVGZoomEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case SecurityPolicyViolationEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case SpeechRecognitionErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case SpeechRecognitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(SPEECH_SYNTHESIS) // case SpeechSynthesisErrorEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(SPEECH_SYNTHESIS) // case SpeechSynthesisEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case StorageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case SubmitEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case TextEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(TOUCH_EVENTS) // case TouchEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(VIDEO) // case TrackEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case TransitionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case UIEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(WEBGL) // case WebGLContextEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) // case WebKitMediaKeyMessageEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(LEGACY_ENCRYPTED_MEDIA) // case WebKitMediaKeyNeededEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WIRELESS_PLAYBACK_TARGET) // case WebKitPlaybackTargetAvailabilityEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // case WheelEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // case XMLHttpRequestProgressEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #if ENABLE(WEBXR) // case XRInputSourceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEBXR) // case XRInputSourcesChangeEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEBXR) // case XRReferenceSpaceEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // #if ENABLE(WEBXR) // case XRSessionEventInterfaceType: - // return createWrapper(globalObject, WTFMove(impl)); + // return createWrapper(globalObject, WTF::move(impl)); // #endif // } default: { @@ -315,7 +315,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj } } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/EventInit.h b/src/bun.js/bindings/webcore/EventInit.h index 0e588593c54edc..1b7fd80941a719 100644 --- a/src/bun.js/bindings/webcore/EventInit.h +++ b/src/bun.js/bindings/webcore/EventInit.h @@ -33,7 +33,7 @@ struct EventInit { bool composed { false }; template void encode(Encoder&) const; - template static WARN_UNUSED_RETURN bool decode(Decoder&, EventInit&); + template WARN_UNUSED_RETURN static bool decode(Decoder&, EventInit&); }; template diff --git a/src/bun.js/bindings/webcore/EventListenerMap.cpp b/src/bun.js/bindings/webcore/EventListenerMap.cpp index be3493744f51d6..468b4e00ba0f3e 100644 --- a/src/bun.js/bindings/webcore/EventListenerMap.cpp +++ b/src/bun.js/bindings/webcore/EventListenerMap.cpp @@ -110,7 +110,7 @@ void EventListenerMap::replace(const AtomString& eventType, EventListener& oldLi ASSERT(index != notFound); auto& registeredListener = listeners->at(index); registeredListener->markAsRemoved(); - registeredListener = RegisteredEventListener::create(WTFMove(newListener), options); + registeredListener = RegisteredEventListener::create(WTF::move(newListener), options); } bool EventListenerMap::add(const AtomString& eventType, Ref&& listener, const RegisteredEventListener::Options& options) @@ -120,11 +120,11 @@ bool EventListenerMap::add(const AtomString& eventType, Ref&& lis if (auto* listeners = find(eventType)) { if (findListener(*listeners, listener, options.capture) != notFound) return false; // Duplicate listener. - listeners->append(RegisteredEventListener::create(WTFMove(listener), options)); + listeners->append(RegisteredEventListener::create(WTF::move(listener), options)); return true; } - m_entries.append({ eventType, EventListenerVector { RegisteredEventListener::create(WTFMove(listener), options) } }); + m_entries.append({ eventType, EventListenerVector { RegisteredEventListener::create(WTF::move(listener), options) } }); return true; } diff --git a/src/bun.js/bindings/webcore/FetchHeaders.cpp b/src/bun.js/bindings/webcore/FetchHeaders.cpp index 970c0a18eafea5..f241e7e0e8495d 100644 --- a/src/bun.js/bindings/webcore/FetchHeaders.cpp +++ b/src/bun.js/bindings/webcore/FetchHeaders.cpp @@ -169,7 +169,7 @@ ExceptionOr> FetchHeaders::create(std::optional&& header return result.releaseException(); } - return adoptRef(*new FetchHeaders { Guard::None, WTFMove(headers) }); + return adoptRef(*new FetchHeaders { Guard::None, WTF::move(headers) }); } ExceptionOr FetchHeaders::fill(const Init& headerInit) @@ -184,7 +184,7 @@ ExceptionOr FetchHeaders::fill(const FetchHeaders& otherHeaders) headers.commonHeaders().appendVector(otherHeaders.m_headers.commonHeaders()); headers.uncommonHeaders().appendVector(otherHeaders.m_headers.uncommonHeaders()); headers.getSetCookieHeaders().appendVector(otherHeaders.m_headers.getSetCookieHeaders()); - setInternalHeaders(WTFMove(headers)); + setInternalHeaders(WTF::move(headers)); m_updateCounter++; return {}; } @@ -343,7 +343,7 @@ std::optional> FetchHeaders::Iterator::next() if (key.isNull()) { if (m_cookieIndex < setCookieHeaders.size()) { String value = setCookieHeaders[m_cookieIndex++]; - return KeyValuePair { WTF::httpHeaderNameStringImpl(HTTPHeaderName::SetCookie), WTFMove(value) }; + return KeyValuePair { WTF::httpHeaderNameStringImpl(HTTPHeaderName::SetCookie), WTF::move(value) }; } m_currentIndex++; continue; @@ -352,7 +352,7 @@ std::optional> FetchHeaders::Iterator::next() m_currentIndex++; auto value = m_headers->m_headers.get(key); if (!value.isNull()) - return KeyValuePair { WTFMove(key), WTFMove(value) }; + return KeyValuePair { WTF::move(key), WTF::move(value) }; } return std::nullopt; diff --git a/src/bun.js/bindings/webcore/FetchHeaders.h b/src/bun.js/bindings/webcore/FetchHeaders.h index c7b7d73eb99f3f..1785f669840f40 100644 --- a/src/bun.js/bindings/webcore/FetchHeaders.h +++ b/src/bun.js/bindings/webcore/FetchHeaders.h @@ -55,7 +55,7 @@ class FetchHeaders : public RefCounted { using Init = std::variant>, Vector>>; static ExceptionOr> create(std::optional&&); - static Ref create(Guard guard = Guard::None, HTTPHeaderMap&& headers = {}) { return adoptRef(*new FetchHeaders { guard, WTFMove(headers) }); } + static Ref create(Guard guard = Guard::None, HTTPHeaderMap&& headers = {}) { return adoptRef(*new FetchHeaders { guard, WTF::move(headers) }); } static Ref create(const FetchHeaders& headers) { return adoptRef(*new FetchHeaders { headers }); } ExceptionOr append(const String& name, const String& value); @@ -112,7 +112,7 @@ class FetchHeaders : public RefCounted { return Iterator(*this, true); } - void setInternalHeaders(HTTPHeaderMap&& headers) { m_headers = WTFMove(headers); } + void setInternalHeaders(HTTPHeaderMap&& headers) { m_headers = WTF::move(headers); } const HTTPHeaderMap& internalHeaders() const { return m_headers; } void setGuard(Guard); @@ -130,7 +130,7 @@ class FetchHeaders : public RefCounted { inline FetchHeaders::FetchHeaders(Guard guard, HTTPHeaderMap&& headers) : m_guard(guard) - , m_headers(WTFMove(headers)) + , m_headers(WTF::move(headers)) { } diff --git a/src/bun.js/bindings/webcore/HTTPHeaderField.cpp b/src/bun.js/bindings/webcore/HTTPHeaderField.cpp index 649e756fc02368..122c58a9603a7c 100644 --- a/src/bun.js/bindings/webcore/HTTPHeaderField.cpp +++ b/src/bun.js/bindings/webcore/HTTPHeaderField.cpp @@ -218,9 +218,9 @@ std::optional HTTPHeaderField::create(String&& unparsedName, St if (!RFC7230::isValidName(trimmedName) || !RFC7230::isValidValue(trimmedValue)) return std::nullopt; - 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) } }; + auto name = trimmedName.length() == unparsedName.length() ? WTF::move(unparsedName) : trimmedName.toString(); + auto value = trimmedValue.length() == unparsedValue.length() ? WTF::move(unparsedValue) : trimmedValue.toString(); + return { { WTF::move(name), WTF::move(value) } }; } } diff --git a/src/bun.js/bindings/webcore/HTTPHeaderField.h b/src/bun.js/bindings/webcore/HTTPHeaderField.h index 5acb00c8a2de4d..1d8ef651de9135 100644 --- a/src/bun.js/bindings/webcore/HTTPHeaderField.h +++ b/src/bun.js/bindings/webcore/HTTPHeaderField.h @@ -41,8 +41,8 @@ class WEBCORE_EXPORT HTTPHeaderField { private: HTTPHeaderField(String&& name, String&& value) - : m_name(WTFMove(name)) - , m_value(WTFMove(value)) + : m_name(WTF::move(name)) + , m_value(WTF::move(value)) { } String m_name; @@ -69,7 +69,7 @@ std::optional HTTPHeaderField::decode(Decoder& decoder) if (!value) return std::nullopt; - return { { WTFMove(*name), WTFMove(*value) } }; + return { { WTF::move(*name), WTF::move(*value) } }; } namespace RFC7230 { diff --git a/src/bun.js/bindings/webcore/HTTPHeaderMap.cpp b/src/bun.js/bindings/webcore/HTTPHeaderMap.cpp index 3f1ad6fd328096..6ef789490bdbe2 100644 --- a/src/bun.js/bindings/webcore/HTTPHeaderMap.cpp +++ b/src/bun.js/bindings/webcore/HTTPHeaderMap.cpp @@ -54,9 +54,9 @@ HTTPHeaderMap HTTPHeaderMap::isolatedCopy() const& HTTPHeaderMap HTTPHeaderMap::isolatedCopy() && { HTTPHeaderMap map; - map.m_commonHeaders = crossThreadCopy(WTFMove(m_commonHeaders)); - map.m_uncommonHeaders = crossThreadCopy(WTFMove(m_uncommonHeaders)); - map.m_setCookieHeaders = crossThreadCopy(WTFMove(m_setCookieHeaders)); + map.m_commonHeaders = crossThreadCopy(WTF::move(m_commonHeaders)); + map.m_uncommonHeaders = crossThreadCopy(WTF::move(m_uncommonHeaders)); + map.m_setCookieHeaders = crossThreadCopy(WTF::move(m_setCookieHeaders)); return map; } diff --git a/src/bun.js/bindings/webcore/HTTPHeaderMap.h b/src/bun.js/bindings/webcore/HTTPHeaderMap.h index 126170bf2e40cd..86c67ff4e82a0f 100644 --- a/src/bun.js/bindings/webcore/HTTPHeaderMap.h +++ b/src/bun.js/bindings/webcore/HTTPHeaderMap.h @@ -41,7 +41,7 @@ class HTTPHeaderMap { String value; CommonHeader isolatedCopy() const & { return { key, value.isolatedCopy() }; } - CommonHeader isolatedCopy() && { return { key, WTFMove(value).isolatedCopy() }; } + CommonHeader isolatedCopy() && { return { key, WTF::move(value).isolatedCopy() }; } template void encode(Encoder &) const; template static std::optional decode(Decoder &); @@ -60,7 +60,7 @@ class HTTPHeaderMap { String value; UncommonHeader isolatedCopy() const & { return { key.isolatedCopy(), value.isolatedCopy() }; } - UncommonHeader isolatedCopy() && { return { WTFMove(key).isolatedCopy(), WTFMove(value).isolatedCopy() }; } + UncommonHeader isolatedCopy() && { return { WTF::move(key).isolatedCopy(), WTF::move(value).isolatedCopy() }; } template void encode(Encoder &) const; template static std::optional decode(Decoder &); @@ -261,7 +261,7 @@ class HTTPHeaderMap { } template void encode(Encoder &) const; - template static WARN_UNUSED_RETURN bool decode(Decoder &, HTTPHeaderMap &); + template WARN_UNUSED_RETURN static bool decode(Decoder &, HTTPHeaderMap &); void setUncommonHeader(const String &name, const String &value); void setUncommonHeaderCloneName(const StringView name, const String &value); @@ -290,7 +290,7 @@ auto HTTPHeaderMap::CommonHeader::decode(Decoder &decoder) -> std::optional @@ -310,7 +310,7 @@ auto HTTPHeaderMap::UncommonHeader::decode(Decoder &decoder) -> std::optional diff --git a/src/bun.js/bindings/webcore/HTTPParsers.h b/src/bun.js/bindings/webcore/HTTPParsers.h index b12b1b284bcc6f..c966cb7896b35b 100644 --- a/src/bun.js/bindings/webcore/HTTPParsers.h +++ b/src/bun.js/bindings/webcore/HTTPParsers.h @@ -146,7 +146,7 @@ inline bool isHTTPSpace(char16_t character) // if (!isValidHTTPToken(token)) // return false; -// set.add(WTFMove(token)); +// set.add(WTF::move(token)); // return true; // } diff --git a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp b/src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp index 89ce0bba396f19..0149bf9019d222 100644 --- a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp +++ b/src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp @@ -56,7 +56,7 @@ void IdentifierEventListenerMap::replace(const JSC::Identifier& eventType, Event ASSERT(index != notFound); auto& registeredListener = listeners->at(index); registeredListener->markAsRemoved(); - registeredListener = SimpleRegisteredEventListener::create(WTFMove(newListener), once); + registeredListener = SimpleRegisteredEventListener::create(WTF::move(newListener), once); } bool IdentifierEventListenerMap::add(const JSC::Identifier& eventType, Ref&& listener, bool once) @@ -66,11 +66,11 @@ bool IdentifierEventListenerMap::add(const JSC::Identifier& eventType, Refappend(SimpleRegisteredEventListener::create(WTFMove(listener), once)); + listeners->append(SimpleRegisteredEventListener::create(WTF::move(listener), once)); return true; } - m_entries.append({ eventType, SimpleEventListenerVector { SimpleRegisteredEventListener::create(WTFMove(listener), once) } }); + m_entries.append({ eventType, SimpleEventListenerVector { SimpleRegisteredEventListener::create(WTF::move(listener), once) } }); return true; } @@ -81,11 +81,11 @@ bool IdentifierEventListenerMap::prepend(const JSC::Identifier& eventType, Refinsert(0, SimpleRegisteredEventListener::create(WTFMove(listener), once)); + listeners->insert(0, SimpleRegisteredEventListener::create(WTF::move(listener), once)); return true; } - m_entries.append({ eventType, SimpleEventListenerVector { SimpleRegisteredEventListener::create(WTFMove(listener), once) } }); + m_entries.append({ eventType, SimpleEventListenerVector { SimpleRegisteredEventListener::create(WTF::move(listener), once) } }); return true; } diff --git a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.h b/src/bun.js/bindings/webcore/IdentifierEventListenerMap.h index d78f7ec11c7b38..cb28c1e869635f 100644 --- a/src/bun.js/bindings/webcore/IdentifierEventListenerMap.h +++ b/src/bun.js/bindings/webcore/IdentifierEventListenerMap.h @@ -14,7 +14,7 @@ class SimpleRegisteredEventListener : public RefCounted create(Ref&& listener, bool once) { - return adoptRef(*new SimpleRegisteredEventListener(WTFMove(listener), once)); + return adoptRef(*new SimpleRegisteredEventListener(WTF::move(listener), once)); } EventListener& callback() const { return m_callback; } @@ -27,7 +27,7 @@ class SimpleRegisteredEventListener : public RefCounted&& listener, bool once) : m_isOnce(once) , m_wasRemoved(false) - , m_callback(WTFMove(listener)) + , m_callback(WTF::move(listener)) { } diff --git a/src/bun.js/bindings/webcore/JSAbortController.cpp b/src/bun.js/bindings/webcore/JSAbortController.cpp index 14f2e4f3782c22..b488219e97636b 100644 --- a/src/bun.js/bindings/webcore/JSAbortController.cpp +++ b/src/bun.js/bindings/webcore/JSAbortController.cpp @@ -109,7 +109,7 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSAbortControllerDOMConstruct if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -155,7 +155,7 @@ void JSAbortControllerPrototype::finishCreation(VM& vm) const ClassInfo JSAbortController::s_info = { "AbortController"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAbortController) }; JSAbortController::JSAbortController(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -217,7 +217,7 @@ static inline JSC::EncodedJSValue jsAbortControllerPrototypeFunction_abortBody(J EnsureStillAliveScope argument0 = callFrame->argument(0); auto reason = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.abort(*jsCast(lexicalGlobalObject), WTFMove(reason)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.abort(*jsCast(lexicalGlobalObject), WTF::move(reason)); }))); } JSC_DEFINE_HOST_FUNCTION(jsAbortControllerPrototypeFunction_abort, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -308,7 +308,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, AbortController& impl) diff --git a/src/bun.js/bindings/webcore/JSAbortController.h b/src/bun.js/bindings/webcore/JSAbortController.h index 483328aa88d16a..8384075778b14f 100644 --- a/src/bun.js/bindings/webcore/JSAbortController.h +++ b/src/bun.js/bindings/webcore/JSAbortController.h @@ -32,7 +32,7 @@ class JSAbortController : public JSDOMWrapper { static JSAbortController* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { auto& vm = JSC::getVM(globalObject); - JSAbortController* ptr = new (NotNull, JSC::allocateCell(vm)) JSAbortController(structure, *globalObject, WTFMove(impl)); + JSAbortController* ptr = new (NotNull, JSC::allocateCell(vm)) JSAbortController(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.cpp b/src/bun.js/bindings/webcore/JSAbortSignal.cpp index 453f3376758a18..0e7ef079dff77b 100644 --- a/src/bun.js/bindings/webcore/JSAbortSignal.cpp +++ b/src/bun.js/bindings/webcore/JSAbortSignal.cpp @@ -166,7 +166,7 @@ void JSAbortSignalPrototype::finishCreation(VM& vm) const ClassInfo JSAbortSignal::s_info = { "AbortSignal"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAbortSignal) }; JSAbortSignal::JSAbortSignal(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -273,7 +273,7 @@ static inline JSC::EncodedJSValue jsAbortSignalConstructorFunction_abortBody(JSC EnsureStillAliveScope argument0 = callFrame->argument(0); auto reason = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::abort(*jsCast(lexicalGlobalObject), *context, WTFMove(reason))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::abort(*jsCast(lexicalGlobalObject), *context, WTF::move(reason))))); } JSC_DEFINE_HOST_FUNCTION(jsAbortSignalConstructorFunction_abort, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -295,7 +295,7 @@ static inline JSC::EncodedJSValue jsAbortSignalConstructorFunction_timeoutBody(J EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto milliseconds = convert>(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::timeout(*context, WTFMove(milliseconds))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::timeout(*context, WTF::move(milliseconds))))); } JSC_DEFINE_HOST_FUNCTION(jsAbortSignalConstructorFunction_timeout, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -331,7 +331,7 @@ static inline JSC::EncodedJSValue jsAbortSignalConstructorFunction_anyBody(JSC:: i++; }); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::any(*context, WTFMove(signals))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, AbortSignal::any(*context, WTF::move(signals))))); } JSC_DEFINE_HOST_FUNCTION(jsAbortSignalConstructorFunction_any, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -441,7 +441,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, AbortSignal& impl) diff --git a/src/bun.js/bindings/webcore/JSAbortSignal.h b/src/bun.js/bindings/webcore/JSAbortSignal.h index 4de1f1b746e166..90911cfc28df17 100644 --- a/src/bun.js/bindings/webcore/JSAbortSignal.h +++ b/src/bun.js/bindings/webcore/JSAbortSignal.h @@ -34,7 +34,7 @@ class JSAbortSignal : public JSEventTarget { static JSAbortSignal* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { auto& vm = JSC::getVM(globalObject); - JSAbortSignal* ptr = new (NotNull, JSC::allocateCell(vm)) JSAbortSignal(structure, *globalObject, WTFMove(impl)); + JSAbortSignal* ptr = new (NotNull, JSC::allocateCell(vm)) JSAbortSignal(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp index ae86b895dcdc68..a53e47a2936920 100644 --- a/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp +++ b/src/bun.js/bindings/webcore/JSBroadcastChannel.cpp @@ -118,11 +118,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBroadcastChannelDOMCon EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto name = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = BroadcastChannel::create(*context, WTFMove(name)); + auto object = BroadcastChannel::create(*context, WTF::move(name)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -244,7 +244,7 @@ void JSBroadcastChannelPrototype::finishCreation(VM& vm, JSGlobalObject* globalO const ClassInfo JSBroadcastChannel::s_info = { "BroadcastChannel"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBroadcastChannel) }; JSBroadcastChannel::JSBroadcastChannel(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -356,7 +356,7 @@ static inline JSC::EncodedJSValue jsBroadcastChannelPrototypeFunction_postMessag EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto message = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTFMove(message)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTF::move(message)); }))); } JSC_DEFINE_HOST_FUNCTION(jsBroadcastChannelPrototypeFunction_postMessage, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -483,7 +483,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, BroadcastChannel& impl) diff --git a/src/bun.js/bindings/webcore/JSBroadcastChannel.h b/src/bun.js/bindings/webcore/JSBroadcastChannel.h index ddf672284d27a2..e59c70d9f422e6 100644 --- a/src/bun.js/bindings/webcore/JSBroadcastChannel.h +++ b/src/bun.js/bindings/webcore/JSBroadcastChannel.h @@ -33,7 +33,7 @@ class JSBroadcastChannel : public JSEventTarget { using DOMWrapped = BroadcastChannel; static JSBroadcastChannel* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSBroadcastChannel* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSBroadcastChannel(structure, *globalObject, WTFMove(impl)); + JSBroadcastChannel* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSBroadcastChannel(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSCloseEvent.cpp b/src/bun.js/bindings/webcore/JSCloseEvent.cpp index 0abd88897b6a00..9c986ad14e4a12 100644 --- a/src/bun.js/bindings/webcore/JSCloseEvent.cpp +++ b/src/bun.js/bindings/webcore/JSCloseEvent.cpp @@ -189,11 +189,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCloseEventDOMConstruct EnsureStillAliveScope argument1 = callFrame->argument(1); auto eventInitDict = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = CloseEvent::create(WTFMove(type), WTFMove(eventInitDict)); + auto object = CloseEvent::create(WTF::move(type), WTF::move(eventInitDict)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -239,7 +239,7 @@ void JSCloseEventPrototype::finishCreation(VM& vm) const ClassInfo JSCloseEvent::s_info = { "CloseEvent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCloseEvent) }; JSCloseEvent::JSCloseEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEvent(structure, globalObject, WTFMove(impl)) + : JSEvent(structure, globalObject, WTF::move(impl)) { } @@ -366,7 +366,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CloseEvent& impl) diff --git a/src/bun.js/bindings/webcore/JSCloseEvent.h b/src/bun.js/bindings/webcore/JSCloseEvent.h index 13dc2300878395..7e534769263898 100644 --- a/src/bun.js/bindings/webcore/JSCloseEvent.h +++ b/src/bun.js/bindings/webcore/JSCloseEvent.h @@ -33,7 +33,7 @@ class JSCloseEvent : public JSEvent { using DOMWrapped = CloseEvent; static JSCloseEvent* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSCloseEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCloseEvent(structure, *globalObject, WTFMove(impl)); + JSCloseEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCloseEvent(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSCookie.cpp b/src/bun.js/bindings/webcore/JSCookie.cpp index a53ff6336ff939..b16f33a9023ff8 100644 --- a/src/bun.js/bindings/webcore/JSCookie.cpp +++ b/src/bun.js/bindings/webcore/JSCookie.cpp @@ -326,7 +326,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCookieDOMConstructor:: auto cookie = cookie_exception.releaseReturnValue(); auto* globalObject = castedThis->globalObject(); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTFMove(cookie)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTF::move(cookie)))); } else if (callFrame->argumentCount() == 1 && callFrame->argument(0).isObject()) { // new Bun.Cooke({ // name: "name", @@ -347,7 +347,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCookieDOMConstructor:: } auto cookie = cookie_exception.releaseReturnValue(); auto* globalObject = castedThis->globalObject(); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTFMove(cookie)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTF::move(cookie)))); } else if (callFrame->argumentCount() >= 2) { // new Bun.Cookie("name", "value", { // domain: "domain", @@ -383,7 +383,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCookieDOMConstructor:: auto cookie = cookie_exception.releaseReturnValue(); auto* globalObject = castedThis->globalObject(); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTFMove(cookie)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(lexicalGlobalObject, globalObject, WTF::move(cookie)))); } return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); @@ -445,7 +445,7 @@ void JSCookiePrototype::finishCreation(VM& vm) const ClassInfo JSCookie::s_info = { "Cookie"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCookie) }; JSCookie::JSCookie(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -547,7 +547,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCookieStaticFunctionParse, (JSGlobalObject * lexicalG RELEASE_AND_RETURN(throwScope, {}); } auto cookie = cookie_exception.releaseReturnValue(); - return JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, defaultGlobalObject(lexicalGlobalObject), WTFMove(cookie))); + return JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, defaultGlobalObject(lexicalGlobalObject), WTF::move(cookie))); } if (!WebCore::isValidHTTPHeaderValue(cookieString)) [[unlikely]] { @@ -563,7 +563,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCookieStaticFunctionParse, (JSGlobalObject * lexicalG auto cookie = cookie_exception.releaseReturnValue(); auto* globalObject = defaultGlobalObject(lexicalGlobalObject); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, globalObject, WTFMove(cookie)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, globalObject, WTF::move(cookie)))); } JSC_DEFINE_HOST_FUNCTION(jsCookieStaticFunctionFrom, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -602,7 +602,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCookieStaticFunctionFrom, (JSGlobalObject * lexicalGl } auto cookie = cookie_exception.releaseReturnValue(); auto* globalObject = jsCast(lexicalGlobalObject); - return JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, globalObject, WTFMove(cookie))); + return JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, globalObject, WTF::move(cookie))); } JSC_DEFINE_HOST_FUNCTION(jsCookieStaticFunctionSerialize, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -968,7 +968,7 @@ void JSCookieOwner::finalize(JSC::Handle handle, void* context) JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Cookie& impl) diff --git a/src/bun.js/bindings/webcore/JSCookie.h b/src/bun.js/bindings/webcore/JSCookie.h index f2f893bf251a5d..1a9268fb12cd1c 100644 --- a/src/bun.js/bindings/webcore/JSCookie.h +++ b/src/bun.js/bindings/webcore/JSCookie.h @@ -11,7 +11,7 @@ class JSCookie : public JSDOMWrapper { using Base = JSDOMWrapper; static JSCookie* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSCookie* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCookie(structure, *globalObject, WTFMove(impl)); + JSCookie* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCookie(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSCookieMap.cpp b/src/bun.js/bindings/webcore/JSCookieMap.cpp index b97bc8aba4e83d..0fe8dd3ce154ee 100644 --- a/src/bun.js/bindings/webcore/JSCookieMap.cpp +++ b/src/bun.js/bindings/webcore/JSCookieMap.cpp @@ -146,9 +146,9 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCookieMapDOMConstructo Vector pair; pair.append(firstStr); pair.append(secondStr); - seqSeq.append(WTFMove(pair)); + seqSeq.append(WTF::move(pair)); } - init = WTFMove(seqSeq); + init = WTF::move(seqSeq); } else { // Handle as record HashMap record; @@ -166,21 +166,21 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCookieMapDOMConstructo record.set(propertyName.string(), valueStr); } - init = WTFMove(record); + init = WTF::move(record); } } else { throwTypeError(lexicalGlobalObject, throwScope, "Invalid initializer type"_s); return {}; } - auto result_exception = CookieMap::create(WTFMove(init)); + auto result_exception = CookieMap::create(WTF::move(init)); if (result_exception.hasException()) { WebCore::propagateException(lexicalGlobalObject, throwScope, result_exception.releaseException()); RELEASE_AND_RETURN(throwScope, {}); } auto result = result_exception.releaseReturnValue(); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, castedThis->globalObject(), WTFMove(result)))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJSNewlyCreated(lexicalGlobalObject, castedThis->globalObject(), WTF::move(result)))); } JSC_ANNOTATE_HOST_FUNCTION(JSCookieMapDOMConstructorConstruct, JSCookieMapDOMConstructor::construct); @@ -229,7 +229,7 @@ void JSCookieMapPrototype::finishCreation(VM& vm) const ClassInfo JSCookieMap::s_info = { "CookieMap"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCookieMap) }; JSCookieMap::JSCookieMap(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -411,7 +411,7 @@ static inline JSC::EncodedJSValue jsCookieMapPrototypeFunction_setBody(JSC::JSGl } auto cookie = cookie_exception.releaseReturnValue(); - impl.set(WTFMove(cookie)); + impl.set(WTF::move(cookie)); return JSValue::encode(jsUndefined()); } @@ -655,7 +655,7 @@ void JSCookieMapOwner::finalize(JSC::Handle handle, void* context) JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CookieMap& impl) diff --git a/src/bun.js/bindings/webcore/JSCookieMap.h b/src/bun.js/bindings/webcore/JSCookieMap.h index 9b16ffcc19ac5d..24158374df9b98 100644 --- a/src/bun.js/bindings/webcore/JSCookieMap.h +++ b/src/bun.js/bindings/webcore/JSCookieMap.h @@ -11,7 +11,7 @@ class JSCookieMap : public JSDOMWrapper { using Base = JSDOMWrapper; static JSCookieMap* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSCookieMap* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCookieMap(structure, *globalObject, WTFMove(impl)); + JSCookieMap* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCookieMap(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSCustomEvent.cpp b/src/bun.js/bindings/webcore/JSCustomEvent.cpp index c764817533c209..bff23a2b3a1735 100644 --- a/src/bun.js/bindings/webcore/JSCustomEvent.cpp +++ b/src/bun.js/bindings/webcore/JSCustomEvent.cpp @@ -172,11 +172,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCustomEventDOMConstruc EnsureStillAliveScope argument1 = callFrame->argument(1); auto eventInitDict = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = CustomEvent::create(type, WTFMove(eventInitDict)); + auto object = CustomEvent::create(type, WTF::move(eventInitDict)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -221,7 +221,7 @@ void JSCustomEventPrototype::finishCreation(VM& vm) const ClassInfo JSCustomEvent::s_info = { "CustomEvent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCustomEvent) }; JSCustomEvent::JSCustomEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEvent(structure, globalObject, WTFMove(impl)) + : JSEvent(structure, globalObject, WTF::move(impl)) { } @@ -290,7 +290,7 @@ static inline JSC::EncodedJSValue jsCustomEventPrototypeFunction_initCustomEvent EnsureStillAliveScope argument3 = callFrame->argument(3); auto detail = argument3.value().isUndefined() ? jsNull() : convert(*lexicalGlobalObject, argument3.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initCustomEvent(type, WTFMove(bubbles), WTFMove(cancelable), WTFMove(detail)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initCustomEvent(type, WTF::move(bubbles), WTF::move(cancelable), WTF::move(detail)); }))); } JSC_DEFINE_HOST_FUNCTION(jsCustomEventPrototypeFunction_initCustomEvent, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -371,7 +371,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); // #endif // } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CustomEvent& impl) diff --git a/src/bun.js/bindings/webcore/JSCustomEvent.h b/src/bun.js/bindings/webcore/JSCustomEvent.h index d32bf98e45fde7..f9dd2ddb862670 100644 --- a/src/bun.js/bindings/webcore/JSCustomEvent.h +++ b/src/bun.js/bindings/webcore/JSCustomEvent.h @@ -33,7 +33,7 @@ class JSCustomEvent : public JSEvent { using DOMWrapped = CustomEvent; static JSCustomEvent* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSCustomEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCustomEvent(structure, *globalObject, WTFMove(impl)); + JSCustomEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCustomEvent(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSDOMConvertRecord.h b/src/bun.js/bindings/webcore/JSDOMConvertRecord.h index 9e2d08b70e22dc..1b5fde39027a36 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertRecord.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertRecord.h @@ -146,7 +146,7 @@ template struct Converter> : DefaultConv auto addResult = resultMap.add(typedKey, result.size()); if (!addResult.isNewEntry) { ASSERT(result[addResult.iterator->value].key == typedKey); - result[addResult.iterator->value].value = WTFMove(typedValue); + result[addResult.iterator->value].value = WTF::move(typedValue); return true; } } @@ -154,7 +154,7 @@ template struct Converter> : DefaultConv UNUSED_VARIABLE(resultMap); // 5. Otherwise, append to result a mapping (typedKey, typedValue). - result.append({ WTFMove(typedKey), WTFMove(typedValue) }); + result.append({ WTF::move(typedKey), WTF::move(typedValue) }); return true; }); @@ -203,7 +203,7 @@ template struct Converter> : DefaultConv auto addResult = resultMap.add(typedKey, result.size()); if (!addResult.isNewEntry) { ASSERT(result[addResult.iterator->value].key == typedKey); - result[addResult.iterator->value].value = WTFMove(typedValue); + result[addResult.iterator->value].value = WTF::move(typedValue); continue; } } @@ -211,7 +211,7 @@ template struct Converter> : DefaultConv UNUSED_VARIABLE(resultMap); // 5. Otherwise, append to result a mapping (typedKey, typedValue). - result.append({ WTFMove(typedKey), WTFMove(typedValue) }); + result.append({ WTF::move(typedKey), WTF::move(typedValue) }); } } diff --git a/src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h b/src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h index 61ac02caff985f..1e38aec6f080be 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertScheduledAction.h @@ -41,7 +41,7 @@ template<> struct Converter : DefaultConverter::convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(scope, nullptr); - return ScheduledAction::create(globalObject.world(), WTFMove(code)); + return ScheduledAction::create(globalObject.world(), WTF::move(code)); } // The value must be an object at this point because no non-object values are callable. diff --git a/src/bun.js/bindings/webcore/JSDOMConvertSequences.h b/src/bun.js/bindings/webcore/JSDOMConvertSequences.h index 8b93310323e019..035e593ecd3743 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertSequences.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertSequences.h @@ -173,7 +173,7 @@ struct GenericSequenceConverter { // auto convertedValue = Converter::convert(*lexicalGlobalObject, nextValue); auto convertedValue = Bun::convertIDL(*lexicalGlobalObject, nextValue, elementCtx); RETURN_IF_EXCEPTION(scope, ); - Traits::append(*lexicalGlobalObject, result, index++, WTFMove(convertedValue)); + Traits::append(*lexicalGlobalObject, result, index++, WTF::move(convertedValue)); RETURN_IF_EXCEPTION(scope, ); }); @@ -182,13 +182,13 @@ struct GenericSequenceConverter { if (index != result.size()) { throwTypeError(&lexicalGlobalObject, scope); } - return WTFMove(result); + return WTF::move(result); } static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, ReturnType&& result) { auto ctx = Bun::DefaultConversionContext {}; - return convert(lexicalGlobalObject, object, WTFMove(result), ctx); + return convert(lexicalGlobalObject, object, WTF::move(result), ctx); } template @@ -205,7 +205,7 @@ struct GenericSequenceConverter { auto convertedValue = Converter::convert(*lexicalGlobalObject, nextValue, std::forward(exceptionThrower)); RETURN_IF_EXCEPTION(scope, ); - Traits::append(*lexicalGlobalObject, result, index++, WTFMove(convertedValue)); + Traits::append(*lexicalGlobalObject, result, index++, WTF::move(convertedValue)); RETURN_IF_EXCEPTION(scope, ); }); @@ -214,7 +214,7 @@ struct GenericSequenceConverter { if (index != result.size()) { throwTypeError(&lexicalGlobalObject, scope); } - return WTFMove(result); + return WTF::move(result); } static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method) @@ -233,7 +233,7 @@ struct GenericSequenceConverter { auto convertedValue = Converter::convert(lexicalGlobalObject, nextValue); RETURN_IF_EXCEPTION(scope, ); - Traits::append(lexicalGlobalObject, result, index++, WTFMove(convertedValue)); + Traits::append(lexicalGlobalObject, result, index++, WTF::move(convertedValue)); RETURN_IF_EXCEPTION(scope, ); }); @@ -242,7 +242,7 @@ struct GenericSequenceConverter { if (index != result.size()) { throwTypeError(&lexicalGlobalObject, scope); } - return WTFMove(result); + return WTF::move(result); } }; @@ -268,7 +268,7 @@ struct NumericSequenceConverter { Traits::append(lexicalGlobalObject, result, i, indexValue.asInt32()); RETURN_IF_EXCEPTION(scope, {}); } - return WTFMove(result); + return WTF::move(result); } ASSERT(indexingType == JSC::DoubleShape); @@ -285,7 +285,7 @@ struct NumericSequenceConverter { RETURN_IF_EXCEPTION(scope, {}); } } - return WTFMove(result); + return WTF::move(result); } static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value) @@ -325,9 +325,9 @@ struct NumericSequenceConverter { RETURN_IF_EXCEPTION(scope, {}); if (!isLengthExact) - RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, WTFMove(result))); + RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, WTF::move(result))); - return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTFMove(result)); + return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTF::move(result)); } static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method) @@ -360,9 +360,9 @@ struct NumericSequenceConverter { RETURN_IF_EXCEPTION(scope, {}); if (!isLengthExact) - RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, method, WTFMove(result))); + RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, method, WTF::move(result))); - return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTFMove(result)); + return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTF::move(result)); } }; @@ -395,7 +395,7 @@ struct SequenceConverter { // auto convertedValue = Converter::convert(lexicalGlobalObject, indexValue); auto convertedValue = Bun::convertIDL(lexicalGlobalObject, indexValue, elementCtx); RETURN_IF_EXCEPTION(scope, {}); - Traits::append(lexicalGlobalObject, result, i, WTFMove(convertedValue)); + Traits::append(lexicalGlobalObject, result, i, WTF::move(convertedValue)); } return result; } @@ -410,7 +410,7 @@ struct SequenceConverter { // auto convertedValue = Converter::convert(lexicalGlobalObject, indexValue); auto convertedValue = Bun::convertIDL(lexicalGlobalObject, indexValue, elementCtx); RETURN_IF_EXCEPTION(scope, {}); - Traits::append(lexicalGlobalObject, result, i, WTFMove(convertedValue)); + Traits::append(lexicalGlobalObject, result, i, WTF::move(convertedValue)); } return result; } @@ -443,7 +443,7 @@ struct SequenceConverter { auto convertedValue = Converter::convert(lexicalGlobalObject, indexValue, std::forward(exceptionThrower)); RETURN_IF_EXCEPTION(scope, {}); - Traits::append(lexicalGlobalObject, result, i, WTFMove(convertedValue)); + Traits::append(lexicalGlobalObject, result, i, WTF::move(convertedValue)); RETURN_IF_EXCEPTION(scope, {}); } return result; @@ -458,7 +458,7 @@ struct SequenceConverter { auto convertedValue = Converter::convert(lexicalGlobalObject, indexValue, std::forward(exceptionThrower)); RETURN_IF_EXCEPTION(scope, {}); - Traits::append(lexicalGlobalObject, result, i, WTFMove(convertedValue)); + Traits::append(lexicalGlobalObject, result, i, WTF::move(convertedValue)); RETURN_IF_EXCEPTION(scope, {}); } return result; diff --git a/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp b/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp index c2d77e7e0c81c0..16c52e6bddd6b2 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp +++ b/src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp @@ -103,7 +103,7 @@ String valueToUSVString(JSGlobalObject& lexicalGlobalObject, JSValue value) auto string = value.toWTFString(&lexicalGlobalObject); RETURN_IF_EXCEPTION(scope, {}); - return replaceUnpairedSurrogatesWithReplacementCharacter(WTFMove(string)); + return replaceUnpairedSurrogatesWithReplacementCharacter(WTF::move(string)); } AtomString valueToUSVAtomString(JSGlobalObject& lexicalGlobalObject, JSValue value) diff --git a/src/bun.js/bindings/webcore/JSDOMConvertUnion.h b/src/bun.js/bindings/webcore/JSDOMConvertUnion.h index 837a9be2928942..0b51201525ea86 100644 --- a/src/bun.js/bindings/webcore/JSDOMConvertUnion.h +++ b/src/bun.js/bindings/webcore/JSDOMConvertUnion.h @@ -208,7 +208,7 @@ template struct Converter> : DefaultConverter struct Converter> : DefaultConverter>::value) ? JSC::JSArrayBuffer::toWrappedAllowShared(vm, value) : JSC::JSArrayBuffer::toWrapped(vm, value); if (arrayBuffer) { if (hasArrayBufferType) - return ConditionalReturner::get(WTFMove(arrayBuffer)).value(); + return ConditionalReturner::get(WTF::move(arrayBuffer)).value(); RELEASE_AND_RETURN(scope, (ConditionalConverter::convert(lexicalGlobalObject, value).value())); } } @@ -239,7 +239,7 @@ template struct Converter> : DefaultConverter>::value) ? JSC::JSArrayBufferView::toWrappedAllowShared(vm, value) : JSC::JSArrayBufferView::toWrapped(vm, value); if (arrayBufferView) { if (hasArrayBufferViewType) - return ConditionalReturner::get(WTFMove(arrayBufferView)).value(); + return ConditionalReturner::get(WTF::move(arrayBufferView)).value(); RELEASE_AND_RETURN(scope, (ConditionalConverter::convert(lexicalGlobalObject, value).value())); } } @@ -252,7 +252,7 @@ template struct Converter> : DefaultConverter::get(WTFMove(dataView)).value(); + return ConditionalReturner::get(WTF::move(dataView)).value(); RELEASE_AND_RETURN(scope, (ConditionalConverter::convert(lexicalGlobalObject, value).value())); } } @@ -280,7 +280,7 @@ template struct Converter> : DefaultConverter FixedVector::Item ASSERT_UNUSED(scope, !!scope.exception() == !value); if (!value) return {}; - result[resultIndex] = WTFMove(*value); + result[resultIndex] = WTF::move(*value); resultIndex++; } diff --git a/src/bun.js/bindings/webcore/JSDOMException.cpp b/src/bun.js/bindings/webcore/JSDOMException.cpp index e33f56fbfbede3..4812c933405e3b 100644 --- a/src/bun.js/bindings/webcore/JSDOMException.cpp +++ b/src/bun.js/bindings/webcore/JSDOMException.cpp @@ -153,11 +153,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMExceptionDOMConstru RETURN_IF_EXCEPTION(throwScope, {}); } - auto object = DOMException::create(WTFMove(message), WTFMove(name)); + auto object = DOMException::create(WTF::move(message), WTF::move(name)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -233,7 +233,7 @@ void JSDOMExceptionPrototype::finishCreation(VM& vm) const ClassInfo JSDOMException::s_info = { "DOMException"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMException) }; JSDOMException::JSDOMException(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -381,7 +381,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); // #endif // } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, DOMException& impl) diff --git a/src/bun.js/bindings/webcore/JSDOMException.h b/src/bun.js/bindings/webcore/JSDOMException.h index 71e72003e12685..41829d950462d6 100644 --- a/src/bun.js/bindings/webcore/JSDOMException.h +++ b/src/bun.js/bindings/webcore/JSDOMException.h @@ -34,7 +34,7 @@ class JSDOMException : public JSDOMWrapper { using Base = JSDOMWrapper; static JSDOMException* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSDOMException* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMException(structure, *globalObject, WTFMove(impl)); + JSDOMException* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMException(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.cpp b/src/bun.js/bindings/webcore/JSDOMFormData.cpp index c6b9683540b4e6..77a0d1cedf03c0 100644 --- a/src/bun.js/bindings/webcore/JSDOMFormData.cpp +++ b/src/bun.js/bindings/webcore/JSDOMFormData.cpp @@ -167,7 +167,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMFormDataDOMConstruc if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -227,7 +227,7 @@ void JSDOMFormDataPrototype::finishCreation(VM& vm) const ClassInfo JSDOMFormData::s_info = { "FormData"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMFormData) }; JSDOMFormData::JSDOMFormData(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -285,7 +285,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_append1Body(JSC EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTF::move(name), WTF::move(value)); }))); } extern "C" BunString Blob__getFileNameString(void* impl); @@ -316,7 +316,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_append2Body(JSC auto filename = argument2.value().isUndefined() ? Blob__getFileNameString(blobValue->impl()).toWTFString(BunString::ZeroCopy) : convert(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTFMove(name), WTFMove(blobValue), WTFMove(filename)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTF::move(name), WTF::move(blobValue), WTF::move(filename)); }))); } static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_appendOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -355,7 +355,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_deleteBody(JSC: EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto name = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.remove(WTFMove(name)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.remove(WTF::move(name)); }))); } JSC_DEFINE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_delete, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -433,7 +433,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_hasBody(JSC::JS EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto name = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.has(WTFMove(name))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.has(WTF::move(name))))); } JSC_DEFINE_HOST_FUNCTION(jsDOMFormDataPrototypeFunction_has, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -454,7 +454,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_set1Body(JSC::J EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTF::move(name), WTF::move(value)); }))); } static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_set2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -483,7 +483,7 @@ static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_set2Body(JSC::J auto filename = argument2.value().isUndefined() ? Blob__getFileNameString(blobValue->impl()).toWTFString(BunString::ZeroCopy) : convert(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTFMove(name), WTFMove(blobValue), WTFMove(filename)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTF::move(name), WTF::move(blobValue), WTF::move(filename)); }))); } static inline JSC::EncodedJSValue jsDOMFormDataPrototypeFunction_setOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -759,7 +759,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, DOMFormData& impl) diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.h b/src/bun.js/bindings/webcore/JSDOMFormData.h index 286e820b1e39d3..d40e88f4c1f235 100644 --- a/src/bun.js/bindings/webcore/JSDOMFormData.h +++ b/src/bun.js/bindings/webcore/JSDOMFormData.h @@ -31,7 +31,7 @@ class JSDOMFormData : public JSDOMWrapper { using Base = JSDOMWrapper; static JSDOMFormData* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSDOMFormData* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMFormData(structure, *globalObject, WTFMove(impl)); + JSDOMFormData* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMFormData(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h b/src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h index 99aa7437e86a68..08abdc9958dd2b 100644 --- a/src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h +++ b/src/bun.js/bindings/webcore/JSDOMOperationReturningPromise.h @@ -49,7 +49,7 @@ class IDLOperationReturningPromise { ASSERT_GC_OBJECT_INHERITS(thisObject, JSClass::info()); // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject and thisObject. - return operation(&lexicalGlobalObject, &callFrame, thisObject, WTFMove(promise)); + return operation(&lexicalGlobalObject, &callFrame, thisObject, WTF::move(promise)); })); } @@ -77,7 +77,7 @@ class IDLOperationReturningPromise { { return JSC::JSValue::encode(callPromiseFunction(lexicalGlobalObject, callFrame, [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, Ref&& promise) { // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject. - return operation(&lexicalGlobalObject, &callFrame, WTFMove(promise)); + return operation(&lexicalGlobalObject, &callFrame, WTF::move(promise)); })); } diff --git a/src/bun.js/bindings/webcore/JSDOMPromise.cpp b/src/bun.js/bindings/webcore/JSDOMPromise.cpp index a8ec36dea61abf..56dd702a27e5cc 100644 --- a/src/bun.js/bindings/webcore/JSDOMPromise.cpp +++ b/src/bun.js/bindings/webcore/JSDOMPromise.cpp @@ -40,7 +40,7 @@ namespace WebCore { auto DOMPromise::whenSettled(std::function&& callback) -> IsCallbackRegistered { - return whenPromiseIsSettled(globalObject(), promise(), WTFMove(callback)); + return whenPromiseIsSettled(globalObject(), promise(), WTF::move(callback)); } auto DOMPromise::whenPromiseIsSettled(JSDOMGlobalObject* globalObject, JSC::JSObject* promise, Function&& callback) -> IsCallbackRegistered @@ -48,7 +48,7 @@ auto DOMPromise::whenPromiseIsSettled(JSDOMGlobalObject* globalObject, JSC::JSOb auto& lexicalGlobalObject = *globalObject; auto& vm = lexicalGlobalObject.vm(); JSLockHolder lock(vm); - auto* handler = JSC::JSNativeStdFunction::create(vm, globalObject, 1, String {}, [callback = WTFMove(callback)](JSGlobalObject*, CallFrame*) mutable { + auto* handler = JSC::JSNativeStdFunction::create(vm, globalObject, 1, String {}, [callback = WTF::move(callback)](JSGlobalObject*, CallFrame*) mutable { callback(); return JSC::JSValue::encode(JSC::jsUndefined()); }); diff --git a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp b/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp index e4799696e3e266..e26b6bb831ba90 100644 --- a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp +++ b/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp @@ -61,7 +61,7 @@ void DeferredPromise::callFunction(JSGlobalObject& lexicalGlobalObject, ResolveM // if (activeDOMObjectsAreSuspended()) { // JSC::Strong strongResolution(lexicalGlobalObject.vm(), resolution); // ASSERT(scriptExecutionContext()->eventLoop().isSuspended()); - // scriptExecutionContext()->eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, mode, strongResolution = WTFMove(strongResolution)]() mutable { + // scriptExecutionContext()->eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, mode, strongResolution = WTF::move(strongResolution)]() mutable { // if (shouldIgnoreRequestToFulfill()) // return; @@ -97,13 +97,13 @@ void DeferredPromise::whenSettled(Function&& callback) return; // if (activeDOMObjectsAreSuspended()) { - // scriptExecutionContext()->eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, callback = WTFMove(callback)]() mutable { - // whenSettled(WTFMove(callback)); + // scriptExecutionContext()->eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = Ref { *this }, callback = WTF::move(callback)]() mutable { + // whenSettled(WTF::move(callback)); // }); // return; // } - DOMPromise::whenPromiseIsSettled(globalObject(), deferred(), WTFMove(callback)); + DOMPromise::whenPromiseIsSettled(globalObject(), deferred(), WTF::move(callback)); } void DeferredPromise::reject(RejectAsHandled rejectAsHandled) @@ -165,7 +165,7 @@ void DeferredPromise::reject(Exception exception, RejectAsHandled rejectAsHandle return; } - auto error = createDOMException(lexicalGlobalObject, WTFMove(exception)); + auto error = createDOMException(lexicalGlobalObject, WTF::move(exception)); if (scope.exception()) [[unlikely]] { handleUncaughtException(scope, lexicalGlobalObject); return; @@ -273,7 +273,7 @@ void fulfillPromiseWithArrayBuffer(Ref&& promise, ArrayBuffer* void fulfillPromiseWithArrayBuffer(Ref&& promise, const void* data, size_t length) { - fulfillPromiseWithArrayBuffer(WTFMove(promise), ArrayBuffer::tryCreate({ reinterpret_cast(data), length }).get()); + fulfillPromiseWithArrayBuffer(WTF::move(promise), ArrayBuffer::tryCreate({ reinterpret_cast(data), length }).get()); } bool DeferredPromise::handleTerminationExceptionIfNeeded(CatchScope& scope, JSDOMGlobalObject& lexicalGlobalObject) diff --git a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h b/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h index aa2070ee6f0820..67f58839be7fe2 100644 --- a/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h +++ b/src/bun.js/bindings/webcore/JSDOMPromiseDeferred.h @@ -237,12 +237,12 @@ class DOMPromiseDeferredBase { public: DOMPromiseDeferredBase(Ref&& genericPromise) - : m_promise(WTFMove(genericPromise)) + : m_promise(WTF::move(genericPromise)) { } DOMPromiseDeferredBase(DOMPromiseDeferredBase&& promise) - : m_promise(WTFMove(promise.m_promise)) + : m_promise(WTF::move(promise.m_promise)) { } @@ -259,7 +259,7 @@ class DOMPromiseDeferredBase { DOMPromiseDeferredBase& operator=(DOMPromiseDeferredBase&& other) { - m_promise = WTFMove(other.m_promise); + m_promise = WTF::move(other.m_promise); return *this; } @@ -284,7 +284,7 @@ class DOMPromiseDeferredBase { void whenSettled(Function&& function) { - m_promise->whenSettled(WTFMove(function)); + m_promise->whenSettled(WTF::move(function)); } protected: @@ -390,7 +390,7 @@ using BindingPromiseFunction = JSC::EncodedJSValue(JSC::JSGlobalObject*, JSC::Ca template inline void bindingPromiseFunctionAdapter(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, Ref&& promise) { - bindingFunction(&lexicalGlobalObject, &callFrame, WTFMove(promise)); + bindingFunction(&lexicalGlobalObject, &callFrame, WTF::move(promise)); } template diff --git a/src/bun.js/bindings/webcore/JSDOMURL.cpp b/src/bun.js/bindings/webcore/JSDOMURL.cpp index ef5b82ab2dd375..98e786a9420be5 100644 --- a/src/bun.js/bindings/webcore/JSDOMURL.cpp +++ b/src/bun.js/bindings/webcore/JSDOMURL.cpp @@ -162,11 +162,11 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDOMURLDOMConstructor::const EnsureStillAliveScope argument1 = callFrame->argument(1); auto base = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = base.isEmpty() ? DOMURL::create(WTFMove(url)) : DOMURL::create(WTFMove(url), WTFMove(base)); + auto object = base.isEmpty() ? DOMURL::create(WTF::move(url)) : DOMURL::create(WTF::move(url), WTF::move(base)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -239,7 +239,7 @@ void JSDOMURLPrototype::finishCreation(VM& vm) const ClassInfo JSDOMURL::s_info = { "URL"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMURL) }; JSDOMURL::JSDOMURL(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -300,7 +300,7 @@ static inline bool setJSDOMURL_hrefSetter(JSGlobalObject& lexicalGlobalObject, J auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setHref(WTFMove(nativeValue)); + return impl.setHref(WTF::move(nativeValue)); }); return true; } @@ -345,7 +345,7 @@ static inline bool setJSDOMURL_protocolSetter(JSGlobalObject& lexicalGlobalObjec auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setProtocol(WTFMove(nativeValue)); + return impl.setProtocol(WTF::move(nativeValue)); }); return true; } @@ -377,7 +377,7 @@ static inline bool setJSDOMURL_usernameSetter(JSGlobalObject& lexicalGlobalObjec auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setUsername(WTFMove(nativeValue)); + return impl.setUsername(WTF::move(nativeValue)); }); return true; } @@ -409,7 +409,7 @@ static inline bool setJSDOMURL_passwordSetter(JSGlobalObject& lexicalGlobalObjec auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setPassword(WTFMove(nativeValue)); + return impl.setPassword(WTF::move(nativeValue)); }); return true; } @@ -441,7 +441,7 @@ static inline bool setJSDOMURL_hostSetter(JSGlobalObject& lexicalGlobalObject, J auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setHost(WTFMove(nativeValue)); + return impl.setHost(WTF::move(nativeValue)); }); return true; } @@ -473,7 +473,7 @@ static inline bool setJSDOMURL_hostnameSetter(JSGlobalObject& lexicalGlobalObjec auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setHostname(WTFMove(nativeValue)); + return impl.setHostname(WTF::move(nativeValue)); }); return true; } @@ -505,7 +505,7 @@ static inline bool setJSDOMURL_portSetter(JSGlobalObject& lexicalGlobalObject, J auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setPort(WTFMove(nativeValue)); + return impl.setPort(WTF::move(nativeValue)); }); return true; } @@ -537,7 +537,7 @@ static inline bool setJSDOMURL_pathnameSetter(JSGlobalObject& lexicalGlobalObjec auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setPathname(WTFMove(nativeValue)); + return impl.setPathname(WTF::move(nativeValue)); }); return true; } @@ -569,7 +569,7 @@ static inline bool setJSDOMURL_hashSetter(JSGlobalObject& lexicalGlobalObject, J auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setHash(WTFMove(nativeValue)); + return impl.setHash(WTF::move(nativeValue)); }); return true; } @@ -601,7 +601,7 @@ static inline bool setJSDOMURL_searchSetter(JSGlobalObject& lexicalGlobalObject, auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setSearch(WTFMove(nativeValue)); + return impl.setSearch(WTF::move(nativeValue)); }); return true; } @@ -643,7 +643,7 @@ static inline JSC::EncodedJSValue jsDOMURLConstructorFunction_parseBody(JSC::JSG EnsureStillAliveScope argument1 = callFrame->argument(1); auto base = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, DOMURL::parse(WTFMove(url), WTFMove(base))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *jsCast(lexicalGlobalObject), throwScope, DOMURL::parse(WTF::move(url), WTF::move(base))))); } JSC_DEFINE_HOST_FUNCTION(jsDOMURLConstructorFunction_parse, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -665,7 +665,7 @@ static inline JSC::EncodedJSValue jsDOMURLConstructorFunction_canParseBody(JSC:: EnsureStillAliveScope argument1 = callFrame->argument(1); auto base = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, DOMURL::canParse(WTFMove(url), WTFMove(base))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, DOMURL::canParse(WTF::move(url), WTF::move(base))))); } JSC_DEFINE_HOST_FUNCTION(jsDOMURLConstructorFunction_canParse, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -717,7 +717,7 @@ static inline JSC::EncodedJSValue jsDOMURLConstructorFunction_revokeObjectURLBod // EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); // auto url = convert(*lexicalGlobalObject, argument0.value()); // RETURN_IF_EXCEPTION(throwScope, {}); - // RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return DOMURL::revokeObjectURL(*context, WTFMove(url)); }))); + // RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return DOMURL::revokeObjectURL(*context, WTF::move(url)); }))); } JSC_DEFINE_HOST_FUNCTION(jsDOMURLConstructorFunction_revokeObjectURL, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -854,7 +854,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, DOMURL& impl) diff --git a/src/bun.js/bindings/webcore/JSDOMURL.h b/src/bun.js/bindings/webcore/JSDOMURL.h index 54e38cdc4b5368..22e97431748fb8 100644 --- a/src/bun.js/bindings/webcore/JSDOMURL.h +++ b/src/bun.js/bindings/webcore/JSDOMURL.h @@ -31,7 +31,7 @@ class WEBCORE_EXPORT JSDOMURL : public JSDOMWrapper { using Base = JSDOMWrapper; static JSDOMURL* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSDOMURL* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMURL(structure, *globalObject, WTFMove(impl)); + JSDOMURL* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSDOMURL(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.cpp b/src/bun.js/bindings/webcore/JSErrorEvent.cpp index ae464e73fade40..61299b84607751 100644 --- a/src/bun.js/bindings/webcore/JSErrorEvent.cpp +++ b/src/bun.js/bindings/webcore/JSErrorEvent.cpp @@ -218,11 +218,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSErrorEventDOMConstruct EnsureStillAliveScope argument1 = callFrame->argument(1); auto eventInitDict = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = ErrorEvent::create(type, WTFMove(eventInitDict)); + auto object = ErrorEvent::create(type, WTF::move(eventInitDict)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -270,7 +270,7 @@ void JSErrorEventPrototype::finishCreation(VM& vm) const ClassInfo JSErrorEvent::s_info = { "ErrorEvent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSErrorEvent) }; JSErrorEvent::JSErrorEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEvent(structure, globalObject, WTFMove(impl)) + : JSEvent(structure, globalObject, WTF::move(impl)) { } @@ -444,7 +444,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // // by adding the SkipVTableValidation attribute to the interface IDL definition // // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); // #endif - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, ErrorEvent& impl) diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.h b/src/bun.js/bindings/webcore/JSErrorEvent.h index 5f8bbd80264949..8e285d98783540 100644 --- a/src/bun.js/bindings/webcore/JSErrorEvent.h +++ b/src/bun.js/bindings/webcore/JSErrorEvent.h @@ -34,7 +34,7 @@ class JSErrorEvent : public JSEvent { using DOMWrapped = ErrorEvent; static JSErrorEvent* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSErrorEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSErrorEvent(structure, *globalObject, WTFMove(impl)); + JSErrorEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSErrorEvent(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSEvent.cpp b/src/bun.js/bindings/webcore/JSEvent.cpp index 1a59d7200fc395..63ac7b031eee1f 100644 --- a/src/bun.js/bindings/webcore/JSEvent.cpp +++ b/src/bun.js/bindings/webcore/JSEvent.cpp @@ -166,11 +166,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventDOMConstructor::c RETURN_IF_EXCEPTION(throwScope, {}); auto eventInitDict = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = Event::create(WTFMove(type), WTFMove(eventInitDict)); + auto object = Event::create(WTF::move(type), WTF::move(eventInitDict)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -247,7 +247,7 @@ const ClassInfo JSEvent::s_info = { "Event"_s, &Base::s_info, &JSEventTable CREATE_METHOD_TABLE(JSEvent) }; JSEvent::JSEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -365,7 +365,7 @@ static inline bool setJSEvent_cancelBubbleSetter(JSGlobalObject& lexicalGlobalOb auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setCancelBubble(WTFMove(nativeValue)); + return impl.setCancelBubble(WTF::move(nativeValue)); }); return true; } @@ -490,7 +490,7 @@ static inline bool setJSEvent_returnValueSetter(JSGlobalObject& lexicalGlobalObj auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setLegacyReturnValue(WTFMove(nativeValue)); + return impl.setLegacyReturnValue(WTF::move(nativeValue)); }); return true; } @@ -578,7 +578,7 @@ static inline JSC::EncodedJSValue jsEventPrototypeFunction_initEventBody(JSC::JS EnsureStillAliveScope argument2 = callFrame->argument(2); auto cancelable = convert(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initEvent(WTFMove(type), WTFMove(bubbles), WTFMove(cancelable)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initEvent(WTF::move(type), WTF::move(bubbles), WTF::move(cancelable)); }))); } JSC_DEFINE_HOST_FUNCTION(jsEventPrototypeFunction_initEvent, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) diff --git a/src/bun.js/bindings/webcore/JSEvent.h b/src/bun.js/bindings/webcore/JSEvent.h index 77f324eb94e121..9f963dc134b470 100644 --- a/src/bun.js/bindings/webcore/JSEvent.h +++ b/src/bun.js/bindings/webcore/JSEvent.h @@ -32,7 +32,7 @@ class JSEvent : public JSDOMWrapper { using Base = JSDOMWrapper; static JSEvent* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEvent(structure, *globalObject, WTFMove(impl)); + JSEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEvent(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/bun.js/bindings/webcore/JSEventEmitter.cpp index 1ff73c6a2eea0e..4c405a03c3bf4e 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitter.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitter.cpp @@ -116,7 +116,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventEmitterDOMConstru object->setMaxListeners(maxListeners.toUInt32(lexicalGlobalObject)); } static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -210,7 +210,7 @@ void JSEventEmitterPrototype::finishCreation(VM& vm) const ClassInfo JSEventEmitter::s_info = { "EventEmitter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEventEmitter) }; JSEventEmitter::JSEventEmitter(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -275,13 +275,13 @@ inline JSC::EncodedJSValue JSEventEmitter::addListener(JSC::JSGlobalObject* lexi args.append(argument0.value()); args.append(argument1.value()); - JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.emitForBindings(WTFMove(newListenerEventType), WTFMove(args)); })); + JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.emitForBindings(WTF::move(newListenerEventType), WTF::move(args)); })); RETURN_IF_EXCEPTION(throwScope, {}); // then, add the listener auto listener = convert>>(*lexicalGlobalObject, argument1.value(), *castedThis, [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeObjectError(lexicalGlobalObject, scope, 1, "listener"_s, "EventEmitter"_s, "addListener"_s); }); RETURN_IF_EXCEPTION(throwScope, {}); - JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTFMove(eventType), WTFMove(listener), once, prepend); })); + JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTF::move(eventType), WTF::move(listener), once, prepend); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); @@ -387,7 +387,7 @@ inline JSC::EncodedJSValue JSEventEmitter::removeListener(JSC::JSGlobalObject* l EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto listener = convert>>(*lexicalGlobalObject, argument1.value(), *castedThis, [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeObjectError(lexicalGlobalObject, scope, 1, "listener"_s, "EventEmitter"_s, "removeListener"_s); }); RETURN_IF_EXCEPTION(throwScope, {}); - JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeListenerForBindings(WTFMove(eventType), WTFMove(listener)); })); + JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeListenerForBindings(WTF::move(eventType), WTF::move(listener)); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); impl.setThisObject(actualThis); @@ -413,7 +413,7 @@ static inline JSC::EncodedJSValue jsEventEmitterPrototypeFunction_removeAllListe EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto eventType = argument0.value().toPropertyKey(lexicalGlobalObject); RETURN_IF_EXCEPTION(throwScope, {}); - JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeAllListenersForBindings(WTFMove(eventType)); })); + JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeAllListenersForBindings(WTF::move(eventType)); })); RETURN_IF_EXCEPTION(throwScope, {}); impl.setThisObject(actualThis); RELEASE_AND_RETURN(throwScope, JSValue::encode(actualThis)); @@ -456,7 +456,7 @@ static inline JSC::EncodedJSValue jsEventEmitterPrototypeFunction_eventNamesBody for (auto& name : impl.getEventNames()) { args.append(JSC::identifierToSafePublicJSValue(vm, name)); } - auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTFMove(args)); + auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTF::move(args)); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(array)); } @@ -496,7 +496,7 @@ static inline JSC::EncodedJSValue jsEventEmitterPrototypeFunction_listenersBody( for (auto* listener : impl.getListeners(eventType)) { args.append(listener); } - auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTFMove(args)); + auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTF::move(args)); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(array)); } @@ -586,7 +586,7 @@ JSC_DEFINE_HOST_FUNCTION(Events_functionGetEventListeners, for (auto* listener : impl.getListeners(eventType)) { args.append(listener); } - auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTFMove(args)); + auto array = JSC::constructArray(lexicalGlobalObject, static_cast(nullptr), WTF::move(args)); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(array)); } @@ -652,7 +652,7 @@ JSC_DEFINE_HOST_FUNCTION(Events_functionOn, EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto listener = convert>>(*lexicalGlobalObject, argument2.value(), *argument0, [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeObjectError(lexicalGlobalObject, scope, 2, "listener"_s, "EventEmitter"_s, "removeListener"_s); }); RETURN_IF_EXCEPTION(throwScope, {}); - auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTFMove(eventType), WTFMove(listener), false, false); })); + auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addListenerForBindings(WTF::move(eventType), WTF::move(listener), false, false); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(argument0, argument2.value()); return result; diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.h b/src/bun.js/bindings/webcore/JSEventEmitter.h index 83d4467028afb1..f0c588327eba64 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitter.h +++ b/src/bun.js/bindings/webcore/JSEventEmitter.h @@ -17,7 +17,7 @@ class JSEventEmitter : public JSDOMWrapper { using Base = JSDOMWrapper; static JSEventEmitter* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSEventEmitter* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEventEmitter(structure, *globalObject, WTFMove(impl)); + JSEventEmitter* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEventEmitter(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp b/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp index 3a174ce480f327..924ee30bb5fbb7 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp @@ -22,7 +22,7 @@ using namespace JSC; JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& value) { - return createWrapper(globalObject, WTFMove(value)); + return createWrapper(globalObject, WTF::move(value)); } EventEmitter* JSEventEmitter::toWrapped(VM& vm, JSValue value) @@ -72,7 +72,7 @@ JSEventEmitter* jsEventEmitterCastFast(VM& vm, JSC::JSGlobalObject* lexicalGloba impl->setThisObject(thisObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto result = toJSNewlyCreated>(*lexicalGlobalObject, *globalObject, throwScope, WTFMove(impl)); + auto result = toJSNewlyCreated>(*lexicalGlobalObject, *globalObject, throwScope, WTF::move(impl)); thisObject->putDirect(vm, name, result, 0); diff --git a/src/bun.js/bindings/webcore/JSEventTarget.cpp b/src/bun.js/bindings/webcore/JSEventTarget.cpp index d1fed97ce78d59..f2b75d165bee4d 100644 --- a/src/bun.js/bindings/webcore/JSEventTarget.cpp +++ b/src/bun.js/bindings/webcore/JSEventTarget.cpp @@ -114,7 +114,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventTargetDOMConstruc if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -161,7 +161,7 @@ void JSEventTargetPrototype::finishCreation(VM& vm) const ClassInfo JSEventTarget::s_info = { "EventTarget"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSEventTarget) }; JSEventTarget::JSEventTarget(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -238,12 +238,12 @@ static inline JSC::EncodedJSValue jsEventTargetPrototypeFunction_addEventListene JSObject& target = *castedThis; errorInstance->putDirect(vm, vm.propertyNames->target, &target); RETURN_IF_EXCEPTION(throwScope, {}); - errorInstance->putDirect(vm, vm.propertyNames->type, jsString(vm, WTFMove(type))); + errorInstance->putDirect(vm, vm.propertyNames->type, jsString(vm, WTF::move(type))); Bun::Process::emitWarningErrorInstance(lexicalGlobalObject, errorInstance); if (throwScope.exception()) [[unlikely]] throwScope.clearException(); } - auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addEventListenerForBindings(WTFMove(type), WTFMove(listener), WTFMove(options)); })); + auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addEventListenerForBindings(WTF::move(type), WTF::move(listener), WTF::move(options)); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); return result; @@ -272,7 +272,7 @@ static inline JSC::EncodedJSValue jsEventTargetPrototypeFunction_removeEventList EnsureStillAliveScope argument2 = callFrame->argument(2); auto options = argument2.value().isUndefined() ? false : convert, IDLBoolean>>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeEventListenerForBindings(WTFMove(type), WTFMove(listener), WTFMove(options)); })); + auto result = JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.removeEventListenerForBindings(WTF::move(type), WTF::move(listener), WTF::move(options)); })); RETURN_IF_EXCEPTION(throwScope, {}); vm.writeBarrier(&static_cast(*castedThis), argument1.value()); return result; diff --git a/src/bun.js/bindings/webcore/JSEventTarget.h b/src/bun.js/bindings/webcore/JSEventTarget.h index f8b2f99d14824b..a29c68e61f9505 100644 --- a/src/bun.js/bindings/webcore/JSEventTarget.h +++ b/src/bun.js/bindings/webcore/JSEventTarget.h @@ -36,7 +36,7 @@ class JSEventTarget : public JSDOMWrapper { using Base = JSDOMWrapper; static JSEventTarget* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSEventTarget* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEventTarget(structure, *globalObject, WTFMove(impl)); + JSEventTarget* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSEventTarget(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp b/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp index 368a57c74b882e..e30cd3033dc0e9 100644 --- a/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp +++ b/src/bun.js/bindings/webcore/JSEventTargetCustom.cpp @@ -47,7 +47,7 @@ using namespace JSC; JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& value) { - return createWrapper(globalObject, WTFMove(value)); + return createWrapper(globalObject, WTF::move(value)); } EventTarget* JSEventTarget::toWrapped(VM& vm, JSValue value) diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp index 24c94caf95d2aa..e3ab16c356ea2f 100644 --- a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp +++ b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp @@ -136,7 +136,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFetchHeadersDOMConstru if (argument0.value() && !argument0.value().isUndefined()) { if (auto* existingJsFetchHeaders = jsDynamicCast(argument0.value())) { auto newHeaders = FetchHeaders::create(existingJsFetchHeaders->wrapped()); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(newHeaders)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(newHeaders)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -147,11 +147,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFetchHeadersDOMConstru } RETURN_IF_EXCEPTION(throwScope, {}); - auto object = FetchHeaders::create(WTFMove(init)); + auto object = FetchHeaders::create(WTF::move(init)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -331,7 +331,7 @@ void JSFetchHeadersPrototype::finishCreation(VM& vm) const ClassInfo JSFetchHeaders::s_info = { "Headers"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFetchHeaders) }; JSFetchHeaders::JSFetchHeaders(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -401,7 +401,7 @@ static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_appendBody(JSC EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTF::move(name), WTF::move(value)); }))); } /** @@ -503,7 +503,7 @@ static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_setBody(JSC::J EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTF::move(name), WTF::move(value)); }))); } JSC_DEFINE_HOST_FUNCTION(jsFetchHeadersPrototypeFunction_set, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -760,7 +760,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, FetchHeaders& impl) diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.h b/src/bun.js/bindings/webcore/JSFetchHeaders.h index 46e52f703c930a..33ba3640987b4e 100644 --- a/src/bun.js/bindings/webcore/JSFetchHeaders.h +++ b/src/bun.js/bindings/webcore/JSFetchHeaders.h @@ -31,7 +31,7 @@ class JSFetchHeaders : public JSDOMWrapper { using Base = JSDOMWrapper; static JSFetchHeaders* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSFetchHeaders* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSFetchHeaders(structure, *globalObject, WTFMove(impl)); + JSFetchHeaders* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSFetchHeaders(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSMIMEType.cpp b/src/bun.js/bindings/webcore/JSMIMEType.cpp index 57edf530823efd..0f9b9677413283 100644 --- a/src/bun.js/bindings/webcore/JSMIMEType.cpp +++ b/src/bun.js/bindings/webcore/JSMIMEType.cpp @@ -272,7 +272,7 @@ static std::tuple parseTypeAndSubtype(JSGlobalObject* gl String subtype = subtypeView.convertToASCIILowercase(); // Return type, subtype, and the index where parameters start - return std::make_tuple(WTFMove(type), WTFMove(subtype), paramsStartIndex); + return std::make_tuple(WTF::move(type), WTF::move(subtype), paramsStartIndex); } //-- JSMIMEType (Instance) Implementation -- @@ -282,7 +282,7 @@ const ClassInfo JSMIMEType::s_info = { "MIMEType"_s, &Base::s_info, nullptr, nul JSMIMEType* JSMIMEType::create(VM& vm, Structure* structure, String type, String subtype, JSMIMEParams* params) { JSMIMEType* instance = new (NotNull, allocateCell(vm)) JSMIMEType(vm, structure); - instance->finishCreation(vm, WTFMove(type), WTFMove(subtype), params); + instance->finishCreation(vm, WTF::move(type), WTF::move(subtype), params); return instance; } @@ -300,8 +300,8 @@ void JSMIMEType::finishCreation(VM& vm, String type, String subtype, JSMIMEParam { Base::finishCreation(vm); ASSERT(inherits(info())); - m_type = WTFMove(type); - m_subtype = WTFMove(subtype); + m_type = WTF::move(type); + m_subtype = WTF::move(subtype); m_parameters.set(vm, this, params); } @@ -581,7 +581,7 @@ JSC_DEFINE_HOST_FUNCTION(constructMIMEType, (JSGlobalObject * globalObject, Call JSMIMEParams* paramsInstance = JSMIMEParams::create(vm, paramsStructure, paramsMap); // 4. Create the JSMIMEType instance - JSMIMEType* instance = JSMIMEType::create(vm, structure, WTFMove(type), WTFMove(subtype), paramsInstance); + JSMIMEType* instance = JSMIMEType::create(vm, structure, WTF::move(type), WTF::move(subtype), paramsInstance); return JSC::JSValue::encode(instance); } diff --git a/src/bun.js/bindings/webcore/JSMIMEType.h b/src/bun.js/bindings/webcore/JSMIMEType.h index f7bf15af92a387..f4697c2031541d 100644 --- a/src/bun.js/bindings/webcore/JSMIMEType.h +++ b/src/bun.js/bindings/webcore/JSMIMEType.h @@ -36,10 +36,10 @@ class JSMIMEType final : public JSC::JSNonFinalObject { DECLARE_VISIT_CHILDREN; const WTF::String& type() const { return m_type; } - void setType(WTF::String type) { m_type = WTFMove(type); } + void setType(WTF::String type) { m_type = WTF::move(type); } const WTF::String& subtype() const { return m_subtype; } - void setSubtype(WTF::String subtype) { m_subtype = WTFMove(subtype); } + void setSubtype(WTF::String subtype) { m_subtype = WTF::move(subtype); } JSMIMEParams* parameters() const { return m_parameters.get(); } diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.cpp b/src/bun.js/bindings/webcore/JSMessageChannel.cpp index 0d46552605a5ac..e7ebdd447f5580 100644 --- a/src/bun.js/bindings/webcore/JSMessageChannel.cpp +++ b/src/bun.js/bindings/webcore/JSMessageChannel.cpp @@ -102,7 +102,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageChannelDOMConst if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -148,7 +148,7 @@ void JSMessageChannelPrototype::finishCreation(VM& vm) const ClassInfo JSMessageChannel::s_info = { "MessageChannel"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMessageChannel) }; JSMessageChannel::JSMessageChannel(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -301,7 +301,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, MessageChannel& impl) diff --git a/src/bun.js/bindings/webcore/JSMessageChannel.h b/src/bun.js/bindings/webcore/JSMessageChannel.h index 08b5b96ff97b05..6dad079ed42515 100644 --- a/src/bun.js/bindings/webcore/JSMessageChannel.h +++ b/src/bun.js/bindings/webcore/JSMessageChannel.h @@ -31,7 +31,7 @@ class JSMessageChannel : public JSDOMWrapper { using Base = JSDOMWrapper; static JSMessageChannel* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSMessageChannel* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessageChannel(structure, *globalObject, WTFMove(impl)); + JSMessageChannel* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessageChannel(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.cpp b/src/bun.js/bindings/webcore/JSMessageEvent.cpp index b7db3c24a4dda6..90545ef9588aad 100644 --- a/src/bun.js/bindings/webcore/JSMessageEvent.cpp +++ b/src/bun.js/bindings/webcore/JSMessageEvent.cpp @@ -244,11 +244,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMessageEventDOMConstru EnsureStillAliveScope argument1 = callFrame->argument(1); auto eventInitDict = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = MessageEvent::create(WTFMove(type), WTFMove(eventInitDict)); + auto object = MessageEvent::create(WTF::move(type), WTF::move(eventInitDict)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -297,7 +297,7 @@ void JSMessageEventPrototype::finishCreation(VM& vm) const ClassInfo JSMessageEvent::s_info = { "MessageEvent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMessageEvent) }; JSMessageEvent::JSMessageEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEvent(structure, globalObject, WTFMove(impl)) + : JSEvent(structure, globalObject, WTF::move(impl)) { } @@ -430,7 +430,7 @@ static inline JSC::EncodedJSValue jsMessageEventPrototypeFunction_initMessageEve EnsureStillAliveScope argument7 = callFrame->argument(7); auto messagePorts = argument7.value().isUndefined() ? Converter>>::ReturnType {} : convert>>(*lexicalGlobalObject, argument7.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initMessageEvent(WTFMove(type), WTFMove(bubbles), WTFMove(cancelable), WTFMove(data), WTFMove(originArg), WTFMove(lastEventId), WTFMove(source), WTFMove(messagePorts)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.initMessageEvent(WTF::move(type), WTF::move(bubbles), WTF::move(cancelable), WTF::move(data), WTF::move(originArg), WTF::move(lastEventId), WTF::move(source), WTF::move(messagePorts)); }))); } JSC_DEFINE_HOST_FUNCTION(jsMessageEventPrototypeFunction_initMessageEvent, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -518,7 +518,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, MessageEvent& impl) diff --git a/src/bun.js/bindings/webcore/JSMessageEvent.h b/src/bun.js/bindings/webcore/JSMessageEvent.h index 8f48568f771cf4..d4a29c524aa574 100644 --- a/src/bun.js/bindings/webcore/JSMessageEvent.h +++ b/src/bun.js/bindings/webcore/JSMessageEvent.h @@ -33,7 +33,7 @@ class JSMessageEvent : public JSEvent { using DOMWrapped = MessageEvent; static JSMessageEvent* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSMessageEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessageEvent(structure, *globalObject, WTFMove(impl)); + JSMessageEvent* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessageEvent(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSMessagePort.cpp b/src/bun.js/bindings/webcore/JSMessagePort.cpp index 94aad037df778e..5fb0d1fec8bc48 100644 --- a/src/bun.js/bindings/webcore/JSMessagePort.cpp +++ b/src/bun.js/bindings/webcore/JSMessagePort.cpp @@ -150,7 +150,7 @@ void JSMessagePortPrototype::finishCreation(VM& vm) const ClassInfo JSMessagePort::s_info = { "MessagePort"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMessagePort) }; JSMessagePort::JSMessagePort(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -254,7 +254,7 @@ static inline JSC::EncodedJSValue jsMessagePortPrototypeFunction_postMessage1Bod EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto transfer = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTFMove(message), WTFMove(transfer)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTF::move(message), WTF::move(transfer)); }))); } static inline JSC::EncodedJSValue jsMessagePortPrototypeFunction_postMessage2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -270,7 +270,7 @@ static inline JSC::EncodedJSValue jsMessagePortPrototypeFunction_postMessage2Bod EnsureStillAliveScope argument1 = callFrame->argument(1); auto options = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTFMove(message), WTFMove(options)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTF::move(message), WTF::move(options)); }))); } static inline JSC::EncodedJSValue jsMessagePortPrototypeFunction_postMessageOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -478,7 +478,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, MessagePort& impl) diff --git a/src/bun.js/bindings/webcore/JSMessagePort.h b/src/bun.js/bindings/webcore/JSMessagePort.h index dda3f9988a0da4..3cbd5e3ceb556d 100644 --- a/src/bun.js/bindings/webcore/JSMessagePort.h +++ b/src/bun.js/bindings/webcore/JSMessagePort.h @@ -33,7 +33,7 @@ class WEBCORE_EXPORT JSMessagePort : public JSEventTarget { using DOMWrapped = MessagePort; static JSMessagePort* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSMessagePort* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessagePort(structure, *globalObject, WTFMove(impl)); + JSMessagePort* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSMessagePort(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformance.cpp b/src/bun.js/bindings/webcore/JSPerformance.cpp index 813a9735014991..7c0f987ab38a47 100644 --- a/src/bun.js/bindings/webcore/JSPerformance.cpp +++ b/src/bun.js/bindings/webcore/JSPerformance.cpp @@ -252,7 +252,7 @@ void JSPerformancePrototype::finishCreation(VM& vm) const ClassInfo JSPerformance::s_info = { "Performance"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformance) }; JSPerformance::JSPerformance(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -452,7 +452,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_getEntriesByTyp EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto type = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByType(WTFMove(type))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByType(WTF::move(type))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_getEntriesByType, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -475,7 +475,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_getEntriesByNam EnsureStillAliveScope argument1 = callFrame->argument(1); auto type = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByName(WTFMove(name), WTFMove(type))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByName(WTF::move(name), WTF::move(type))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_getEntriesByName, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -510,7 +510,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_setResourceTimi EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto maxSize = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setResourceTimingBufferSize(WTFMove(maxSize)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setResourceTimingBufferSize(WTF::move(maxSize)); }))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_setResourceTimingBufferSize, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -533,7 +533,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_markBody(JSC::J EnsureStillAliveScope argument1 = callFrame->argument(1); auto markOptions = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.mark(*jsCast(lexicalGlobalObject), WTFMove(markName), WTFMove(markOptions))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.mark(*jsCast(lexicalGlobalObject), WTF::move(markName), WTF::move(markOptions))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_mark, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -551,7 +551,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_clearMarksBody( EnsureStillAliveScope argument0 = callFrame->argument(0); auto markName = argument0.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clearMarks(WTFMove(markName)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clearMarks(WTF::move(markName)); }))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_clearMarks, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -577,7 +577,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_measureBody(JSC EnsureStillAliveScope argument2 = callFrame->argument(2); auto endMark = argument2.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.measure(*jsCast(lexicalGlobalObject), WTFMove(measureName), WTFMove(startOrMeasureOptions), WTFMove(endMark))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.measure(*jsCast(lexicalGlobalObject), WTF::move(measureName), WTF::move(startOrMeasureOptions), WTF::move(endMark))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_measure, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -595,7 +595,7 @@ static inline JSC::EncodedJSValue jsPerformancePrototypeFunction_clearMeasuresBo EnsureStillAliveScope argument0 = callFrame->argument(0); auto measureName = argument0.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clearMeasures(WTFMove(measureName)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clearMeasures(WTF::move(measureName)); }))); } JSC_DEFINE_HOST_FUNCTION(jsPerformancePrototypeFunction_clearMeasures, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -672,7 +672,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Performance& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformance.h b/src/bun.js/bindings/webcore/JSPerformance.h index 9aa6f243e915d9..0cbb9409596390 100644 --- a/src/bun.js/bindings/webcore/JSPerformance.h +++ b/src/bun.js/bindings/webcore/JSPerformance.h @@ -35,7 +35,7 @@ class JSPerformance : public JSEventTarget { using DOMWrapped = Performance; static JSPerformance* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformance* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformance(structure, *globalObject, WTFMove(impl)); + JSPerformance* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformance(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp b/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp index 1ff05b9c48ce53..adf1d170faf19b 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceEntry.cpp @@ -135,7 +135,7 @@ void JSPerformanceEntryPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceEntry::s_info = { "PerformanceEntry"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceEntry) }; JSPerformanceEntry::JSPerformanceEntry(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntry.h b/src/bun.js/bindings/webcore/JSPerformanceEntry.h index 36a5df80a71d7a..b8af39099133d8 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceEntry.h +++ b/src/bun.js/bindings/webcore/JSPerformanceEntry.h @@ -31,7 +31,7 @@ class JSPerformanceEntry : public JSDOMWrapper { using Base = JSDOMWrapper; static JSPerformanceEntry* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceEntry* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceEntry(structure, *globalObject, WTFMove(impl)); + JSPerformanceEntry* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceEntry(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp b/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp index a7d86488b7b2a8..944427d6279405 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp @@ -51,21 +51,21 @@ JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref

performanceEntryType()) { // case PerformanceEntry::Type::Navigation: - // return createWrapper(globalObject, WTFMove(entry)); + // return createWrapper(globalObject, WTF::move(entry)); case PerformanceEntry::Type::Mark: - return createWrapper(globalObject, WTFMove(entry)); + return createWrapper(globalObject, WTF::move(entry)); case PerformanceEntry::Type::Measure: - return createWrapper(globalObject, WTFMove(entry)); + return createWrapper(globalObject, WTF::move(entry)); // case PerformanceEntry::Type::Resource: - // return createWrapper(globalObject, WTFMove(entry)); + // return createWrapper(globalObject, WTF::move(entry)); // case PerformanceEntry::Type::Paint: - // return createWrapper(globalObject, WTFMove(entry)); + // return createWrapper(globalObject, WTF::move(entry)); default: { } } ASSERT_NOT_REACHED(); - return createWrapper(globalObject, WTFMove(entry)); + return createWrapper(globalObject, WTF::move(entry)); } JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceEntry& entry) diff --git a/src/bun.js/bindings/webcore/JSPerformanceMark.cpp b/src/bun.js/bindings/webcore/JSPerformanceMark.cpp index a7fa5e5768d6a6..56a7b33bef040a 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMark.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceMark.cpp @@ -105,11 +105,11 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSPerformanceMarkDOMConstruct EnsureStillAliveScope argument1 = callFrame->argument(1); auto markOptions = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = PerformanceMark::create(*castedThis->globalObject(), *context, WTFMove(markName), WTFMove(markOptions)); + auto object = PerformanceMark::create(*castedThis->globalObject(), *context, WTF::move(markName), WTF::move(markOptions)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -153,7 +153,7 @@ void JSPerformanceMarkPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceMark::s_info = { "PerformanceMark"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceMark) }; JSPerformanceMark::JSPerformanceMark(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSPerformanceEntry(structure, globalObject, WTFMove(impl)) + : JSPerformanceEntry(structure, globalObject, WTF::move(impl)) { } @@ -266,7 +266,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceMark& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformanceMark.h b/src/bun.js/bindings/webcore/JSPerformanceMark.h index 00c92883eff862..177af58fa9ccbb 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMark.h +++ b/src/bun.js/bindings/webcore/JSPerformanceMark.h @@ -32,7 +32,7 @@ class JSPerformanceMark : public JSPerformanceEntry { using DOMWrapped = PerformanceMark; static JSPerformanceMark* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceMark* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceMark(structure, *globalObject, WTFMove(impl)); + JSPerformanceMark* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceMark(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp b/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp index c0dbd10789204a..008f4a29cbea5c 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp @@ -119,7 +119,7 @@ void JSPerformanceMeasurePrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceMeasure::s_info = { "PerformanceMeasure"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceMeasure) }; JSPerformanceMeasure::JSPerformanceMeasure(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSPerformanceEntry(structure, globalObject, WTFMove(impl)) + : JSPerformanceEntry(structure, globalObject, WTF::move(impl)) { } diff --git a/src/bun.js/bindings/webcore/JSPerformanceMeasure.h b/src/bun.js/bindings/webcore/JSPerformanceMeasure.h index 15134c1891d2b1..62ab8674723ac1 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceMeasure.h +++ b/src/bun.js/bindings/webcore/JSPerformanceMeasure.h @@ -32,7 +32,7 @@ class JSPerformanceMeasure : public JSPerformanceEntry { using DOMWrapped = PerformanceMeasure; static JSPerformanceMeasure* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceMeasure* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceMeasure(structure, *globalObject, WTFMove(impl)); + JSPerformanceMeasure* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceMeasure(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp b/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp index 12621cb1d39c0b..01b0b441bb8a2a 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceObserver.cpp @@ -180,7 +180,7 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSPerformanceObserverDOMConst if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -228,7 +228,7 @@ void JSPerformanceObserverPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceObserver::s_info = { "PerformanceObserver"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceObserver) }; JSPerformanceObserver::JSPerformanceObserver(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -290,7 +290,7 @@ static inline JSC::EncodedJSValue jsPerformanceObserverPrototypeFunction_observe EnsureStillAliveScope argument0 = callFrame->argument(0); auto options = convert>(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.observe(WTFMove(options)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.observe(WTF::move(options)); }))); } JSC_DEFINE_HOST_FUNCTION(jsPerformanceObserverPrototypeFunction_observe, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -408,7 +408,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceObserver& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserver.h b/src/bun.js/bindings/webcore/JSPerformanceObserver.h index 6f6baef6076f71..989fc79b7eef1e 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserver.h +++ b/src/bun.js/bindings/webcore/JSPerformanceObserver.h @@ -32,7 +32,7 @@ class JSPerformanceObserver : public JSDOMWrapper { using Base = JSDOMWrapper; static JSPerformanceObserver* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceObserver* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceObserver(structure, *globalObject, WTFMove(impl)); + JSPerformanceObserver* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceObserver(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp index 7c5a4972b48edf..4b7a580efd7d8a 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp @@ -133,7 +133,7 @@ void JSPerformanceObserverEntryListPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceObserverEntryList::s_info = { "PerformanceObserverEntryList"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceObserverEntryList) }; JSPerformanceObserverEntryList::JSPerformanceObserverEntryList(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -199,7 +199,7 @@ static inline JSC::EncodedJSValue jsPerformanceObserverEntryListPrototypeFunctio EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto type = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByType(WTFMove(type))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByType(WTF::move(type))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformanceObserverEntryListPrototypeFunction_getEntriesByType, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -222,7 +222,7 @@ static inline JSC::EncodedJSValue jsPerformanceObserverEntryListPrototypeFunctio EnsureStillAliveScope argument1 = callFrame->argument(1); auto type = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByName(WTFMove(name), WTFMove(type))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getEntriesByName(WTF::move(name), WTF::move(type))))); } JSC_DEFINE_HOST_FUNCTION(jsPerformanceObserverEntryListPrototypeFunction_getEntriesByName, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -296,7 +296,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceObserverEntryList& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h index 9c77f7a39ba068..2c7a8091e37e02 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h +++ b/src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.h @@ -31,7 +31,7 @@ class JSPerformanceObserverEntryList : public JSDOMWrapper; static JSPerformanceObserverEntryList* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceObserverEntryList* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceObserverEntryList(structure, *globalObject, WTFMove(impl)); + JSPerformanceObserverEntryList* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceObserverEntryList(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp b/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp index dbef65a877c79f..a0e82c0094766d 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp @@ -166,7 +166,7 @@ void JSPerformanceResourceTimingPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceResourceTiming::s_info = { "PerformanceResourceTiming"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceResourceTiming) }; JSPerformanceResourceTiming::JSPerformanceResourceTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSPerformanceEntry(structure, globalObject, WTFMove(impl)) + : JSPerformanceEntry(structure, globalObject, WTF::move(impl)) { } diff --git a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h b/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h index 86e6b29327051d..e9127b59d1cac4 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h +++ b/src/bun.js/bindings/webcore/JSPerformanceResourceTiming.h @@ -33,7 +33,7 @@ class JSPerformanceResourceTiming : public JSPerformanceEntry { static JSPerformanceResourceTiming* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { auto& vm = JSC::getVM(globalObject); - JSPerformanceResourceTiming* ptr = new (NotNull, JSC::allocateCell(vm)) JSPerformanceResourceTiming(structure, *globalObject, WTFMove(impl)); + JSPerformanceResourceTiming* ptr = new (NotNull, JSC::allocateCell(vm)) JSPerformanceResourceTiming(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp b/src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp index 492a393198d137..99abe5e87f6ea2 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp @@ -133,7 +133,7 @@ void JSPerformanceServerTimingPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceServerTiming::s_info = { "PerformanceServerTiming"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceServerTiming) }; JSPerformanceServerTiming::JSPerformanceServerTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -296,7 +296,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); // #endif // } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceServerTiming& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.h b/src/bun.js/bindings/webcore/JSPerformanceServerTiming.h index 7d549f368983ab..fd32594b172d54 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceServerTiming.h +++ b/src/bun.js/bindings/webcore/JSPerformanceServerTiming.h @@ -32,7 +32,7 @@ class JSPerformanceServerTiming : public JSDOMWrapper { static JSPerformanceServerTiming* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { auto& vm = JSC::getVM(globalObject); - JSPerformanceServerTiming* ptr = new (NotNull, JSC::allocateCell(vm)) JSPerformanceServerTiming(structure, *globalObject, WTFMove(impl)); + JSPerformanceServerTiming* ptr = new (NotNull, JSC::allocateCell(vm)) JSPerformanceServerTiming(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp b/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp index 1f21ac34f405a2..f9a93c638a7e2b 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp +++ b/src/bun.js/bindings/webcore/JSPerformanceTiming.cpp @@ -168,7 +168,7 @@ void JSPerformanceTimingPrototype::finishCreation(VM& vm) const ClassInfo JSPerformanceTiming::s_info = { "PerformanceTiming"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceTiming) }; JSPerformanceTiming::JSPerformanceTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -624,7 +624,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, PerformanceTiming& impl) diff --git a/src/bun.js/bindings/webcore/JSPerformanceTiming.h b/src/bun.js/bindings/webcore/JSPerformanceTiming.h index a9a1d0124e10eb..e7c42ec4a0618f 100644 --- a/src/bun.js/bindings/webcore/JSPerformanceTiming.h +++ b/src/bun.js/bindings/webcore/JSPerformanceTiming.h @@ -31,7 +31,7 @@ class JSPerformanceTiming : public JSDOMWrapper { using Base = JSDOMWrapper; static JSPerformanceTiming* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSPerformanceTiming* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceTiming(structure, *globalObject, WTFMove(impl)); + JSPerformanceTiming* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSPerformanceTiming(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp index 0a34f52ff55b5c..93219a470000db 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp @@ -106,7 +106,7 @@ void JSReadableStreamSinkPrototype::finishCreation(VM& vm) const ClassInfo JSReadableStreamSink::s_info = { "ReadableStreamSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamSink) }; JSReadableStreamSink::JSReadableStreamSink(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -148,7 +148,7 @@ static inline JSC::EncodedJSValue jsReadableStreamSinkPrototypeFunction_enqueueB EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto chunk = convert>(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.enqueue(WTFMove(chunk)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.enqueue(WTF::move(chunk)); }))); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_enqueue, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -183,7 +183,7 @@ static inline JSC::EncodedJSValue jsReadableStreamSinkPrototypeFunction_errorBod EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto message = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.error(WTFMove(message)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.error(WTF::move(message)); }))); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSinkPrototypeFunction_error, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -227,7 +227,7 @@ void JSReadableStreamSinkOwner::finalize(JSC::Handle handle, void* JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, ReadableStreamSink& impl) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSink.h b/src/bun.js/bindings/webcore/JSReadableStreamSink.h index 66c77c2c7091d1..e029d9ac31fc19 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSink.h +++ b/src/bun.js/bindings/webcore/JSReadableStreamSink.h @@ -31,7 +31,7 @@ class JSReadableStreamSink : public JSDOMWrapper { using Base = JSDOMWrapper; static JSReadableStreamSink* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSReadableStreamSink* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSReadableStreamSink(structure, *globalObject, WTFMove(impl)); + JSReadableStreamSink* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSReadableStreamSink(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp index b2e5751b09ebcb..24115897c086e4 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp @@ -116,7 +116,7 @@ void JSReadableStreamSourcePrototype::finishCreation(VM& vm) const ClassInfo JSReadableStreamSource::s_info = { "ReadableStreamSource"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSReadableStreamSource) }; JSReadableStreamSource::JSReadableStreamSource(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -163,7 +163,7 @@ static inline JSC::EncodedJSValue jsReadableStreamSourcePrototypeFunction_startB auto throwScope = DECLARE_THROW_SCOPE(vm); UNUSED_PARAM(throwScope); UNUSED_PARAM(callFrame); - RELEASE_AND_RETURN(throwScope, (JSValue::encode(castedThis->start(*lexicalGlobalObject, *callFrame, WTFMove(promise))))); + RELEASE_AND_RETURN(throwScope, (JSValue::encode(castedThis->start(*lexicalGlobalObject, *callFrame, WTF::move(promise))))); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSourcePrototypeFunction_start, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -177,7 +177,7 @@ static inline JSC::EncodedJSValue jsReadableStreamSourcePrototypeFunction_pullBo auto throwScope = DECLARE_THROW_SCOPE(vm); UNUSED_PARAM(throwScope); UNUSED_PARAM(callFrame); - RELEASE_AND_RETURN(throwScope, (JSValue::encode(castedThis->pull(*lexicalGlobalObject, *callFrame, WTFMove(promise))))); + RELEASE_AND_RETURN(throwScope, (JSValue::encode(castedThis->pull(*lexicalGlobalObject, *callFrame, WTF::move(promise))))); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSourcePrototypeFunction_pull, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -197,7 +197,7 @@ static inline JSC::EncodedJSValue jsReadableStreamSourcePrototypeFunction_cancel EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto reason = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.cancel(WTFMove(reason)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.cancel(WTF::move(reason)); }))); } JSC_DEFINE_HOST_FUNCTION(jsReadableStreamSourcePrototypeFunction_cancel, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -252,7 +252,7 @@ void JSReadableStreamSourceOwner::finalize(JSC::Handle handle, voi JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, ReadableStreamSource& impl) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.h b/src/bun.js/bindings/webcore/JSReadableStreamSource.h index 6cd8f933f6316d..eb26e8018b996d 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSource.h +++ b/src/bun.js/bindings/webcore/JSReadableStreamSource.h @@ -31,7 +31,7 @@ class JSReadableStreamSource : public JSDOMWrapper { using Base = JSDOMWrapper; static JSReadableStreamSource* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSReadableStreamSource* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSReadableStreamSource(structure, *globalObject, WTFMove(impl)); + JSReadableStreamSource* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSReadableStreamSource(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp index 7082fd6f293c01..64b2d4043950bd 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp @@ -45,14 +45,14 @@ JSValue JSReadableStreamSource::start(JSGlobalObject& lexicalGlobalObject, CallF m_controller.set(vm, this, controller); - wrapped().start(ReadableStreamDefaultController(controller), WTFMove(promise)); + wrapped().start(ReadableStreamDefaultController(controller), WTF::move(promise)); return jsUndefined(); } JSValue JSReadableStreamSource::pull(JSGlobalObject&, CallFrame&, Ref&& promise) { - wrapped().pull(WTFMove(promise)); + wrapped().pull(WTF::move(promise)); return jsUndefined(); } diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.cpp b/src/bun.js/bindings/webcore/JSTextEncoder.cpp index 0a1fcf212e59a9..6eddba70b72acb 100644 --- a/src/bun.js/bindings/webcore/JSTextEncoder.cpp +++ b/src/bun.js/bindings/webcore/JSTextEncoder.cpp @@ -189,7 +189,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextEncoderDOMConstruc if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -314,7 +314,7 @@ void JSTextEncoderPrototype::finishCreation(VM& vm) const ClassInfo JSTextEncoder::s_info = { "TextEncoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextEncoder) }; JSTextEncoder::JSTextEncoder(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -527,7 +527,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TextEncoder& impl) diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.h b/src/bun.js/bindings/webcore/JSTextEncoder.h index 3b192f52239cd9..9775edeae63a55 100644 --- a/src/bun.js/bindings/webcore/JSTextEncoder.h +++ b/src/bun.js/bindings/webcore/JSTextEncoder.h @@ -34,7 +34,7 @@ class JSTextEncoder : public JSDOMWrapper { using Base = JSDOMWrapper; static JSTextEncoder* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSTextEncoder* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSTextEncoder(structure, *globalObject, WTFMove(impl)); + JSTextEncoder* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSTextEncoder(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSURLPattern.cpp b/src/bun.js/bindings/webcore/JSURLPattern.cpp index b6b531ca042a22..987ec667b6c84d 100644 --- a/src/bun.js/bindings/webcore/JSURLPattern.cpp +++ b/src/bun.js/bindings/webcore/JSURLPattern.cpp @@ -63,15 +63,15 @@ using namespace JSC; static URLPattern::URLPatternInput convertToWTFVariant(std::variant&& input) { if (std::holds_alternative(input)) - return URLPattern::URLPatternInput(std::get(std::move(input))); - return URLPattern::URLPatternInput(std::get(std::move(input))); + return URLPattern::URLPatternInput(std::get(WTF::move(input))); + return URLPattern::URLPatternInput(std::get(WTF::move(input))); } static std::optional convertToOptionalWTFVariant(std::optional>&& input) { if (!input) return std::nullopt; - return convertToWTFVariant(std::move(*input)); + return convertToWTFVariant(WTF::move(*input)); } // Functions @@ -144,11 +144,11 @@ static inline EncodedJSValue constructJSURLPattern1(JSGlobalObject* lexicalGloba EnsureStillAliveScope argument2 = callFrame->argument(2); auto options = convert>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - auto object = URLPattern::create(*context, convertToWTFVariant(WTFMove(input)), WTFMove(baseURL), WTFMove(options)); + auto object = URLPattern::create(*context, convertToWTFVariant(WTF::move(input)), WTF::move(baseURL), WTF::move(options)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -171,11 +171,11 @@ static inline EncodedJSValue constructJSURLPattern2(JSGlobalObject* lexicalGloba EnsureStillAliveScope argument1 = callFrame->argument(1); auto options = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - auto object = URLPattern::create(*context, convertToOptionalWTFVariant(WTFMove(input)), WTFMove(options)); + auto object = URLPattern::create(*context, convertToOptionalWTFVariant(WTF::move(input)), WTF::move(options)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -258,7 +258,7 @@ void JSURLPatternPrototype::finishCreation(VM& vm) const ClassInfo JSURLPattern::s_info = { "URLPattern"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSURLPattern) }; JSURLPattern::JSURLPattern(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -428,7 +428,7 @@ static inline JSC::EncodedJSValue jsURLPatternPrototypeFunction_testBody(JSC::JS EnsureStillAliveScope argument1 = callFrame->argument(1); auto baseURL = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.test(*context, convertToOptionalWTFVariant(WTFMove(input)), WTFMove(baseURL))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.test(*context, convertToOptionalWTFVariant(WTF::move(input)), WTF::move(baseURL))))); } JSC_DEFINE_HOST_FUNCTION(jsURLPatternPrototypeFunction_test, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -452,7 +452,7 @@ static inline JSC::EncodedJSValue jsURLPatternPrototypeFunction_execBody(JSC::JS EnsureStillAliveScope argument1 = callFrame->argument(1); auto baseURL = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.exec(*context, convertToOptionalWTFVariant(WTFMove(input)), WTFMove(baseURL))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.exec(*context, convertToOptionalWTFVariant(WTF::move(input)), WTF::move(baseURL))))); } JSC_DEFINE_HOST_FUNCTION(jsURLPatternPrototypeFunction_exec, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -527,7 +527,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj #if ENABLE(BINDING_INTEGRITY) verifyVTable(impl.ptr()); #endif - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, URLPattern& impl) diff --git a/src/bun.js/bindings/webcore/JSURLPattern.h b/src/bun.js/bindings/webcore/JSURLPattern.h index 1f7b6b520e4921..6eb14ed88bc20d 100644 --- a/src/bun.js/bindings/webcore/JSURLPattern.h +++ b/src/bun.js/bindings/webcore/JSURLPattern.h @@ -32,7 +32,7 @@ class JSURLPattern : public JSDOMWrapper { static JSURLPattern* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { SUPPRESS_UNCOUNTED_LOCAL auto& vm = globalObject->vm(); - JSURLPattern* ptr = new (NotNull, JSC::allocateCell(vm)) JSURLPattern(structure, *globalObject, WTFMove(impl)); + JSURLPattern* ptr = new (NotNull, JSC::allocateCell(vm)) JSURLPattern(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(vm); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp index b1e296f95fc818..7a1a02d6582829 100644 --- a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp +++ b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp @@ -125,11 +125,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSURLSearchParamsDOMCons EnsureStillAliveScope argument0 = callFrame->argument(0); auto init = argument0.value().isUndefined() ? emptyString() : convert>, IDLRecord, IDLUSVString>>(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = URLSearchParams::create(WTFMove(init)); + auto object = URLSearchParams::create(WTF::move(init)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -183,7 +183,7 @@ static const HashTableValue JSURLSearchParamsPrototypeTableValues[] = { { "toString"_s, static_cast(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsURLSearchParamsPrototypeFunction_toString, 0 } }, { "toJSON"_s, static_cast(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsURLSearchParamsPrototypeFunction_toJSON, 0 } }, { "length"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::DontEnum), NoIntrinsic, { HashTableValue::GetterSetterType, jsURLSearchParamsPrototype_getLength, 0 } }, - { "size"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, jsURLSearchParamsPrototype_getLength, 0 } }, + { "size"_s, static_cast(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::ReadOnly), NoIntrinsic, { HashTableValue::GetterSetterType, jsURLSearchParamsPrototype_getLength, 0 } }, }; const ClassInfo JSURLSearchParamsPrototype::s_info = { "URLSearchParams"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSURLSearchParamsPrototype) }; @@ -199,7 +199,7 @@ void JSURLSearchParamsPrototype::finishCreation(VM& vm) const ClassInfo JSURLSearchParams::s_info = { "URLSearchParams"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSURLSearchParams) }; JSURLSearchParams::JSURLSearchParams(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -259,7 +259,7 @@ static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_appendBody( EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.append(WTF::move(name), WTF::move(value)); }))); } JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_append, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -287,7 +287,7 @@ static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_deleteBody( RETURN_IF_EXCEPTION(throwScope, {}); } - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.remove(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.remove(WTF::move(name), WTF::move(value)); }))); } JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_delete, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -361,7 +361,7 @@ static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_hasBody(JSC RETURN_IF_EXCEPTION(throwScope, {}); } - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.has(name, WTFMove(value))))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, impl.has(name, WTF::move(value))))); } JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_has, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -384,7 +384,7 @@ static inline JSC::EncodedJSValue jsURLSearchParamsPrototypeFunction_setBody(JSC EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto value = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTFMove(name), WTFMove(value)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.set(WTF::move(name), WTF::move(value)); }))); } JSC_DEFINE_HOST_FUNCTION(jsURLSearchParamsPrototypeFunction_set, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -687,7 +687,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); // #endif // } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, URLSearchParams& impl) diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.h b/src/bun.js/bindings/webcore/JSURLSearchParams.h index 4c4ba34145c346..14f0609778e819 100644 --- a/src/bun.js/bindings/webcore/JSURLSearchParams.h +++ b/src/bun.js/bindings/webcore/JSURLSearchParams.h @@ -31,7 +31,7 @@ class JSURLSearchParams : public JSDOMWrapper { using Base = JSDOMWrapper; static JSURLSearchParams* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSURLSearchParams* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSURLSearchParams(structure, *globalObject, WTFMove(impl)); + JSURLSearchParams* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSURLSearchParams(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSValueInWrappedObject.h b/src/bun.js/bindings/webcore/JSValueInWrappedObject.h index 12a41ab2577c34..28cb4897b15c18 100644 --- a/src/bun.js/bindings/webcore/JSValueInWrappedObject.h +++ b/src/bun.js/bindings/webcore/JSValueInWrappedObject.h @@ -95,7 +95,7 @@ inline void JSValueInWrappedObject::setWeakly(JSC::JSValue value) m_nonCell = {}; JSC::Weak weak { value.asCell() }; WTF::storeStoreFence(); - m_cell = WTFMove(weak); + m_cell = WTF::move(weak); } inline void JSValueInWrappedObject::set(JSC::VM& vm, const JSC::JSCell* owner, JSC::JSValue value) diff --git a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp b/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp index 3b327f5b61d555..af3baa8a192ae1 100644 --- a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp +++ b/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.cpp @@ -82,7 +82,7 @@ void JSWasmStreamingCompilerPrototype::finishCreation(VM& vm) const ClassInfo JSWasmStreamingCompiler::s_info = { "WasmStreamingCompiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWasmStreamingCompiler) }; JSWasmStreamingCompiler::JSWasmStreamingCompiler(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -220,7 +220,7 @@ void JSWasmStreamingCompilerOwner::finalize(JSC::Handle handle, vo JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSValue toJS(JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Wasm::StreamingCompiler& impl) diff --git a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h b/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h index 86bdc4db83da15..d40eb990ea623c 100644 --- a/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h +++ b/src/bun.js/bindings/webcore/JSWasmStreamingCompiler.h @@ -11,7 +11,7 @@ class JSWasmStreamingCompiler : public JSDOMWrapper; static JSWasmStreamingCompiler* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSWasmStreamingCompiler* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWasmStreamingCompiler(structure, *globalObject, WTFMove(impl)); + JSWasmStreamingCompiler* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWasmStreamingCompiler(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSWebSocket.cpp b/src/bun.js/bindings/webcore/JSWebSocket.cpp index c9475097f9e550..db678ebc7b08d1 100644 --- a/src/bun.js/bindings/webcore/JSWebSocket.cpp +++ b/src/bun.js/bindings/webcore/JSWebSocket.cpp @@ -158,11 +158,11 @@ static inline JSC::EncodedJSValue constructJSWebSocket1(JSGlobalObject* lexicalG EnsureStillAliveScope argument1 = callFrame->argument(1); auto protocols = argument1.value().isUndefined() ? Converter>::ReturnType {} : convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = WebSocket::create(*context, WTFMove(url), WTFMove(protocols)); + auto object = WebSocket::create(*context, WTF::move(url), WTF::move(protocols)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -185,11 +185,11 @@ static inline JSC::EncodedJSValue constructJSWebSocket2(JSGlobalObject* lexicalG EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto protocol = convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = WebSocket::create(*context, WTFMove(url), WTFMove(protocol)); + auto object = WebSocket::create(*context, WTF::move(url), WTF::move(protocol)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -258,12 +258,12 @@ static inline JSC::EncodedJSValue constructJSWebSocket3(JSGlobalObject* lexicalG } } - auto object = (rejectUnauthorized == -1) ? WebSocket::create(*context, WTFMove(url), protocols, WTFMove(headersInit)) : WebSocket::create(*context, WTFMove(url), protocols, WTFMove(headersInit), rejectUnauthorized ? true : false); + auto object = (rejectUnauthorized == -1) ? WebSocket::create(*context, WTF::move(url), protocols, WTF::move(headersInit)) : WebSocket::create(*context, WTF::move(url), protocols, WTF::move(headersInit), rejectUnauthorized ? true : false); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *globalObject, throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *globalObject, throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -356,7 +356,7 @@ void JSWebSocketPrototype::finishCreation(VM& vm) const ClassInfo JSWebSocket::s_info = { "WebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebSocket) }; JSWebSocket::JSWebSocket(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -596,7 +596,7 @@ static inline bool setJSWebSocket_binaryTypeSetter(JSGlobalObject& lexicalGlobal auto nativeValue = convert(lexicalGlobalObject, value); RETURN_IF_EXCEPTION(throwScope, false); invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { - return impl.setBinaryType(WTFMove(nativeValue)); + return impl.setBinaryType(WTF::move(nativeValue)); }); return true; } @@ -642,7 +642,7 @@ static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_send4Body(JSC::JS EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto data = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.send(WTFMove(data)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.send(WTF::move(data)); }))); } static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_sendOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -687,7 +687,7 @@ static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_closeBody(JSC::JS EnsureStillAliveScope argument1 = callFrame->argument(1); auto reason = argument1.value().isUndefined() ? String() : convert(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.close(WTFMove(code), WTFMove(reason)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.close(WTF::move(code), WTF::move(reason)); }))); } JSC_DEFINE_HOST_FUNCTION(jsWebSocketPrototypeFunction_close, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -741,7 +741,7 @@ static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_ping5Body(JSC::JS EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto data = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.ping(WTFMove(data)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.ping(WTF::move(data)); }))); } static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_pingOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -820,7 +820,7 @@ static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_pong5Body(JSC::JS EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto data = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.pong(WTFMove(data)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.pong(WTF::move(data)); }))); } static inline JSC::EncodedJSValue jsWebSocketPrototypeFunction_pongOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -951,7 +951,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, WebSocket& impl) diff --git a/src/bun.js/bindings/webcore/JSWebSocket.h b/src/bun.js/bindings/webcore/JSWebSocket.h index 29f82e4eecc784..46f4a2ab1bc19d 100644 --- a/src/bun.js/bindings/webcore/JSWebSocket.h +++ b/src/bun.js/bindings/webcore/JSWebSocket.h @@ -33,7 +33,7 @@ class JSWebSocket : public JSEventTarget { using DOMWrapped = WebSocket; static JSWebSocket* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSWebSocket* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWebSocket(structure, *globalObject, WTFMove(impl)); + JSWebSocket* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWebSocket(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSWorker.cpp b/src/bun.js/bindings/webcore/JSWorker.cpp index bf44513e49833b..ce2c8773755cfe 100644 --- a/src/bun.js/bindings/webcore/JSWorker.cpp +++ b/src/bun.js/bindings/webcore/JSWorker.cpp @@ -194,7 +194,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: std::optional> seq = convert>(*lexicalGlobalObject, array); RETURN_IF_EXCEPTION(throwScope, {}); if (seq) { - options.preloadModules = WTFMove(*seq); + options.preloadModules = WTF::move(*seq); options.preloadModules.removeAllMatching([](const String& str) { return str.isEmpty(); }); @@ -265,7 +265,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: env.add(key.impl()->isolatedCopy(), str); } - options.env.emplace(WTFMove(env)); + options.env.emplace(WTF::move(env)); } // needed to match the coercion behavior of `String(value)`, which returns a descriptive @@ -303,7 +303,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: execArgv.append(str); }); RETURN_IF_EXCEPTION(throwScope, {}); - options.execArgv.emplace(WTFMove(execArgv)); + options.execArgv.emplace(WTF::move(execArgv)); } } @@ -315,7 +315,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: // If node:worker_threads has not been imported, environment data will not be set up yet. valueToTransfer->putDirectIndex(globalObject, 1, environmentData ? environmentData : jsUndefined()); - ExceptionOr> serialized = SerializedScriptValue::create(*lexicalGlobalObject, valueToTransfer, WTFMove(transferList), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); + ExceptionOr> serialized = SerializedScriptValue::create(*lexicalGlobalObject, valueToTransfer, WTF::move(transferList), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); if (serialized.hasException()) { WebCore::propagateException(*lexicalGlobalObject, throwScope, serialized.releaseException()); RELEASE_AND_RETURN(throwScope, {}); @@ -324,7 +324,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: Vector transferredPorts; if (!ports.isEmpty()) { - auto disentangleResult = MessagePort::disentanglePorts(WTFMove(ports)); + auto disentangleResult = MessagePort::disentanglePorts(WTF::move(ports)); if (disentangleResult.hasException()) { WebCore::propagateException(*lexicalGlobalObject, throwScope, disentangleResult.releaseException()); RELEASE_AND_RETURN(throwScope, {}); @@ -333,14 +333,14 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor:: } options.workerDataAndEnvironmentData = serialized.releaseReturnValue(); - options.dataMessagePorts = WTFMove(transferredPorts); + options.dataMessagePorts = WTF::move(transferredPorts); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = Worker::create(*context, WTFMove(scriptUrl), WTFMove(options)); + auto object = Worker::create(*context, WTF::move(scriptUrl), WTF::move(options)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); @@ -425,7 +425,7 @@ void JSWorkerPrototype::finishCreation(VM& vm) const ClassInfo JSWorker::s_info = { "Worker"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWorker) }; JSWorker::JSWorker(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSEventTarget(structure, globalObject, WTFMove(impl)) + : JSEventTarget(structure, globalObject, WTF::move(impl)) { } @@ -567,7 +567,7 @@ static inline JSC::EncodedJSValue jsWorkerPrototypeFunction_postMessage1Body(JSC EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); auto transfer = convert>(*lexicalGlobalObject, argument1.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTFMove(message), WTFMove(transfer)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTF::move(message), WTF::move(transfer)); }))); } static inline JSC::EncodedJSValue jsWorkerPrototypeFunction_postMessage2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -590,12 +590,12 @@ static inline JSC::EncodedJSValue jsWorkerPrototypeFunction_postMessage2Body(JSC if (transferListValue) { auto transferList = convert>(*lexicalGlobalObject, transferListValue); RETURN_IF_EXCEPTION(throwScope, {}); - options.transfer = WTFMove(transferList); + options.transfer = WTF::move(transferList); } } RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTFMove(message), WTFMove(options)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.postMessage(*jsCast(lexicalGlobalObject), WTF::move(message), WTF::move(options)); }))); } static inline JSC::EncodedJSValue jsWorkerPrototypeFunction_postMessageOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation::ClassParameter castedThis) @@ -782,7 +782,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Worker& impl) diff --git a/src/bun.js/bindings/webcore/JSWorker.h b/src/bun.js/bindings/webcore/JSWorker.h index 736d7ac5fe85f8..2aae0754ccd0f5 100644 --- a/src/bun.js/bindings/webcore/JSWorker.h +++ b/src/bun.js/bindings/webcore/JSWorker.h @@ -33,7 +33,7 @@ class JSWorker : public JSEventTarget { using DOMWrapped = Worker; static JSWorker* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSWorker* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWorker(structure, *globalObject, WTFMove(impl)); + JSWorker* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWorker(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSWritableStream.cpp b/src/bun.js/bindings/webcore/JSWritableStream.cpp index 2a3d29a29177eb..8a773654de8f59 100644 --- a/src/bun.js/bindings/webcore/JSWritableStream.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStream.cpp @@ -107,11 +107,11 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWritableStreamDOMConst EnsureStillAliveScope argument1 = callFrame->argument(1); auto strategy = argument1.value().isUndefined() ? std::optional::ReturnType>() : std::optional::ReturnType>(convert(*lexicalGlobalObject, argument1.value())); RETURN_IF_EXCEPTION(throwScope, {}); - auto object = WritableStream::create(*castedThis->globalObject(), WTFMove(underlyingSink), WTFMove(strategy)); + auto object = WritableStream::create(*castedThis->globalObject(), WTF::move(underlyingSink), WTF::move(strategy)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); static_assert(TypeOrExceptionOrUnderlyingType::isRef); - auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + auto jsValue = toJSNewlyCreated>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTF::move(object)); if constexpr (IsExceptionOr) RETURN_IF_EXCEPTION(throwScope, {}); setSubclassStructureIfNeeded(lexicalGlobalObject, callFrame, asObject(jsValue)); @@ -159,7 +159,7 @@ void JSWritableStreamPrototype::finishCreation(VM& vm) const ClassInfo JSWritableStream::s_info = { "WritableStream"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWritableStream) }; JSWritableStream::JSWritableStream(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -295,7 +295,7 @@ void JSWritableStreamOwner::finalize(JSC::Handle handle, void* con JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, WritableStream& impl) diff --git a/src/bun.js/bindings/webcore/JSWritableStream.h b/src/bun.js/bindings/webcore/JSWritableStream.h index dd5cbc885fc1f4..424e6a16d6da19 100644 --- a/src/bun.js/bindings/webcore/JSWritableStream.h +++ b/src/bun.js/bindings/webcore/JSWritableStream.h @@ -31,7 +31,7 @@ class JSWritableStream : public JSDOMWrapper { using Base = JSDOMWrapper; static JSWritableStream* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSWritableStream* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWritableStream(structure, *globalObject, WTFMove(impl)); + JSWritableStream* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWritableStream(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp b/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp index 225e0ff17bb7c9..512235aa3e2051 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp @@ -108,7 +108,7 @@ void JSWritableStreamSinkPrototype::finishCreation(VM& vm) const ClassInfo JSWritableStreamSink::s_info = { "WritableStreamSink"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWritableStreamSink) }; JSWritableStreamSink::JSWritableStreamSink(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -153,7 +153,7 @@ static inline JSC::EncodedJSValue jsWritableStreamSinkPrototypeFunction_writeBod EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto value = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.write(*context, WTFMove(value), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.write(*context, WTF::move(value), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsWritableStreamSinkPrototypeFunction_write, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -188,7 +188,7 @@ static inline JSC::EncodedJSValue jsWritableStreamSinkPrototypeFunction_errorBod EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); auto message = convert(*lexicalGlobalObject, argument0.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.error(WTFMove(message)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.error(WTF::move(message)); }))); } JSC_DEFINE_HOST_FUNCTION(jsWritableStreamSinkPrototypeFunction_error, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -232,7 +232,7 @@ void JSWritableStreamSinkOwner::finalize(JSC::Handle handle, void* JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, WritableStreamSink& impl) diff --git a/src/bun.js/bindings/webcore/JSWritableStreamSink.h b/src/bun.js/bindings/webcore/JSWritableStreamSink.h index a6cac9d2372678..ec98d4f23e0b6e 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamSink.h +++ b/src/bun.js/bindings/webcore/JSWritableStreamSink.h @@ -31,7 +31,7 @@ class JSWritableStreamSink : public JSDOMWrapper { using Base = JSDOMWrapper; static JSWritableStreamSink* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSWritableStreamSink* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWritableStreamSink(structure, *globalObject, WTFMove(impl)); + JSWritableStreamSink* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSWritableStreamSink(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcore/MessageEvent.cpp b/src/bun.js/bindings/webcore/MessageEvent.cpp index a050adfe02d882..113a7eb2103f54 100644 --- a/src/bun.js/bindings/webcore/MessageEvent.cpp +++ b/src/bun.js/bindings/webcore/MessageEvent.cpp @@ -49,30 +49,30 @@ inline MessageEvent::MessageEvent(const AtomString& type, Init&& initializer, Is , m_data(JSValueTag {}) , m_origin(initializer.origin) , m_lastEventId(initializer.lastEventId) - , m_source(WTFMove(initializer.source)) - , m_ports(WTFMove(initializer.ports)) + , m_source(WTF::move(initializer.source)) + , m_ports(WTF::move(initializer.ports)) , m_jsData(initializer.data) { } inline MessageEvent::MessageEvent(const AtomString& type, DataType&& data, const String& origin, const String& lastEventId, RefPtr&& source, Vector>&& ports) : Event(type, CanBubble::No, IsCancelable::No) - , m_data(WTFMove(data)) + , m_data(WTF::move(data)) , m_origin(origin) , m_lastEventId(lastEventId) - , m_source(WTFMove(source)) - , m_ports(WTFMove(ports)) + , m_source(WTF::move(source)) + , m_ports(WTF::move(ports)) { } Ref MessageEvent::create(const AtomString& type, DataType&& data, const String& origin, const String& lastEventId, RefPtr&& source, Vector>&& ports) { - return adoptRef(*new MessageEvent(type, WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports))); + return adoptRef(*new MessageEvent(type, WTF::move(data), origin, lastEventId, WTF::move(source), WTF::move(ports))); } Ref MessageEvent::create(DataType&& data, const String& origin, const String& lastEventId, RefPtr&& source, Vector>&& ports) { - return create(eventNames().messageEvent, WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports)); + return create(eventNames().messageEvent, WTF::move(data), origin, lastEventId, WTF::move(source), WTF::move(ports)); } Ref MessageEvent::createForBindings() @@ -82,14 +82,14 @@ Ref MessageEvent::createForBindings() Ref MessageEvent::create(const AtomString& type, Init&& initializer, IsTrusted isTrusted) { - return adoptRef(*new MessageEvent(type, WTFMove(initializer), isTrusted)); + return adoptRef(*new MessageEvent(type, WTF::move(initializer), isTrusted)); } MessageEvent::~MessageEvent() = default; auto MessageEvent::create(JSC::JSGlobalObject& globalObject, Ref&& data, RefPtr&& source, Vector>&& ports) -> MessageEventWithStrongData { - return create(globalObject, WTFMove(data), {}, {}, WTFMove(source), WTFMove(ports)); + return create(globalObject, WTF::move(data), {}, {}, WTF::move(source), WTF::move(ports)); } auto MessageEvent::create(JSC::JSGlobalObject& globalObject, Ref&& data, const String& origin, const String& lastEventId, RefPtr&& source, Vector>&& ports) -> MessageEventWithStrongData @@ -107,13 +107,13 @@ auto MessageEvent::create(JSC::JSGlobalObject& globalObject, Ref strongData(vm, deserialized); auto& eventType = didFail ? eventNames().messageerrorEvent : eventNames().messageEvent; - auto event = adoptRef(*new MessageEvent(eventType, WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports))); + auto event = adoptRef(*new MessageEvent(eventType, WTF::move(data), origin, lastEventId, WTF::move(source), WTF::move(ports))); JSC::Strong strongWrapper(vm, JSC::jsCast(toJS(&globalObject, JSC::jsCast(&globalObject), event.get()))); // Since we've already deserialized the SerializedScriptValue, cache the result so we don't have to deserialize // again the next time JSMessageEvent::data() gets called by the main world. event->cachedData().set(vm, strongWrapper.get(), deserialized); - return MessageEventWithStrongData { event, WTFMove(strongWrapper) }; + return MessageEventWithStrongData { event, WTF::move(strongWrapper) }; } void MessageEvent::initMessageEvent(const AtomString& type, bool canBubble, bool cancelable, JSValue data, const String& origin, const String& lastEventId, RefPtr&& source, Vector>&& ports) @@ -133,8 +133,8 @@ void MessageEvent::initMessageEvent(const AtomString& type, bool canBubble, bool m_cachedData.clear(); m_origin = origin; m_lastEventId = lastEventId; - m_source = WTFMove(source); - m_ports = WTFMove(ports); + m_source = WTF::move(source); + m_ports = WTF::move(ports); m_cachedPorts.clear(); } diff --git a/src/bun.js/bindings/webcore/MessagePort.cpp b/src/bun.js/bindings/webcore/MessagePort.cpp index a99084d3878987..8cdca2d9790a17 100644 --- a/src/bun.js/bindings/webcore/MessagePort.cpp +++ b/src/bun.js/bindings/webcore/MessagePort.cpp @@ -95,7 +95,7 @@ void MessagePort::notifyMessageAvailable(const MessagePortIdentifier& identifier if (!scriptExecutionContextIdentifier) return; - ScriptExecutionContext::ensureOnContextThread(*scriptExecutionContextIdentifier, [weakPort = WTFMove(weakPort)](auto&) { + ScriptExecutionContext::ensureOnContextThread(*scriptExecutionContextIdentifier, [weakPort = WTF::move(weakPort)](auto&) { if (RefPtr port = weakPort.get()) port->messageAvailable(); }); @@ -159,7 +159,7 @@ ExceptionOr MessagePort::postMessage(JSC::JSGlobalObject& state, JSC::JSVa // LOG(MessagePorts, "Attempting to post message to port %s (to be received by port %s)", m_identifier.logString().utf8().data(), m_remoteIdentifier.logString().utf8().data()); Vector> ports; - auto messageData = SerializedScriptValue::create(state, messageValue, WTFMove(options.transfer), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); + auto messageData = SerializedScriptValue::create(state, messageValue, WTF::move(options.transfer), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); if (messageData.hasException()) return messageData.releaseException(); @@ -175,15 +175,15 @@ ExceptionOr MessagePort::postMessage(JSC::JSGlobalObject& state, JSC::JSVa return Exception { ExceptionCode::DataCloneError }; } - auto disentangleResult = MessagePort::disentanglePorts(WTFMove(ports)); + auto disentangleResult = MessagePort::disentanglePorts(WTF::move(ports)); if (disentangleResult.hasException()) return disentangleResult.releaseException(); transferredPorts = disentangleResult.releaseReturnValue(); } - MessageWithMessagePorts message { messageData.releaseReturnValue(), WTFMove(transferredPorts) }; + MessageWithMessagePorts message { messageData.releaseReturnValue(), WTF::move(transferredPorts) }; - MessagePortChannelProvider::fromContext(*protectedScriptExecutionContext()).postMessageToRemote(WTFMove(message), m_remoteIdentifier); + MessagePortChannelProvider::fromContext(*protectedScriptExecutionContext()).postMessageToRemote(WTF::move(message), m_remoteIdentifier); return {}; } @@ -254,7 +254,7 @@ void MessagePort::dispatchMessages() return; auto messagesTakenHandler = [this, protectedThis = Ref { *this }](Vector&& messages, CompletionHandler&& completionCallback) mutable { - auto scopeExit = makeScopeExit(WTFMove(completionCallback)); + auto scopeExit = makeScopeExit(WTF::move(completionCallback)); // LOG(MessagePorts, "MessagePort %s (%p) dispatching %zu messages", m_identifier.logString().utf8().data(), this, messages.size()); @@ -272,7 +272,7 @@ void MessagePort::dispatchMessages() if (Zig::GlobalObject::scriptExecutionStatus(globalObject, globalObject) != ScriptExecutionStatus::Running) return; - auto ports = MessagePort::entanglePorts(*context, WTFMove(message.transferredPorts)); + auto ports = MessagePort::entanglePorts(*context, WTF::move(message.transferredPorts)); if (scope.exception()) [[unlikely]] { // Currently, we assume that the only way we can get here is if we have a termination. RELEASE_ASSERT(vm->hasPendingTerminationException()); @@ -280,18 +280,18 @@ void MessagePort::dispatchMessages() } // Per specification, each MessagePort object has a task source called the port message queue. - // queueTaskKeepingObjectAlive(context, *this, TaskSource::PostedMessageQueue, [this, event = WTFMove(event)] { + // queueTaskKeepingObjectAlive(context, *this, TaskSource::PostedMessageQueue, [this, event = WTF::move(event)] { // dispatchEvent(event.event); // }); - ScriptExecutionContext::postTaskTo(context->identifier(), [protectedThis = Ref { *this }, ports = WTFMove(ports), message = WTFMove(message)](ScriptExecutionContext& context) mutable { - auto event = MessageEvent::create(*context.jsGlobalObject(), message.message.releaseNonNull(), {}, {}, {}, WTFMove(ports)); + ScriptExecutionContext::postTaskTo(context->identifier(), [protectedThis = Ref { *this }, ports = WTF::move(ports), message = WTF::move(message)](ScriptExecutionContext& context) mutable { + auto event = MessageEvent::create(*context.jsGlobalObject(), message.message.releaseNonNull(), {}, {}, {}, WTF::move(ports)); protectedThis->dispatchEvent(event.event); }); } }; - MessagePortChannelProvider::fromContext(*context).takeAllMessagesForPort(m_identifier, WTFMove(messagesTakenHandler)); + MessagePortChannelProvider::fromContext(*context).takeAllMessagesForPort(m_identifier, WTF::move(messagesTakenHandler)); } JSValue MessagePort::tryTakeMessage(JSGlobalObject* lexicalGlobalObject) @@ -305,9 +305,9 @@ JSValue MessagePort::tryTakeMessage(JSGlobalObject* lexicalGlobalObject) if (!messageWithPorts) return jsUndefined(); - auto ports = MessagePort::entanglePorts(*context, WTFMove(messageWithPorts->transferredPorts)); + auto ports = MessagePort::entanglePorts(*context, WTF::move(messageWithPorts->transferredPorts)); auto message = messageWithPorts->message.releaseNonNull(); - return message->deserialize(*lexicalGlobalObject, lexicalGlobalObject, WTFMove(ports), SerializationErrorMode::NonThrowing); + return message->deserialize(*lexicalGlobalObject, lexicalGlobalObject, WTF::move(ports), SerializationErrorMode::NonThrowing); } void MessagePort::dispatchEvent(Event& event) @@ -371,7 +371,7 @@ Vector> MessagePort::entanglePorts(ScriptExecutionContext& c return {}; return WTF::map(transferredPorts, [&](auto& port) -> RefPtr { - return MessagePort::entangle(context, WTFMove(port)); + return MessagePort::entangle(context, WTF::move(port)); }); } @@ -430,7 +430,7 @@ bool MessagePort::addEventListener(const AtomString& eventType, Ref MessagePortChannel::tryTakeMessageForPort auto message = m_pendingMessages[i].first(); m_pendingMessages[i].removeAt(0); - return WTFMove(message); + return WTF::move(message); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp b/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp index 62b9818bbbe1ea..4524c4fe1e72c6 100644 --- a/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp +++ b/src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp @@ -61,19 +61,19 @@ void MessagePortChannelProviderImpl::messagePortClosed(const MessagePortIdentifi void MessagePortChannelProviderImpl::postMessageToRemote(MessageWithMessagePorts&& message, const MessagePortIdentifier& remoteTarget) { - if (m_registry.didPostMessageToRemote(WTFMove(message), remoteTarget)) + if (m_registry.didPostMessageToRemote(WTF::move(message), remoteTarget)) MessagePort::notifyMessageAvailable(remoteTarget); } void MessagePortChannelProviderImpl::takeAllMessagesForPort(const MessagePortIdentifier& port, CompletionHandler&&, CompletionHandler&&)>&& outerCallback) { // It is the responsibility of outerCallback to get itself to the appropriate thread (e.g. WebWorker thread) - auto callback = [outerCallback = WTFMove(outerCallback)](Vector&& messages, CompletionHandler&& messageDeliveryCallback) mutable { + auto callback = [outerCallback = WTF::move(outerCallback)](Vector&& messages, CompletionHandler&& messageDeliveryCallback) mutable { // ASSERT(isMainThread()); - outerCallback(WTFMove(messages), WTFMove(messageDeliveryCallback)); + outerCallback(WTF::move(messages), WTF::move(messageDeliveryCallback)); }; - m_registry.takeAllMessagesForPort(port, WTFMove(callback)); + m_registry.takeAllMessagesForPort(port, WTF::move(callback)); } std::optional MessagePortChannelProviderImpl::tryTakeMessageForPort(const MessagePortIdentifier& port) diff --git a/src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp b/src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp index 55f61f75c3d968..66ed5997cf50dc 100644 --- a/src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp +++ b/src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp @@ -135,7 +135,7 @@ bool MessagePortChannelRegistry::didPostMessageToRemote(MessageWithMessagePorts& return false; } - return channel->postMessageToRemote(WTFMove(message), remoteTarget); + return channel->postMessageToRemote(WTF::move(message), remoteTarget); } void MessagePortChannelRegistry::takeAllMessagesForPort(const MessagePortIdentifier& port, CompletionHandler&&, CompletionHandler&&)>&& callback) @@ -149,7 +149,7 @@ void MessagePortChannelRegistry::takeAllMessagesForPort(const MessagePortIdentif return; } - channel->takeAllMessagesForPort(port, WTFMove(callback)); + channel->takeAllMessagesForPort(port, WTF::move(callback)); } std::optional MessagePortChannelRegistry::tryTakeMessageForPort(const MessagePortIdentifier& port) diff --git a/src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp b/src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp index 5eab2ae951b4d3..c34988b5ce0272 100644 --- a/src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp +++ b/src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp @@ -33,15 +33,15 @@ namespace WebCore { NetworkLoadMetrics::NetworkLoadMetrics() = default; NetworkLoadMetrics::NetworkLoadMetrics(MonotonicTime&& redirectStart, MonotonicTime&& fetchStart, MonotonicTime&& domainLookupStart, MonotonicTime&& domainLookupEnd, MonotonicTime&& connectStart, MonotonicTime&& secureConnectionStart, MonotonicTime&& connectEnd, MonotonicTime&& requestStart, MonotonicTime&& responseStart, MonotonicTime&& responseEnd, MonotonicTime&& workerStart, String&& protocol, uint16_t redirectCount, bool complete, bool cellular, bool expensive, bool constrained, bool multipath, bool isReusedConnection, bool failsTAOCheck, bool hasCrossOriginRedirect, PrivacyStance privacyStance, uint64_t responseBodyBytesReceived, uint64_t responseBodyDecodedSize, RefPtr&& additionalNetworkLoadMetricsForWebInspector) - : redirectStart(WTFMove(redirectStart)) - , fetchStart(WTFMove(fetchStart)) - , domainLookupStart(WTFMove(domainLookupStart)) - , domainLookupEnd(WTFMove(domainLookupEnd)) - , connectStart(WTFMove(connectStart)) - , secureConnectionStart(WTFMove(secureConnectionStart)) - , connectEnd(WTFMove(connectEnd)) - , requestStart(WTFMove(requestStart)) - , responseStart(WTFMove(responseStart)) + : redirectStart(WTF::move(redirectStart)) + , fetchStart(WTF::move(fetchStart)) + , domainLookupStart(WTF::move(domainLookupStart)) + , domainLookupEnd(WTF::move(domainLookupEnd)) + , connectStart(WTF::move(connectStart)) + , secureConnectionStart(WTF::move(secureConnectionStart)) + , connectEnd(WTF::move(connectEnd)) + , requestStart(WTF::move(requestStart)) + , responseStart(WTF::move(responseStart)) , responseEnd(responseEnd) , workerStart(workerStart) , protocol(protocol) @@ -57,7 +57,7 @@ NetworkLoadMetrics::NetworkLoadMetrics(MonotonicTime&& redirectStart, MonotonicT , privacyStance(privacyStance) , responseBodyBytesReceived(responseBodyBytesReceived) , responseBodyDecodedSize(responseBodyDecodedSize) - , additionalNetworkLoadMetricsForWebInspector(WTFMove(additionalNetworkLoadMetricsForWebInspector)) + , additionalNetworkLoadMetricsForWebInspector(WTF::move(additionalNetworkLoadMetricsForWebInspector)) { } @@ -169,16 +169,16 @@ NetworkLoadMetrics NetworkLoadMetrics::isolatedCopy() const Ref AdditionalNetworkLoadMetricsForWebInspector::create(NetworkLoadPriority&& priority, String&& remoteAddress, String&& connectionIdentifier, String&& tlsProtocol, String&& tlsCipher, HTTPHeaderMap&& requestHeaders, uint64_t requestHeaderBytesSent, uint64_t responseHeaderBytesReceived, uint64_t requestBodyBytesSent, bool isProxyConnection) { - return adoptRef(*new AdditionalNetworkLoadMetricsForWebInspector(WTFMove(priority), WTFMove(remoteAddress), WTFMove(connectionIdentifier), WTFMove(tlsProtocol), WTFMove(tlsCipher), WTFMove(requestHeaders), requestHeaderBytesSent, responseHeaderBytesReceived, requestBodyBytesSent, isProxyConnection)); + return adoptRef(*new AdditionalNetworkLoadMetricsForWebInspector(WTF::move(priority), WTF::move(remoteAddress), WTF::move(connectionIdentifier), WTF::move(tlsProtocol), WTF::move(tlsCipher), WTF::move(requestHeaders), requestHeaderBytesSent, responseHeaderBytesReceived, requestBodyBytesSent, isProxyConnection)); } AdditionalNetworkLoadMetricsForWebInspector::AdditionalNetworkLoadMetricsForWebInspector(NetworkLoadPriority&& priority, String&& remoteAddress, String&& connectionIdentifier, String&& tlsProtocol, String&& tlsCipher, HTTPHeaderMap&& requestHeaders, uint64_t requestHeaderBytesSent, uint64_t responseHeaderBytesReceived, uint64_t requestBodyBytesSent, bool isProxyConnection) - : priority(WTFMove(priority)) - , remoteAddress(WTFMove(remoteAddress)) - , connectionIdentifier(WTFMove(connectionIdentifier)) - , tlsProtocol(WTFMove(tlsProtocol)) - , tlsCipher(WTFMove(tlsCipher)) - , requestHeaders(WTFMove(requestHeaders)) + : priority(WTF::move(priority)) + , remoteAddress(WTF::move(remoteAddress)) + , connectionIdentifier(WTF::move(connectionIdentifier)) + , tlsProtocol(WTF::move(tlsProtocol)) + , tlsCipher(WTF::move(tlsCipher)) + , requestHeaders(WTF::move(requestHeaders)) , requestHeaderBytesSent(requestHeaderBytesSent) , responseHeaderBytesReceived(responseHeaderBytesReceived) , requestBodyBytesSent(requestBodyBytesSent) diff --git a/src/bun.js/bindings/webcore/Performance.cpp b/src/bun.js/bindings/webcore/Performance.cpp index 5d3a885db2cb89..f5250082177e6c 100644 --- a/src/bun.js/bindings/webcore/Performance.cpp +++ b/src/bun.js/bindings/webcore/Performance.cpp @@ -288,10 +288,10 @@ void Performance::addResourceTiming(ResourceTiming&& resourceTiming) { ASSERT(scriptExecutionContext()); - auto entry = PerformanceResourceTiming::create(m_timeOrigin, WTFMove(resourceTiming)); + auto entry = PerformanceResourceTiming::create(m_timeOrigin, WTF::move(resourceTiming)); if (m_waitingForBackupBufferToBeProcessed) { - m_backupResourceTimingBuffer.append(WTFMove(entry)); + m_backupResourceTimingBuffer.append(WTF::move(entry)); return; } @@ -304,14 +304,14 @@ void Performance::addResourceTiming(ResourceTiming&& resourceTiming) if (isResourceTimingBufferFull()) { // ASSERT(!m_resourceTimingBufferFullTimer.isActive()); - m_backupResourceTimingBuffer.append(WTFMove(entry)); + m_backupResourceTimingBuffer.append(WTF::move(entry)); m_waitingForBackupBufferToBeProcessed = true; // m_resourceTimingBufferFullTimer.startOneShot(0_s); return; } queueEntry(entry.get()); - m_resourceTimingBuffer.append(WTFMove(entry)); + m_resourceTimingBuffer.append(WTF::move(entry)); } bool Performance::isResourceTimingBufferFull() const @@ -326,7 +326,7 @@ bool Performance::isResourceTimingBufferFull() const // while (!m_backupResourceTimingBuffer.isEmpty()) { // auto beforeCount = m_backupResourceTimingBuffer.size(); -// auto backupBuffer = WTFMove(m_backupResourceTimingBuffer); +// auto backupBuffer = WTF::move(m_backupResourceTimingBuffer); // ASSERT(m_backupResourceTimingBuffer.isEmpty()); // if (isResourceTimingBufferFull()) { @@ -371,7 +371,7 @@ ExceptionOr> Performance::mark(JSC::JSGlobalObject& globalO if (!m_userTiming) m_userTiming = makeUnique(*this); - auto mark = m_userTiming->mark(globalObject, markName, WTFMove(markOptions)); + auto mark = m_userTiming->mark(globalObject, markName, WTF::move(markOptions)); if (mark.hasException()) return mark.releaseException(); @@ -391,7 +391,7 @@ ExceptionOr> Performance::measure(JSC::JSGlobalObject& g if (!m_userTiming) m_userTiming = makeUnique(*this); - auto measure = m_userTiming->measure(globalObject, measureName, WTFMove(startOrMeasureOptions), endMark); + auto measure = m_userTiming->measure(globalObject, measureName, WTF::move(startOrMeasureOptions), endMark); if (measure.hasException()) return measure.releaseException(); diff --git a/src/bun.js/bindings/webcore/PerformanceMark.cpp b/src/bun.js/bindings/webcore/PerformanceMark.cpp index c61bd847a62aa2..d6530ed8091681 100644 --- a/src/bun.js/bindings/webcore/PerformanceMark.cpp +++ b/src/bun.js/bindings/webcore/PerformanceMark.cpp @@ -79,7 +79,7 @@ ExceptionOr> PerformanceMark::create(JSC::JSGlobalObject& g PerformanceMark::PerformanceMark(const String& name, double startTime, RefPtr&& serializedDetail) : PerformanceEntry(name, startTime, startTime) - , m_serializedDetail(WTFMove(serializedDetail)) + , m_serializedDetail(WTF::move(serializedDetail)) { } diff --git a/src/bun.js/bindings/webcore/PerformanceMeasure.cpp b/src/bun.js/bindings/webcore/PerformanceMeasure.cpp index 358257de437e29..9f8fc2e421c2e6 100644 --- a/src/bun.js/bindings/webcore/PerformanceMeasure.cpp +++ b/src/bun.js/bindings/webcore/PerformanceMeasure.cpp @@ -41,12 +41,12 @@ size_t PerformanceMeasure::memoryCost() const ExceptionOr> PerformanceMeasure::create(const String& name, double startTime, double endTime, RefPtr&& serializedDetail) { - return adoptRef(*new PerformanceMeasure(name, startTime, endTime, WTFMove(serializedDetail))); + return adoptRef(*new PerformanceMeasure(name, startTime, endTime, WTF::move(serializedDetail))); } PerformanceMeasure::PerformanceMeasure(const String& name, double startTime, double endTime, RefPtr&& serializedDetail) : PerformanceEntry(name, startTime, endTime) - , m_serializedDetail(WTFMove(serializedDetail)) + , m_serializedDetail(WTF::move(serializedDetail)) { } diff --git a/src/bun.js/bindings/webcore/PerformanceObserver.cpp b/src/bun.js/bindings/webcore/PerformanceObserver.cpp index 5efb33e00bae03..73b2c3e21cec89 100644 --- a/src/bun.js/bindings/webcore/PerformanceObserver.cpp +++ b/src/bun.js/bindings/webcore/PerformanceObserver.cpp @@ -36,7 +36,7 @@ namespace WebCore { PerformanceObserver::PerformanceObserver(ScriptExecutionContext& scriptExecutionContext, Ref&& callback) - : m_callback(WTFMove(callback)) + : m_callback(WTF::move(callback)) { // if (is(scriptExecutionContext)) { // auto& document = downcast(scriptExecutionContext); @@ -138,7 +138,7 @@ void PerformanceObserver::deliver() return; Vector> entries = std::exchange(m_entriesToDeliver, {}); - auto list = PerformanceObserverEntryList::create(WTFMove(entries)); + auto list = PerformanceObserverEntryList::create(WTF::move(entries)); // InspectorInstrumentation::willFireObserverCallback(*context, "PerformanceObserver"_s); m_callback->handleEvent(*this, list, *this); diff --git a/src/bun.js/bindings/webcore/PerformanceObserver.h b/src/bun.js/bindings/webcore/PerformanceObserver.h index 095d8a5ba9fb0f..1049dce4de5d17 100644 --- a/src/bun.js/bindings/webcore/PerformanceObserver.h +++ b/src/bun.js/bindings/webcore/PerformanceObserver.h @@ -48,7 +48,7 @@ class PerformanceObserver : public RefCounted { static Ref create(ScriptExecutionContext& context, Ref&& callback) { - return adoptRef(*new PerformanceObserver(context, WTFMove(callback))); + return adoptRef(*new PerformanceObserver(context, WTF::move(callback))); } static Vector supportedEntryTypes(ScriptExecutionContext&); diff --git a/src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp b/src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp index a9bd8f8ccdda2c..e921ca7d18efea 100644 --- a/src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp +++ b/src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp @@ -32,11 +32,11 @@ namespace WebCore { Ref PerformanceObserverEntryList::create(Vector>&& entries) { - return adoptRef(*new PerformanceObserverEntryList(WTFMove(entries))); + return adoptRef(*new PerformanceObserverEntryList(WTF::move(entries))); } PerformanceObserverEntryList::PerformanceObserverEntryList(Vector>&& entries) - : m_entries(WTFMove(entries)) + : m_entries(WTF::move(entries)) { ASSERT(!m_entries.isEmpty()); diff --git a/src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp b/src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp index ecbe7b114b27c1..582e3c018fc4fe 100644 --- a/src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp +++ b/src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp @@ -91,13 +91,13 @@ static double entryEndTime(MonotonicTime timeOrigin, const ResourceTiming& resou Ref PerformanceResourceTiming::create(MonotonicTime timeOrigin, ResourceTiming&& resourceTiming) { - return adoptRef(*new PerformanceResourceTiming(timeOrigin, WTFMove(resourceTiming))); + return adoptRef(*new PerformanceResourceTiming(timeOrigin, WTF::move(resourceTiming))); } PerformanceResourceTiming::PerformanceResourceTiming(MonotonicTime timeOrigin, ResourceTiming&& resourceTiming) : PerformanceEntry(resourceTiming.url().string(), entryStartTime(timeOrigin, resourceTiming), entryEndTime(timeOrigin, resourceTiming)) , m_timeOrigin(timeOrigin) - , m_resourceTiming(WTFMove(resourceTiming)) + , m_resourceTiming(WTF::move(resourceTiming)) , m_serverTiming(m_resourceTiming.populateServerTiming()) { } diff --git a/src/bun.js/bindings/webcore/PerformanceServerTiming.cpp b/src/bun.js/bindings/webcore/PerformanceServerTiming.cpp index 484087699eb205..29e2c4b6c012c6 100644 --- a/src/bun.js/bindings/webcore/PerformanceServerTiming.cpp +++ b/src/bun.js/bindings/webcore/PerformanceServerTiming.cpp @@ -31,13 +31,13 @@ namespace WebCore { Ref PerformanceServerTiming::create(String&& name, double duration, String&& description) { - return adoptRef(*new PerformanceServerTiming(WTFMove(name), duration, WTFMove(description))); + return adoptRef(*new PerformanceServerTiming(WTF::move(name), duration, WTF::move(description))); } PerformanceServerTiming::PerformanceServerTiming(String&& name, double duration, String&& description) - : m_name(WTFMove(name)) + : m_name(WTF::move(name)) , m_duration(duration) - , m_description(WTFMove(description)) + , m_description(WTF::move(description)) { } diff --git a/src/bun.js/bindings/webcore/PerformanceUserTiming.cpp b/src/bun.js/bindings/webcore/PerformanceUserTiming.cpp index d9d67ebb21b352..9870e42f39159f 100644 --- a/src/bun.js/bindings/webcore/PerformanceUserTiming.cpp +++ b/src/bun.js/bindings/webcore/PerformanceUserTiming.cpp @@ -43,7 +43,7 @@ namespace WebCore { using NavigationTimingFunction = unsigned long long (PerformanceTiming::*)() const; -static constexpr std::pair restrictedMarkMappings[] = { +static constexpr std::array, 21> restrictedMarkMappings { { { "connectEnd"_s, &PerformanceTiming::connectEnd }, { "connectStart"_s, &PerformanceTiming::connectStart }, { "domComplete"_s, &PerformanceTiming::domComplete }, @@ -65,7 +65,7 @@ static constexpr std::pair res { "secureConnectionStart"_s, &PerformanceTiming::secureConnectionStart }, { "unloadEventEnd"_s, &PerformanceTiming::unloadEventEnd }, { "unloadEventStart"_s, &PerformanceTiming::unloadEventStart }, -}; +} }; static constexpr SortedArrayMap restrictedMarkFunctions { restrictedMarkMappings }; bool PerformanceUserTiming::isRestrictedMarkName(const String& markName) @@ -125,7 +125,7 @@ ExceptionOr> PerformanceUserTiming::mark(JSC::JSGlobalObjec // InspectorInstrumentation::performanceMark(context.get(), markName, timestamp, nullptr); - auto mark = PerformanceMark::create(globalObject, context, markName, WTFMove(markOptions)); + auto mark = PerformanceMark::create(globalObject, context, markName, WTF::move(markOptions)); if (mark.hasException()) return mark.releaseException(); diff --git a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp index 11e6675ef9c1cf..77d99afb6ef7b8 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp @@ -143,7 +143,7 @@ bool ReadableStreamDefaultController::enqueue(RefPtr&& buffer) JSC::JSLockHolder lock(vm); auto scope = DECLARE_CATCH_SCOPE(vm); auto length = buffer->byteLength(); - auto value = JSC::JSUint8Array::create(&lexicalGlobalObject, lexicalGlobalObject.typedArrayStructureWithTypedArrayType(), WTFMove(buffer), 0, length); + auto value = JSC::JSUint8Array::create(&lexicalGlobalObject, lexicalGlobalObject.typedArrayStructureWithTypedArrayType(), WTF::move(buffer), 0, length); EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException()); RETURN_IF_EXCEPTION(scope, false); diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.cpp b/src/bun.js/bindings/webcore/ReadableStreamSink.cpp index d79e7d3581c1ce..67078d6ded5582 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/ReadableStreamSink.cpp @@ -33,7 +33,7 @@ namespace WebCore { ReadableStreamToSharedBufferSink::ReadableStreamToSharedBufferSink(Callback&& callback) - : m_callback { WTFMove(callback) } + : m_callback { WTF::move(callback) } { } @@ -61,8 +61,8 @@ void ReadableStreamToSharedBufferSink::close() void ReadableStreamToSharedBufferSink::error(String&& message) { - if (auto callback = WTFMove(m_callback)) - callback(Exception { TypeError, WTFMove(message) }); + if (auto callback = WTF::move(m_callback)) + callback(Exception { TypeError, WTF::move(message) }); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/ReadableStreamSink.h b/src/bun.js/bindings/webcore/ReadableStreamSink.h index 7db31e38abd425..68dfefb001ffaa 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamSink.h +++ b/src/bun.js/bindings/webcore/ReadableStreamSink.h @@ -47,7 +47,7 @@ class ReadableStreamSink : public RefCounted { class ReadableStreamToSharedBufferSink final : public ReadableStreamSink { public: using Callback = Function*>&&)>; - static Ref create(Callback&& callback) { return adoptRef(*new ReadableStreamToSharedBufferSink(WTFMove(callback))); } + static Ref create(Callback&& callback) { return adoptRef(*new ReadableStreamToSharedBufferSink(WTF::move(callback))); } void pipeFrom(ReadableStream&); void clearCallback() { m_callback = {}; } diff --git a/src/bun.js/bindings/webcore/ReadableStreamSource.cpp b/src/bun.js/bindings/webcore/ReadableStreamSource.cpp index e0537b418872b7..dfae6d6055be99 100644 --- a/src/bun.js/bindings/webcore/ReadableStreamSource.cpp +++ b/src/bun.js/bindings/webcore/ReadableStreamSource.cpp @@ -32,8 +32,8 @@ ReadableStreamSource::~ReadableStreamSource() = default; void ReadableStreamSource::start(ReadableStreamDefaultController&& controller, DOMPromiseDeferred&& promise) { ASSERT(!m_promise); - m_promise = makeUnique>(WTFMove(promise)); - m_controller = WTFMove(controller); + m_promise = makeUnique>(WTF::move(promise)); + m_controller = WTF::move(controller); setActive(); doStart(); @@ -44,7 +44,7 @@ void ReadableStreamSource::pull(DOMPromiseDeferred&& promise) ASSERT(!m_promise); ASSERT(m_controller); - m_promise = makeUnique>(WTFMove(promise)); + m_promise = makeUnique>(WTF::move(promise)); setActive(); doPull(); diff --git a/src/bun.js/bindings/webcore/RegisteredEventListener.h b/src/bun.js/bindings/webcore/RegisteredEventListener.h index a52890ef420670..54e9487aac6350 100644 --- a/src/bun.js/bindings/webcore/RegisteredEventListener.h +++ b/src/bun.js/bindings/webcore/RegisteredEventListener.h @@ -46,7 +46,7 @@ class RegisteredEventListener : public RefCounted { static Ref create(Ref&& listener, const Options& options) { - return adoptRef(*new RegisteredEventListener(WTFMove(listener), options)); + return adoptRef(*new RegisteredEventListener(WTF::move(listener), options)); } EventListener& callback() const { return m_callback; } @@ -63,7 +63,7 @@ class RegisteredEventListener : public RefCounted { , m_isPassive(options.passive) , m_isOnce(options.once) , m_wasRemoved(false) - , m_callback(WTFMove(listener)) + , m_callback(WTF::move(listener)) { } diff --git a/src/bun.js/bindings/webcore/ResourceTiming.cpp b/src/bun.js/bindings/webcore/ResourceTiming.cpp index 1c18ae6e85117e..f777f8a97ffd5f 100644 --- a/src/bun.js/bindings/webcore/ResourceTiming.cpp +++ b/src/bun.js/bindings/webcore/ResourceTiming.cpp @@ -97,11 +97,11 @@ ResourceTiming ResourceTiming::isolatedCopy() const& ResourceTiming ResourceTiming::isolatedCopy() && { return ResourceTiming { - WTFMove(m_url).isolatedCopy(), - WTFMove(m_initiatorType).isolatedCopy(), - // WTFMove(m_resourceLoadTiming).isolatedCopy(), - WTFMove(m_networkLoadMetrics).isolatedCopy(), - crossThreadCopy(WTFMove(m_serverTiming)) + WTF::move(m_url).isolatedCopy(), + WTF::move(m_initiatorType).isolatedCopy(), + // WTF::move(m_resourceLoadTiming).isolatedCopy(), + WTF::move(m_networkLoadMetrics).isolatedCopy(), + crossThreadCopy(WTF::move(m_serverTiming)) }; } diff --git a/src/bun.js/bindings/webcore/ResourceTiming.h b/src/bun.js/bindings/webcore/ResourceTiming.h index 996874cfe81c93..6abbb03bcecfb2 100644 --- a/src/bun.js/bindings/webcore/ResourceTiming.h +++ b/src/bun.js/bindings/webcore/ResourceTiming.h @@ -66,11 +66,11 @@ class ResourceTiming { private: ResourceTiming(const URL& url, const String& initiatorType, const NetworkLoadMetrics& networkLoadMetrics); ResourceTiming(URL&& url, String&& initiatorType, NetworkLoadMetrics&& networkLoadMetrics, Vector&& serverTiming) - : m_url(WTFMove(url)) - , m_initiatorType(WTFMove(initiatorType)) + : m_url(WTF::move(url)) + , m_initiatorType(WTF::move(initiatorType)) , m_resourceLoadTiming(ResourceLoadTiming()) - , m_networkLoadMetrics(WTFMove(networkLoadMetrics)) - , m_serverTiming(WTFMove(serverTiming)) + , m_networkLoadMetrics(WTF::move(networkLoadMetrics)) + , m_serverTiming(WTF::move(serverTiming)) { } diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp index 751a1bac48b75a..0240fbc8c0791f 100644 --- a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp +++ b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp @@ -1532,7 +1532,7 @@ class CloneSerializer : CloneBase { auto index = m_serializedVideoFrames.find(videoFrame.ptr()); if (index == notFound) { index = m_serializedVideoChunks.size(); - m_serializedVideoFrames.append(WTFMove(videoFrame)); + m_serializedVideoFrames.append(WTF::move(videoFrame)); } write(WebCodecsVideoFrameTag); write(static_cast(index)); @@ -1760,7 +1760,7 @@ class CloneSerializer : CloneBase { ArrayBufferContents contents; if (arrayBuffer->shareWith(contents)) { write(SharedArrayBufferTag); - m_sharedBuffers.append(WTFMove(contents)); + m_sharedBuffers.append(WTF::move(contents)); write(index); return true; } @@ -1960,7 +1960,7 @@ class CloneSerializer : CloneBase { write(TerminatorTag); return true; } - StructuredCloneableSerialize to_write = WTFMove(_cloneable.value()); + StructuredCloneableSerialize to_write = WTF::move(_cloneable.value()); write(to_write.tag); to_write.write(this, m_lexicalGlobalObject); return true; @@ -2878,14 +2878,14 @@ class CloneDeserializer : CloneBase { // { // if (!buffer.size()) // return std::make_pair(jsNull(), SerializationReturnCode::UnspecifiedError); - // CloneDeserializer deserializer(lexicalGlobalObject, globalObject, messagePorts, arrayBufferContentsArray, buffer, blobURLs, blobFilePaths, sharedBuffers, WTFMove(backingStores) + // CloneDeserializer deserializer(lexicalGlobalObject, globalObject, messagePorts, arrayBufferContentsArray, buffer, blobURLs, blobFilePaths, sharedBuffers, WTF::move(backingStores) // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) // , - // WTFMove(detachedOffscreenCanvases) + // WTF::move(detachedOffscreenCanvases) // #endif // #if ENABLE(WEB_RTC) // , - // WTFMove(detachedRTCDataChannels) + // WTF::move(detachedRTCDataChannels) // #endif // #if ENABLE(WEBASSEMBLY) // , @@ -2893,7 +2893,7 @@ class CloneDeserializer : CloneBase { // #endif // #if ENABLE(WEB_CODECS) // , - // WTFMove(serializedVideoChunks), WTFMove(serializedVideoFrames) + // WTF::move(serializedVideoChunks), WTF::move(serializedVideoFrames) // #endif // ); // if (!deserializer.isValid()) @@ -2927,11 +2927,11 @@ class CloneDeserializer : CloneBase { CloneDeserializer deserializer(lexicalGlobalObject, globalObject, messagePorts, arrayBufferContentsArray, std::span { buffer.begin(), buffer.end() }, blobURLs, blobFilePaths, sharedBuffers #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , - WTFMove(detachedOffscreenCanvases) + WTF::move(detachedOffscreenCanvases) #endif #if ENABLE(WEB_RTC) , - WTFMove(detachedRTCDataChannels) + WTF::move(detachedRTCDataChannels) #endif #if ENABLE(WEBASSEMBLY) , @@ -2939,7 +2939,7 @@ class CloneDeserializer : CloneBase { #endif #if ENABLE(WEB_CODECS) , - WTFMove(serializedVideoChunks), WTFMove(serializedVideoFrames) + WTF::move(serializedVideoChunks), WTF::move(serializedVideoFrames) #endif ); if (!deserializer.isValid()) @@ -2974,7 +2974,7 @@ class CloneDeserializer : CloneBase { return m_jsString; } const String& string() { return m_string; } - String takeString() { return WTFMove(m_string); } + String takeString() { return WTF::move(m_string); } private: String m_string; @@ -3033,14 +3033,14 @@ class CloneDeserializer : CloneBase { // , m_messagePorts(messagePorts) // , m_arrayBufferContents(arrayBufferContents) // , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0) - // , m_backingStores(WTFMove(backingStores)) + // , m_backingStores(WTF::move(backingStores)) // , m_imageBitmaps(m_backingStores.size()) // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) - // , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) + // , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) // , m_offscreenCanvases(m_detachedOffscreenCanvases.size()) // #endif // #if ENABLE(WEB_RTC) - // , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + // , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) // , m_rtcDataChannels(m_detachedRTCDataChannels.size()) // #endif // #if ENABLE(WEBASSEMBLY) @@ -3048,9 +3048,9 @@ class CloneDeserializer : CloneBase { // , m_wasmMemoryHandles(wasmMemoryHandles) // #endif // #if ENABLE(WEB_CODECS) - // , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) + // , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) // , m_videoChunks(m_serializedVideoChunks.size()) - // , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + // , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) // , m_videoFrames(m_serializedVideoFrames.size()) // #endif // { @@ -3087,11 +3087,11 @@ class CloneDeserializer : CloneBase { , m_arrayBufferContents(arrayBufferContents) , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0) #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) - , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) + , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) , m_offscreenCanvases(m_detachedOffscreenCanvases.size()) #endif #if ENABLE(WEB_RTC) - , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) , m_rtcDataChannels(m_detachedRTCDataChannels.size()) #endif #if ENABLE(WEBASSEMBLY) @@ -3099,9 +3099,9 @@ class CloneDeserializer : CloneBase { , m_wasmMemoryHandles(wasmMemoryHandles) #endif #if ENABLE(WEB_CODECS) - , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) + , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) , m_videoChunks(m_serializedVideoChunks.size()) - , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) , m_videoFrames(m_serializedVideoFrames.size()) #endif { @@ -3140,14 +3140,14 @@ class CloneDeserializer : CloneBase { // , m_blobURLs(blobURLs) // , m_blobFilePaths(blobFilePaths) // , m_sharedBuffers(sharedBuffers) - // , m_backingStores(WTFMove(backingStores)) + // , m_backingStores(WTF::move(backingStores)) // , m_imageBitmaps(m_backingStores.size()) // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) - // , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) + // , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) // , m_offscreenCanvases(m_detachedOffscreenCanvases.size()) // #endif // #if ENABLE(WEB_RTC) - // , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + // , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) // , m_rtcDataChannels(m_detachedRTCDataChannels.size()) // #endif // #if ENABLE(WEBASSEMBLY) @@ -3155,9 +3155,9 @@ class CloneDeserializer : CloneBase { // , m_wasmMemoryHandles(wasmMemoryHandles) // #endif // #if ENABLE(WEB_CODECS) - // , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) + // , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) // , m_videoChunks(m_serializedVideoChunks.size()) - // , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + // , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) // , m_videoFrames(m_serializedVideoFrames.size()) // #endif // { @@ -3197,11 +3197,11 @@ class CloneDeserializer : CloneBase { , m_blobFilePaths(blobFilePaths) , m_sharedBuffers(sharedBuffers) #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) - , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) + , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) , m_offscreenCanvases(m_detachedOffscreenCanvases.size()) #endif #if ENABLE(WEB_RTC) - , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) , m_rtcDataChannels(m_detachedRTCDataChannels.size()) #endif #if ENABLE(WEBASSEMBLY) @@ -3209,9 +3209,9 @@ class CloneDeserializer : CloneBase { , m_wasmMemoryHandles(wasmMemoryHandles) #endif #if ENABLE(WEB_CODECS) - , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) + , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) , m_videoChunks(m_serializedVideoChunks.size()) - , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) , m_videoFrames(m_serializedVideoFrames.size()) #endif { @@ -3954,7 +3954,7 @@ class CloneDeserializer : CloneBase { CryptoAlgorithmIdentifier hash; if (!read(hash)) return false; - result = CryptoKeyHMAC::importRaw(0, hash, WTFMove(keyData), extractable, usages); + result = CryptoKeyHMAC::importRaw(0, hash, WTF::move(keyData), extractable, usages); return true; } @@ -3968,7 +3968,7 @@ class CloneDeserializer : CloneBase { Vector keyData; if (!read(keyData)) return false; - result = CryptoKeyAES::importRaw(algorithm, WTFMove(keyData), extractable, usages); + result = CryptoKeyAES::importRaw(algorithm, WTF::move(keyData), extractable, usages); return true; } @@ -3999,7 +3999,7 @@ class CloneDeserializer : CloneBase { if (type == CryptoKeyAsymmetricTypeSubtag::Public) { auto keyData = CryptoKeyRSAComponents::createPublic(modulus, exponent); auto key = CryptoKeyRSA::create(algorithm, hash, isRestrictedToHash, *keyData, extractable, usages); - result = WTFMove(key); + result = WTF::move(key); return true; } @@ -4014,7 +4014,7 @@ class CloneDeserializer : CloneBase { if (!primeCount) { auto keyData = CryptoKeyRSAComponents::createPrivate(modulus, exponent, privateExponent); auto key = CryptoKeyRSA::create(algorithm, hash, isRestrictedToHash, *keyData, extractable, usages); - result = WTFMove(key); + result = WTF::move(key); return true; } @@ -4046,7 +4046,7 @@ class CloneDeserializer : CloneBase { auto keyData = CryptoKeyRSAComponents::createPrivateWithAdditionalData(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos); auto key = CryptoKeyRSA::create(algorithm, hash, isRestrictedToHash, *keyData, extractable, usages); - result = WTFMove(key); + result = WTF::move(key); return true; } @@ -4069,10 +4069,10 @@ class CloneDeserializer : CloneBase { switch (type) { case CryptoKeyAsymmetricTypeSubtag::Public: - result = CryptoKeyEC::importRaw(algorithm, curve->string(), WTFMove(keyData), extractable, usages); + result = CryptoKeyEC::importRaw(algorithm, curve->string(), WTF::move(keyData), extractable, usages); break; case CryptoKeyAsymmetricTypeSubtag::Private: - result = CryptoKeyEC::importPkcs8(algorithm, curve->string(), WTFMove(keyData), extractable, usages); + result = CryptoKeyEC::importPkcs8(algorithm, curve->string(), WTF::move(keyData), extractable, usages); break; } @@ -4093,7 +4093,7 @@ class CloneDeserializer : CloneBase { if (!read(keyData)) return false; - result = CryptoKeyOKP::importRaw(algorithm, namedCurve, WTFMove(keyData), extractable, usages); + result = CryptoKeyOKP::importRaw(algorithm, namedCurve, WTF::move(keyData), extractable, usages); return true; } @@ -4105,7 +4105,7 @@ class CloneDeserializer : CloneBase { Vector keyData; if (!read(keyData)) return false; - result = CryptoKeyRaw::create(algorithm, WTFMove(keyData), usages); + result = CryptoKeyRaw::create(algorithm, WTF::move(keyData), usages); return true; } @@ -4254,7 +4254,7 @@ class CloneDeserializer : CloneBase { // return {}; // TransformationMatrix matrix(m11, m12, m21, m22, m41, m42); - // return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), T::create(WTFMove(matrix), DOMMatrixReadOnly::Is2D::Yes)); + // return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), T::create(WTF::move(matrix), DOMMatrixReadOnly::Is2D::Yes)); // } else { // double m11; // if (!read(m11)) @@ -4306,7 +4306,7 @@ class CloneDeserializer : CloneBase { // return {}; // TransformationMatrix matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); - // return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), T::create(WTFMove(matrix), DOMMatrixReadOnly::Is2D::No)); + // return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), T::create(WTF::move(matrix), DOMMatrixReadOnly::Is2D::No)); // } // } @@ -4373,7 +4373,7 @@ class CloneDeserializer : CloneBase { // if (!m_imageBitmaps[index]) { // m_backingStores.at(index)->connect(*executionContext(m_lexicalGlobalObject)); - // m_imageBitmaps[index] = ImageBitmap::create(WTFMove(m_backingStores.at(index))); + // m_imageBitmaps[index] = ImageBitmap::create(WTF::move(m_backingStores.at(index))); // } // auto bitmap = m_imageBitmaps[index].get(); @@ -4391,7 +4391,7 @@ class CloneDeserializer : CloneBase { } if (!m_offscreenCanvases[index]) - m_offscreenCanvases[index] = OffscreenCanvas::create(*executionContext(m_lexicalGlobalObject), WTFMove(m_detachedOffscreenCanvases.at(index))); + m_offscreenCanvases[index] = OffscreenCanvas::create(*executionContext(m_lexicalGlobalObject), WTF::move(m_detachedOffscreenCanvases.at(index))); auto offscreenCanvas = m_offscreenCanvases[index].get(); return getJSValue(offscreenCanvas); @@ -4440,8 +4440,8 @@ class CloneDeserializer : CloneBase { if (!m_canCreateDOMObject) return constructEmptyObject(m_lexicalGlobalObject, m_globalObject->objectPrototype()); - auto rtcCertificate = RTCCertificate::create(SecurityOrigin::createFromString(origin->string()), expires, WTFMove(fingerprints), certificate->takeString(), keyedMaterial->takeString()); - return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), WTFMove(rtcCertificate)); + auto rtcCertificate = RTCCertificate::create(SecurityOrigin::createFromString(origin->string()), expires, WTF::move(fingerprints), certificate->takeString(), keyedMaterial->takeString()); + return toJSNewlyCreated(m_lexicalGlobalObject, jsCast(m_globalObject), WTF::move(rtcCertificate)); } JSValue readRTCDataChannel() @@ -4454,8 +4454,8 @@ class CloneDeserializer : CloneBase { } if (!m_rtcDataChannels[index]) { - auto detachedChannel = WTFMove(m_detachedRTCDataChannels.at(index)); - m_rtcDataChannels[index] = RTCDataChannel::create(*executionContext(m_lexicalGlobalObject), detachedChannel->identifier, WTFMove(detachedChannel->label), WTFMove(detachedChannel->options), detachedChannel->state); + auto detachedChannel = WTF::move(m_detachedRTCDataChannels.at(index)); + m_rtcDataChannels[index] = RTCDataChannel::create(*executionContext(m_lexicalGlobalObject), detachedChannel->identifier, WTF::move(detachedChannel->label), WTF::move(detachedChannel->options), detachedChannel->state); } return getJSValue(m_rtcDataChannels[index].get()); @@ -4487,7 +4487,7 @@ class CloneDeserializer : CloneBase { } if (!m_videoFrames[index]) - m_videoFrames[index] = WebCodecsVideoFrame::create(*executionContext(m_lexicalGlobalObject), WTFMove(m_serializedVideoFrames.at(index))); + m_videoFrames[index] = WebCodecsVideoFrame::create(*executionContext(m_lexicalGlobalObject), WTF::move(m_serializedVideoFrames.at(index))); return getJSValue(m_videoFrames[index].get()); } @@ -4526,7 +4526,7 @@ class CloneDeserializer : CloneBase { // buffer->putPixelBuffer(*pixelBuffer, { IntPoint::zero(), logicalSize }); - // auto bitmap = ImageBitmap::create(ImageBitmapBacking(WTFMove(buffer), OptionSet::fromRaw(serializationState))); + // auto bitmap = ImageBitmap::create(ImageBitmapBacking(WTF::move(buffer), OptionSet::fromRaw(serializationState))); // return getJSValue(bitmap); // } @@ -4554,7 +4554,7 @@ class CloneDeserializer : CloneBase { auto cert_ptr = ncrypto::X509Pointer(cert); auto* domGlobalObject = defaultGlobalObject(m_globalObject); - auto* cert_obj = Bun::JSX509Certificate::create(m_lexicalGlobalObject->vm(), domGlobalObject->m_JSX509CertificateClassStructure.get(domGlobalObject), m_globalObject, WTFMove(cert_ptr)); + auto* cert_obj = Bun::JSX509Certificate::create(m_lexicalGlobalObject->vm(), domGlobalObject->m_JSX509CertificateClassStructure.get(domGlobalObject), m_globalObject, WTF::move(cert_ptr)); m_gcBuffer.appendWithCrashOnOverflow(cert_obj); return cert_obj; @@ -4579,9 +4579,9 @@ class CloneDeserializer : CloneBase { return JSValue(); } - KeyObject keyObject = KeyObject::create(WTFMove(keyData)); + KeyObject keyObject = KeyObject::create(WTF::move(keyData)); Structure* structure = globalObject->m_JSSecretKeyObjectClassStructure.get(m_globalObject); - return JSSecretKeyObject::create(vm, structure, m_globalObject, WTFMove(keyObject)); + return JSSecretKeyObject::create(vm, structure, m_globalObject, WTF::move(keyObject)); } case CryptoKeyType::Public: case CryptoKeyType::Private: { @@ -4605,7 +4605,7 @@ class CloneDeserializer : CloneBase { } auto keyObject = KeyObject::create(CryptoKeyType::Public, ncrypto::EVPKeyPointer(pkey)); Structure* structure = globalObject->m_JSPublicKeyObjectClassStructure.get(m_globalObject); - return JSPublicKeyObject::create(vm, structure, m_globalObject, WTFMove(keyObject)); + return JSPublicKeyObject::create(vm, structure, m_globalObject, WTF::move(keyObject)); } EVP_PKEY* pkey = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr); @@ -4615,7 +4615,7 @@ class CloneDeserializer : CloneBase { } auto keyObject = KeyObject::create(CryptoKeyType::Private, ncrypto::EVPKeyPointer(pkey)); Structure* structure = globalObject->m_JSPrivateKeyObjectClassStructure.get(m_globalObject); - return JSPrivateKeyObject::create(vm, structure, m_globalObject, WTFMove(keyObject)); + return JSPrivateKeyObject::create(vm, structure, m_globalObject, WTF::move(keyObject)); } } } @@ -4824,7 +4824,7 @@ class CloneDeserializer : CloneBase { // } // if (!m_canCreateDOMObject) // return jsNull(); - // return getJSValue(FileList::create(WTFMove(files)).get()); + // return getJSValue(FileList::create(WTF::move(files)).get()); // } // case ImageDataTag: { // uint32_t width; @@ -4960,7 +4960,7 @@ class CloneDeserializer : CloneBase { fail(); return JSValue(); } - return ErrorInstance::create(m_lexicalGlobalObject, WTFMove(message), toErrorType(serializedErrorType), { line, column }, WTFMove(sourceURL), WTFMove(stackString)); + return ErrorInstance::create(m_lexicalGlobalObject, WTF::move(message), toErrorType(serializedErrorType), { line, column }, WTF::move(sourceURL), WTF::move(stackString)); } case ObjectReferenceTag: { auto index = readConstantPoolIndex(m_gcBuffer); @@ -5029,10 +5029,10 @@ class CloneDeserializer : CloneBase { fail(); return JSValue(); } - memory = Wasm::Memory::create(vm, contents.releaseNonNull(), WTFMove(handler)); + memory = Wasm::Memory::create(contents.releaseNonNull(), WTF::move(handler)); } else { // zero size & max-size. - memory = Wasm::Memory::createZeroSized(vm, JSC::MemorySharingMode::Shared, WTFMove(handler)); + memory = Wasm::Memory::createZeroSized(JSC::MemorySharingMode::Shared, WTF::move(handler)); } result->adopt(memory.releaseNonNull()); @@ -5053,7 +5053,7 @@ class CloneDeserializer : CloneBase { fail(); return JSValue(); } - JSValue result = JSArrayBuffer::create(m_lexicalGlobalObject->vm(), structure, WTFMove(arrayBuffer)); + JSValue result = JSArrayBuffer::create(m_lexicalGlobalObject->vm(), structure, WTF::move(arrayBuffer)); m_gcBuffer.appendWithCrashOnOverflow(result); return result; } @@ -5070,7 +5070,7 @@ class CloneDeserializer : CloneBase { fail(); return JSValue(); } - JSValue result = JSArrayBuffer::create(m_lexicalGlobalObject->vm(), structure, WTFMove(arrayBuffer)); + JSValue result = JSArrayBuffer::create(m_lexicalGlobalObject->vm(), structure, WTF::move(arrayBuffer)); m_gcBuffer.appendWithCrashOnOverflow(result); return result; } @@ -5083,7 +5083,7 @@ class CloneDeserializer : CloneBase { } if (!m_arrayBuffers[index]) - m_arrayBuffers[index] = ArrayBuffer::create(WTFMove(m_arrayBufferContents->at(index))); + m_arrayBuffers[index] = ArrayBuffer::create(WTF::move(m_arrayBufferContents->at(index))); return getJSValue(m_arrayBuffers[index].get()); } @@ -5099,7 +5099,7 @@ class CloneDeserializer : CloneBase { RELEASE_ASSERT(m_sharedBuffers->at(index)); ArrayBufferContents arrayBufferContents; m_sharedBuffers->at(index).shareWith(arrayBufferContents); - auto buffer = ArrayBuffer::create(WTFMove(arrayBufferContents)); + auto buffer = ArrayBuffer::create(WTF::move(arrayBufferContents)); JSValue result = getJSValue(buffer.get()); m_gcBuffer.appendWithCrashOnOverflow(result); return result; @@ -5474,14 +5474,14 @@ SerializedScriptValue::SerializedScriptValue(Vector&& buffer, std::uniq Vector>&& serializedVideoChunks, Vector&& serializedVideoFrames #endif ) - : m_data(WTFMove(buffer)) - , m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray)) + : m_data(WTF::move(buffer)) + , m_arrayBufferContentsArray(WTF::move(arrayBufferContentsArray)) #if ENABLE(WEB_RTC) - , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) #endif #if ENABLE(WEB_CODECS) - , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) - , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) + , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) #endif { m_memoryCost = computeMemoryCost(); @@ -5505,25 +5505,25 @@ SerializedScriptValue::SerializedScriptValue(Vector&& buffer, std::uniq // Vector>&& serializedVideoChunks, Vector&& serializedVideoFrames // #endif // ) -// : m_data(WTFMove(buffer)) -// , m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray)) -// , m_sharedBufferContentsArray(WTFMove(sharedBufferContentsArray)) -// , m_backingStores(WTFMove(backingStores)) +// : m_data(WTF::move(buffer)) +// , m_arrayBufferContentsArray(WTF::move(arrayBufferContentsArray)) +// , m_sharedBufferContentsArray(WTF::move(sharedBufferContentsArray)) +// , m_backingStores(WTF::move(backingStores)) // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) -// , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) +// , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) // #endif // #if ENABLE(WEB_RTC) -// , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) +// , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) // #endif // #if ENABLE(WEBASSEMBLY) -// , m_wasmModulesArray(WTFMove(wasmModulesArray)) -// , m_wasmMemoryHandlesArray(WTFMove(wasmMemoryHandlesArray)) +// , m_wasmModulesArray(WTF::move(wasmModulesArray)) +// , m_wasmMemoryHandlesArray(WTF::move(wasmMemoryHandlesArray)) // #endif // #if ENABLE(WEB_CODECS) -// , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) -// , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) +// , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) +// , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) // #endif -// , m_blobHandles(crossThreadCopy(WTFMove(blobHandles))) +// , m_blobHandles(crossThreadCopy(WTF::move(blobHandles))) // { // m_memoryCost = computeMemoryCost(); // } @@ -5546,29 +5546,29 @@ SerializedScriptValue::SerializedScriptValue(Vector&& buffer, std::uniq Vector>&& serializedVideoChunks, Vector&& serializedVideoFrames #endif ) - : m_data(WTFMove(buffer)) - , m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray)) - , m_sharedBufferContentsArray(WTFMove(sharedBufferContentsArray)) + : m_data(WTF::move(buffer)) + , m_arrayBufferContentsArray(WTF::move(arrayBufferContentsArray)) + , m_sharedBufferContentsArray(WTF::move(sharedBufferContentsArray)) #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) - , m_detachedOffscreenCanvases(WTFMove(detachedOffscreenCanvases)) + , m_detachedOffscreenCanvases(WTF::move(detachedOffscreenCanvases)) #endif #if ENABLE(WEB_RTC) - , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) + , m_detachedRTCDataChannels(WTF::move(detachedRTCDataChannels)) #endif #if ENABLE(WEBASSEMBLY) - , m_wasmModulesArray(WTFMove(wasmModulesArray)) - , m_wasmMemoryHandlesArray(WTFMove(wasmMemoryHandlesArray)) + , m_wasmModulesArray(WTF::move(wasmModulesArray)) + , m_wasmMemoryHandlesArray(WTF::move(wasmMemoryHandlesArray)) #endif #if ENABLE(WEB_CODECS) - , m_serializedVideoChunks(WTFMove(serializedVideoChunks)) - , m_serializedVideoFrames(WTFMove(serializedVideoFrames)) + , m_serializedVideoChunks(WTF::move(serializedVideoChunks)) + , m_serializedVideoFrames(WTF::move(serializedVideoFrames)) #endif { m_memoryCost = computeMemoryCost(); } SerializedScriptValue::SerializedScriptValue(WTF::FixedVector&& object) - : m_simpleInMemoryPropertyTable(WTFMove(object)) + : m_simpleInMemoryPropertyTable(WTF::move(object)) , m_fastPath(FastPath::SimpleObject) { m_memoryCost = computeMemoryCost(); @@ -5819,12 +5819,12 @@ RefPtr SerializedScriptValue::create(JSC::JSGlobalObject& // ExceptionOr> SerializedScriptValue::create(JSGlobalObject& globalObject, JSValue value, Vector>&& transferList, Vector>& messagePorts, SerializationForStorage forStorage, SerializationContext serializationContext) // { -// return create(globalObject, value, WTFMove(transferList), messagePorts, forStorage, SerializationErrorMode::NonThrowing, serializationContext); +// return create(globalObject, value, WTF::move(transferList), messagePorts, forStorage, SerializationErrorMode::NonThrowing, serializationContext); // } ExceptionOr> SerializedScriptValue::create(JSGlobalObject& globalObject, JSValue value, Vector>&& transferList, Vector>& messagePorts, SerializationForStorage forStorage, SerializationContext serializationContext, SerializationForCrossProcessTransfer forTransfer) { - return create(globalObject, value, WTFMove(transferList), messagePorts, forStorage, SerializationErrorMode::Throwing, serializationContext, forTransfer); + return create(globalObject, value, WTF::move(transferList), messagePorts, forStorage, SerializationErrorMode::Throwing, serializationContext, forTransfer); } // ExceptionOr> SerializedScriptValue::create(JSGlobalObject& lexicalGlobalObject, JSValue value, Vector>&& transferList, SerializationForStorage forStorage, SerializationErrorMode throwExceptions, SerializationContext context) @@ -5911,7 +5911,7 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError }); if (canUseObjectFastPath) { - return SerializedScriptValue::createObjectFastPath(WTF::FixedVector(WTFMove(properties))); + return SerializedScriptValue::createObjectFastPath(WTF::FixedVector(WTF::move(properties))); } } } @@ -5947,13 +5947,13 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb throwVMTypeError(&lexicalGlobalObject, scope, errorMessageForTransfer(arrayBuffer)); RELEASE_AND_RETURN(scope, Exception { ExistingExceptionError }); } - arrayBuffers.append(WTFMove(arrayBuffer)); + arrayBuffers.append(WTF::move(arrayBuffer)); continue; } if (auto port = JSMessagePort::toWrapped(vm, transferable.get())) { if (port->isDetached()) return Exception { DataCloneError, "MessagePort in transfer list is already detached"_s }; - messagePorts.append(WTFMove(port)); + messagePorts.append(WTF::move(port)); continue; } @@ -5963,13 +5963,13 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb // if (!imageBitmap->originClean()) // return Exception { DataCloneError }; - // imageBitmaps.append(WTFMove(imageBitmap)); + // imageBitmaps.append(WTF::move(imageBitmap)); // continue; // } #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) if (auto offscreenCanvas = JSOffscreenCanvas::toWrapped(vm, transferable.get())) { - offscreenCanvases.append(WTFMove(offscreenCanvas)); + offscreenCanvases.append(WTF::move(offscreenCanvas)); continue; } #endif @@ -6064,7 +6064,7 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb RELEASE_AND_RETURN(scope, arrayBufferContentsArray.releaseException()); } - // auto backingStores = ImageBitmap::detachBitmaps(WTFMove(imageBitmaps)); + // auto backingStores = ImageBitmap::detachBitmaps(WTF::move(imageBitmaps)); #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) Vector> detachedCanvases; @@ -6085,14 +6085,14 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb videoFrame->close(); #endif - // return adoptRef(*new SerializedScriptValue(WTFMove(buffer), WTFMove(blobHandles), arrayBufferContentsArray.releaseReturnValue(), context == SerializationContext::WorkerPostMessage ? WTFMove(sharedBuffers) : nullptr, WTFMove(backingStores) + // return adoptRef(*new SerializedScriptValue(WTF::move(buffer), WTF::move(blobHandles), arrayBufferContentsArray.releaseReturnValue(), context == SerializationContext::WorkerPostMessage ? WTF::move(sharedBuffers) : nullptr, WTF::move(backingStores) // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) // , - // WTFMove(detachedCanvases) + // WTF::move(detachedCanvases) // #endif // #if ENABLE(WEB_RTC) // , - // WTFMove(detachedRTCDataChannels) + // WTF::move(detachedRTCDataChannels) // #endif // #if ENABLE(WEBASSEMBLY) // , @@ -6100,18 +6100,18 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb // #endif // #if ENABLE(WEB_CODECS) // , - // WTFMove(serializedVideoChunks), WTFMove(serializedVideoFrameData) + // WTF::move(serializedVideoChunks), WTF::move(serializedVideoFrameData) // #endif // )); scope.releaseAssertNoException(); - return adoptRef(*new SerializedScriptValue(WTFMove(buffer), arrayBufferContentsArray.releaseReturnValue(), context == SerializationContext::WorkerPostMessage ? WTFMove(sharedBuffers) : nullptr + return adoptRef(*new SerializedScriptValue(WTF::move(buffer), arrayBufferContentsArray.releaseReturnValue(), context == SerializationContext::WorkerPostMessage ? WTF::move(sharedBuffers) : nullptr #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , - WTFMove(detachedCanvases) + WTF::move(detachedCanvases) #endif #if ENABLE(WEB_RTC) , - WTFMove(detachedRTCDataChannels) + WTF::move(detachedRTCDataChannels) #endif #if ENABLE(WEBASSEMBLY) , @@ -6119,7 +6119,7 @@ ExceptionOr> SerializedScriptValue::create(JSGlobalOb #endif #if ENABLE(WEB_CODECS) , - WTFMove(serializedVideoChunks), WTFMove(serializedVideoFrameData) + WTF::move(serializedVideoChunks), WTF::move(serializedVideoFrameData) #endif )); } @@ -6129,7 +6129,7 @@ RefPtr SerializedScriptValue::create(StringView string) Vector buffer; if (!CloneSerializer::serialize(string, buffer)) return nullptr; - return adoptRef(*new SerializedScriptValue(WTFMove(buffer))); + return adoptRef(*new SerializedScriptValue(WTF::move(buffer))); } Ref SerializedScriptValue::createStringFastPath(const String& string) @@ -6139,7 +6139,7 @@ Ref SerializedScriptValue::createStringFastPath(const Str Ref SerializedScriptValue::createObjectFastPath(WTF::FixedVector&& object) { - return adoptRef(*new SerializedScriptValue(WTFMove(object))); + return adoptRef(*new SerializedScriptValue(WTF::move(object))); } RefPtr SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue, JSValueRef* exception) @@ -6217,7 +6217,7 @@ JSC::JSValue SerializedScriptValue::fromArrayBuffer(JSC::JSGlobalObject& domGlob #endif #if ENABLE(WEB_CODECS) , - WTFMove(m_serializedVideoChunks), WTFMove(m_serializedVideoFrames) + WTF::move(m_serializedVideoChunks), WTF::move(m_serializedVideoFrames) #endif ); @@ -6296,11 +6296,11 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, DeserializationResult result = CloneDeserializer::deserialize(&lexicalGlobalObject, globalObject, messagePorts #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) , - WTFMove(m_detachedOffscreenCanvases) + WTF::move(m_detachedOffscreenCanvases) #endif #if ENABLE(WEB_RTC) , - WTFMove(m_detachedRTCDataChannels) + WTF::move(m_detachedRTCDataChannels) #endif , m_arrayBufferContentsArray.get(), m_data, blobURLs, blobFilePaths, m_sharedBufferContentsArray.get() @@ -6310,7 +6310,7 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, #endif #if ENABLE(WEB_CODECS) , - WTFMove(m_serializedVideoChunks), WTFMove(m_serializedVideoFrames) + WTF::move(m_serializedVideoChunks), WTF::move(m_serializedVideoFrames) #endif ); if (didFail) @@ -6327,14 +6327,14 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, } // JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, JSGlobalObject* globalObject, const Vector& blobURLs, const Vector& blobFilePaths, SerializationErrorMode throwExceptions, bool* didFail) // { -// // DeserializationResult result = CloneDeserializer::deserialize(&lexicalGlobalObject, globalObject, messagePorts, WTFMove(m_backingStores) +// // DeserializationResult result = CloneDeserializer::deserialize(&lexicalGlobalObject, globalObject, messagePorts, WTF::move(m_backingStores) // // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) // // , -// // WTFMove(m_detachedOffscreenCanvases) +// // WTF::move(m_detachedOffscreenCanvases) // // #endif // // #if ENABLE(WEB_RTC) // // , -// // WTFMove(m_detachedRTCDataChannels) +// // WTF::move(m_detachedRTCDataChannels) // // #endif // // , // // m_arrayBufferContentsArray.get(), m_data, blobURLs, blobFilePaths, m_sharedBufferContentsArray.get() @@ -6344,17 +6344,17 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, // // #endif // // #if ENABLE(WEB_CODECS) // // , -// // WTFMove(m_serializedVideoChunks), WTFMove(m_serializedVideoFrames) +// // WTF::move(m_serializedVideoChunks), WTF::move(m_serializedVideoFrames) // // #endif // // ); // DeserializationResult result = CloneDeserializer::deserialize(&lexicalGlobalObject, globalObject // #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS) // , -// WTFMove(m_detachedOffscreenCanvases) +// WTF::move(m_detachedOffscreenCanvases) // #endif // #if ENABLE(WEB_RTC) // , -// WTFMove(m_detachedRTCDataChannels) +// WTF::move(m_detachedRTCDataChannels) // #endif // , // m_arrayBufferContentsArray.get(), m_data, blobURLs, blobFilePaths, m_sharedBufferContentsArray.get() @@ -6364,7 +6364,7 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject, // #endif // #if ENABLE(WEB_CODECS) // , -// WTFMove(m_serializedVideoChunks), WTFMove(m_serializedVideoFrames) +// WTF::move(m_serializedVideoChunks), WTF::move(m_serializedVideoFrames) // #endif // ); // if (didFail) @@ -6415,7 +6415,7 @@ uint32_t SerializedScriptValue::wireFormatVersion() // ASSERT(isMainThread()); // ASSERT(hasBlobURLs()); -// blobRegistry().writeBlobsToTemporaryFilesForIndexedDB(blobURLs(), [completionHandler = WTFMove(completionHandler), this, protectedThis = Ref { *this }](auto&& blobFilePaths) mutable { +// blobRegistry().writeBlobsToTemporaryFilesForIndexedDB(blobURLs(), [completionHandler = WTF::move(completionHandler), this, protectedThis = Ref { *this }](auto&& blobFilePaths) mutable { // ASSERT(isMainThread()); // if (blobFilePaths.isEmpty()) { diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.h b/src/bun.js/bindings/webcore/SerializedScriptValue.h index ba434e9c125a1d..9956f06b420a0d 100644 --- a/src/bun.js/bindings/webcore/SerializedScriptValue.h +++ b/src/bun.js/bindings/webcore/SerializedScriptValue.h @@ -156,7 +156,7 @@ class SerializedScriptValue : public ThreadSafeRefCounted // IDBValue writeBlobsToDiskForIndexedDBSynchronously(); static Ref createFromWireBytes(Vector&& data) { - return adoptRef(*new SerializedScriptValue(WTFMove(data))); + return adoptRef(*new SerializedScriptValue(WTF::move(data))); } const Vector& wireBytes() const { return m_data; } @@ -322,7 +322,7 @@ RefPtr SerializedScriptValue::decode(Decoder& decoder) static_assert(sizeof(std::span::element_type) == 1); memcpy(buffer, data.data(), data.size_bytes()); JSC::ArrayBufferDestructorFunction destructor = ArrayBuffer::primitiveGigacageDestructor(); - arrayBufferContentsArray->append({ buffer, data.size_bytes(), std::nullopt, WTFMove(destructor) }); + arrayBufferContentsArray->append({ buffer, data.size_bytes(), std::nullopt, WTF::move(destructor) }); } } @@ -337,7 +337,7 @@ RefPtr SerializedScriptValue::decode(Decoder& decoder) decoder >> detachedRTCDataChannel; if (!detachedRTCDataChannel) return nullptr; - detachedRTCDataChannels.append(makeUnique(WTFMove(*detachedRTCDataChannel))); + detachedRTCDataChannels.append(makeUnique(WTF::move(*detachedRTCDataChannel))); } #endif #if ENABLE(WEB_CODECS) @@ -351,24 +351,24 @@ RefPtr SerializedScriptValue::decode(Decoder& decoder) decoder >> videoChunkData; if (!videoChunkData) return nullptr; - serializedVideoChunks.append(WebCodecsEncodedVideoChunkStorage::create(WTFMove(*videoChunkData))); + serializedVideoChunks.append(WebCodecsEncodedVideoChunkStorage::create(WTF::move(*videoChunkData))); } // FIXME: decode video frames Vector serializedVideoFrames; #endif - return adoptRef(*new SerializedScriptValue(WTFMove(data), WTFMove(arrayBufferContentsArray) + return adoptRef(*new SerializedScriptValue(WTF::move(data), WTF::move(arrayBufferContentsArray) #if ENABLE(WEB_RTC) - , - WTFMove(detachedRTCDataChannels) + , + WTF::move(detachedRTCDataChannels) #endif #if ENABLE(WEB_CODECS) , - WTFMove(serializedVideoChunks) + WTF::move(serializedVideoChunks) #endif #if ENABLE(WEB_CODECS) , - WTFMove(serializedVideoFrames) + WTF::move(serializedVideoFrames) #endif )); } diff --git a/src/bun.js/bindings/webcore/ServerTiming.cpp b/src/bun.js/bindings/webcore/ServerTiming.cpp index eac63d8f2de217..05662c69346a4c 100644 --- a/src/bun.js/bindings/webcore/ServerTiming.cpp +++ b/src/bun.js/bindings/webcore/ServerTiming.cpp @@ -53,7 +53,7 @@ ServerTiming ServerTiming::isolatedCopy() const& ServerTiming ServerTiming::isolatedCopy() && { - return ServerTiming { WTFMove(name).isolatedCopy(), duration, WTFMove(description).isolatedCopy(), durationSet, descriptionSet }; + return ServerTiming { WTF::move(name).isolatedCopy(), duration, WTF::move(description).isolatedCopy(), durationSet, descriptionSet }; } } // namespace WebCore diff --git a/src/bun.js/bindings/webcore/ServerTiming.h b/src/bun.js/bindings/webcore/ServerTiming.h index dc24c76ca58002..292a16202c1f1a 100644 --- a/src/bun.js/bindings/webcore/ServerTiming.h +++ b/src/bun.js/bindings/webcore/ServerTiming.h @@ -47,21 +47,21 @@ struct ServerTiming { }; inline ServerTiming::ServerTiming(String&& name) - : name(WTFMove(name)) + : name(WTF::move(name)) { } inline ServerTiming::ServerTiming(String&& name, double duration, String&& description) - : name(WTFMove(name)) + : name(WTF::move(name)) , duration(duration) - , description(WTFMove(description)) + , description(WTF::move(description)) { } inline ServerTiming::ServerTiming(String&& name, double duration, String&& description, bool durationSet, bool descriptionSet) - : name(WTFMove(name)) + : name(WTF::move(name)) , duration(duration) - , description(WTFMove(description)) + , description(WTF::move(description)) , durationSet(durationSet) , descriptionSet(descriptionSet) { diff --git a/src/bun.js/bindings/webcore/ServerTimingParser.cpp b/src/bun.js/bindings/webcore/ServerTimingParser.cpp index 73a0b04b5e2163..1b2f79bf6b889b 100644 --- a/src/bun.js/bindings/webcore/ServerTimingParser.cpp +++ b/src/bun.js/bindings/webcore/ServerTimingParser.cpp @@ -49,7 +49,7 @@ Vector parseServerTiming(const String& headerValue) if (name.isNull()) break; - ServerTiming entry(WTFMove(name)); + ServerTiming entry(WTF::move(name)); while (tokenizer.consume(';')) { String parameterName = tokenizer.consumeToken(); @@ -64,7 +64,7 @@ Vector parseServerTiming(const String& headerValue) entry.setParameter(parameterName, value); } - entries.append(WTFMove(entry)); + entries.append(WTF::move(entry)); if (!tokenizer.consume(',')) break; diff --git a/src/bun.js/bindings/webcore/StructuredClone.cpp b/src/bun.js/bindings/webcore/StructuredClone.cpp index 5c85999cc196b6..ea62c2044fc34a 100644 --- a/src/bun.js/bindings/webcore/StructuredClone.cpp +++ b/src/bun.js/bindings/webcore/StructuredClone.cpp @@ -98,10 +98,10 @@ JSC_DEFINE_HOST_FUNCTION(structuredCloneForStream, (JSGlobalObject * globalObjec auto bufferClone = buffer->slice(0); Structure* structure = bufferView->structure(); -#define CLONE_TYPED_ARRAY(name) \ - do { \ - if (bufferView->inherits()) \ - RELEASE_AND_RETURN(scope, JSValue::encode(JS##name##Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()))); \ +#define CLONE_TYPED_ARRAY(name) \ + do { \ + if (bufferView->inherits()) \ + RELEASE_AND_RETURN(scope, JSValue::encode(JS##name##Array::create(globalObject, structure, WTF::move(bufferClone), bufferView->byteOffset(), bufferView->length()))); \ } while (0); FOR_EACH_TYPED_ARRAY_TYPE_EXCLUDING_DATA_VIEW(CLONE_TYPED_ARRAY) @@ -109,7 +109,7 @@ JSC_DEFINE_HOST_FUNCTION(structuredCloneForStream, (JSGlobalObject * globalObjec #undef CLONE_TYPED_ARRAY if (value.inherits()) - RELEASE_AND_RETURN(scope, JSValue::encode(JSDataView::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()))); + RELEASE_AND_RETURN(scope, JSValue::encode(JSDataView::create(globalObject, structure, WTF::move(bufferClone), bufferView->byteOffset(), bufferView->length()))); } throwTypeError(globalObject, scope, "structuredClone not implemented for non-ArrayBuffer / non-ArrayBufferView"_s); @@ -151,7 +151,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionStructuredClone, (JSC::JSGlobalObject * globa } Vector> ports; - ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTFMove(transferList), ports); + ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTF::move(transferList), ports); if (serialized.hasException()) { WebCore::propagateException(*globalObject, throwScope, serialized.releaseException()); RELEASE_AND_RETURN(throwScope, {}); @@ -214,7 +214,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionStructuredCloneAdvanced, (JSC::JSGlobalObject } Vector> ports; - ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTFMove(transferList), ports, forStorage, serializationContext, forTransfer); + ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTF::move(transferList), ports, forStorage, serializationContext, forTransfer); if (serialized.hasException()) { WebCore::propagateException(*globalObject, throwScope, serialized.releaseException()); RELEASE_AND_RETURN(throwScope, {}); diff --git a/src/bun.js/bindings/webcore/StructuredSerializeOptions.h b/src/bun.js/bindings/webcore/StructuredSerializeOptions.h index c1470f94a2a5c0..b1ee67aa62376a 100644 --- a/src/bun.js/bindings/webcore/StructuredSerializeOptions.h +++ b/src/bun.js/bindings/webcore/StructuredSerializeOptions.h @@ -34,7 +34,7 @@ namespace WebCore { struct StructuredSerializeOptions { StructuredSerializeOptions() = default; StructuredSerializeOptions(Vector>&& transfer) - : transfer(WTFMove(transfer)) + : transfer(WTF::move(transfer)) { } diff --git a/src/bun.js/bindings/webcore/URLPattern.cpp b/src/bun.js/bindings/webcore/URLPattern.cpp index 705ca93cd075d3..17884dfe8afc9b 100644 --- a/src/bun.js/bindings/webcore/URLPattern.cpp +++ b/src/bun.js/bindings/webcore/URLPattern.cpp @@ -36,7 +36,6 @@ #include "URLPatternResult.h" #include #include -#include #include #include #include @@ -45,8 +44,6 @@ namespace WebCore { using namespace JSC; -WTF_MAKE_TZONE_OR_ISO_ALLOCATED_IMPL(URLPattern); - // https://urlpattern.spec.whatwg.org/#process-a-base-url-string static String processBaseURLString(StringView input, BaseURLStringType type) { @@ -75,7 +72,7 @@ URLPattern::URLPattern() = default; // https://urlpattern.spec.whatwg.org/#process-a-urlpatterninit static ExceptionOr processInit(URLPatternInit&& init, BaseURLStringType type, String&& protocol = {}, String&& username = {}, String&& password = {}, String&& hostname = {}, String&& port = {}, String&& pathname = {}, String&& search = {}, String&& hash = {}) { - URLPatternInit result { WTFMove(protocol), WTFMove(username), WTFMove(password), WTFMove(hostname), WTFMove(port), WTFMove(pathname), WTFMove(search), WTFMove(hash), {} }; + URLPatternInit result { WTF::move(protocol), WTF::move(username), WTF::move(password), WTF::move(hostname), WTF::move(port), WTF::move(pathname), WTF::move(search), WTF::move(hash), {} }; URL baseURL; @@ -218,21 +215,21 @@ ExceptionOr> URLPattern::create(ScriptExecutionContext& context, URLPatternInit init; if (std::holds_alternative(input) && !std::get(input).isNull()) { - auto maybeInit = URLPatternConstructorStringParser(WTFMove(std::get(input))).parse(context); + auto maybeInit = URLPatternConstructorStringParser(WTF::move(std::get(input))).parse(context); if (maybeInit.hasException()) return maybeInit.releaseException(); init = maybeInit.releaseReturnValue(); if (baseURL.isNull() && init.protocol.isEmpty()) return Exception { ExceptionCode::TypeError, "Relative constructor string must have additional baseURL argument."_s }; - init.baseURL = WTFMove(baseURL); + init.baseURL = WTF::move(baseURL); } else if (std::holds_alternative(input)) { if (!baseURL.isNull()) return Exception { ExceptionCode::TypeError, "Constructor with a URLPatternInit should have a null baseURL argument."_s }; init = std::get(input); } - auto maybeProcessedInit = processInit(WTFMove(init), BaseURLStringType::Pattern); + auto maybeProcessedInit = processInit(WTF::move(init), BaseURLStringType::Pattern); if (maybeProcessedInit.hasException()) return maybeProcessedInit.releaseException(); @@ -262,7 +259,7 @@ ExceptionOr> URLPattern::create(ScriptExecutionContext& context, Ref result = adoptRef(*new URLPattern); - auto maybeCompileException = result->compileAllComponents(context, WTFMove(processedInit), options); + auto maybeCompileException = result->compileAllComponents(context, WTF::move(processedInit), options); if (maybeCompileException.hasException()) return maybeCompileException.releaseException(); @@ -275,13 +272,13 @@ ExceptionOr> URLPattern::create(ScriptExecutionContext& context, if (!input) input = URLPatternInit {}; - return create(context, WTFMove(*input), String {}, WTFMove(options)); + return create(context, WTF::move(*input), String {}, WTF::move(options)); } // https://urlpattern.spec.whatwg.org/#build-a-url-pattern-from-a-web-idl-value ExceptionOr> URLPattern::create(ScriptExecutionContext& context, Compatible&& value, const String& baseURL) { - return switchOn(WTFMove(value), [&](RefPtr&& pattern) -> ExceptionOr> { return pattern.releaseNonNull(); }, [&](URLPatternInit&& init) -> ExceptionOr> { return URLPattern::create(context, WTFMove(init), {}, {}); }, [&](String&& string) -> ExceptionOr> { return URLPattern::create(context, WTFMove(string), String { baseURL }, {}); }); + return switchOn(WTF::move(value), [&](RefPtr&& pattern) -> ExceptionOr> { return pattern.releaseNonNull(); }, [&](URLPatternInit&& init) -> ExceptionOr> { return URLPattern::create(context, WTF::move(init), {}, {}); }, [&](String&& string) -> ExceptionOr> { return URLPattern::create(context, WTF::move(string), String { baseURL }, {}); }); } URLPattern::~URLPattern() = default; @@ -292,7 +289,7 @@ ExceptionOr URLPattern::test(ScriptExecutionContext& context, std::optiona if (!input) input = URLPatternInit {}; - auto maybeResult = match(context, WTFMove(*input), WTFMove(baseURL)); + auto maybeResult = match(context, WTF::move(*input), WTF::move(baseURL)); if (maybeResult.hasException()) return maybeResult.releaseException(); @@ -305,7 +302,7 @@ ExceptionOr> URLPattern::exec(ScriptExecutionCon if (!input) input = URLPatternInit {}; - return match(context, WTFMove(*input), WTFMove(baseURL)); + return match(context, WTF::move(*input), WTF::move(baseURL)); } ExceptionOr URLPattern::compileAllComponents(ScriptExecutionContext& context, URLPatternInit&& processedInit, const URLPatternOptions& options) @@ -404,7 +401,7 @@ ExceptionOr> URLPattern::match(ScriptExecutionCo return Exception { ExceptionCode::TypeError, "Base URL string is provided with a URLPatternInit. If URLPatternInit is provided, please use URLPatternInit.baseURL property instead"_s }; URLPatternInit initCopy = value; - auto maybeResult = processInit(WTFMove(initCopy), BaseURLStringType::URL); + auto maybeResult = processInit(WTF::move(initCopy), BaseURLStringType::URL); if (maybeResult.hasException()) return true; @@ -437,42 +434,42 @@ ExceptionOr> URLPattern::match(ScriptExecutionCo auto* globalObject = context.globalObject(); if (!globalObject) return { std::nullopt }; - result.protocol = m_protocolComponent.createComponentMatchResult(globalObject, WTFMove(protocol), protocolExecResult); + result.protocol = m_protocolComponent.createComponentMatchResult(globalObject, WTF::move(protocol), protocolExecResult); auto usernameExecResult = m_usernameComponent.componentExec(context, username); if (usernameExecResult.isNull() || usernameExecResult.isUndefined()) return { std::nullopt }; - result.username = m_usernameComponent.createComponentMatchResult(globalObject, WTFMove(username), usernameExecResult); + result.username = m_usernameComponent.createComponentMatchResult(globalObject, WTF::move(username), usernameExecResult); auto passwordExecResult = m_passwordComponent.componentExec(context, password); if (passwordExecResult.isNull() || passwordExecResult.isUndefined()) return { std::nullopt }; - result.password = m_passwordComponent.createComponentMatchResult(globalObject, WTFMove(password), passwordExecResult); + result.password = m_passwordComponent.createComponentMatchResult(globalObject, WTF::move(password), passwordExecResult); auto hostnameExecResult = m_hostnameComponent.componentExec(context, hostname); if (hostnameExecResult.isNull() || hostnameExecResult.isUndefined()) return { std::nullopt }; - result.hostname = m_hostnameComponent.createComponentMatchResult(globalObject, WTFMove(hostname), hostnameExecResult); + result.hostname = m_hostnameComponent.createComponentMatchResult(globalObject, WTF::move(hostname), hostnameExecResult); auto pathnameExecResult = m_pathnameComponent.componentExec(context, pathname); if (pathnameExecResult.isNull() || pathnameExecResult.isUndefined()) return { std::nullopt }; - result.pathname = m_pathnameComponent.createComponentMatchResult(globalObject, WTFMove(pathname), pathnameExecResult); + result.pathname = m_pathnameComponent.createComponentMatchResult(globalObject, WTF::move(pathname), pathnameExecResult); auto portExecResult = m_portComponent.componentExec(context, port); if (portExecResult.isNull() || portExecResult.isUndefined()) return { std::nullopt }; - result.port = m_portComponent.createComponentMatchResult(globalObject, WTFMove(port), portExecResult); + result.port = m_portComponent.createComponentMatchResult(globalObject, WTF::move(port), portExecResult); auto searchExecResult = m_searchComponent.componentExec(context, search); if (searchExecResult.isNull() || searchExecResult.isUndefined()) return { std::nullopt }; - result.search = m_searchComponent.createComponentMatchResult(globalObject, WTFMove(search), searchExecResult); + result.search = m_searchComponent.createComponentMatchResult(globalObject, WTF::move(search), searchExecResult); auto hashExecResult = m_hashComponent.componentExec(context, hash); if (hashExecResult.isNull() || hashExecResult.isUndefined()) return { std::nullopt }; - result.hash = m_hashComponent.createComponentMatchResult(globalObject, WTFMove(hash), hashExecResult); + result.hash = m_hashComponent.createComponentMatchResult(globalObject, WTF::move(hash), hashExecResult); return { result }; } diff --git a/src/bun.js/bindings/webcore/URLPattern.h b/src/bun.js/bindings/webcore/URLPattern.h index 838eb24596272e..85d5111a74ffa6 100644 --- a/src/bun.js/bindings/webcore/URLPattern.h +++ b/src/bun.js/bindings/webcore/URLPattern.h @@ -49,7 +49,7 @@ class URLPatternComponent; } class URLPattern final : public RefCounted { - WTF_MAKE_TZONE_OR_ISO_ALLOCATED(URLPattern); + WTF_MAKE_TZONE_ALLOCATED(URLPattern); public: using URLPatternInput = Variant; diff --git a/src/bun.js/bindings/webcore/URLPatternComponent.cpp b/src/bun.js/bindings/webcore/URLPatternComponent.cpp index cb2c139aa6e76d..0d7d8458fa9ce3 100644 --- a/src/bun.js/bindings/webcore/URLPatternComponent.cpp +++ b/src/bun.js/bindings/webcore/URLPatternComponent.cpp @@ -41,9 +41,9 @@ using namespace JSC; namespace URLPatternUtilities { URLPatternComponent::URLPatternComponent(String&& patternString, JSC::Strong&& regex, Vector&& groupNameList, bool hasRegexpGroupsFromPartsList) - : m_patternString(WTFMove(patternString)) - , m_regularExpression(WTFMove(regex)) - , m_groupNameList(WTFMove(groupNameList)) + : m_patternString(WTF::move(patternString)) + , m_regularExpression(WTF::move(regex)) + , m_groupNameList(WTF::move(groupNameList)) , m_hasRegexGroupsFromPartList(hasRegexpGroupsFromPartsList) { } @@ -72,7 +72,7 @@ ExceptionOr URLPatternComponent::compile(Ref vm, S return part.type == PartType::Regexp; }); - return URLPatternComponent { WTFMove(patternString), JSC::Strong { vm, regularExpression }, WTFMove(nameList), hasRegexGroups }; + return URLPatternComponent { WTF::move(patternString), JSC::Strong { vm, regularExpression }, WTF::move(nameList), hasRegexGroups }; } // https://urlpattern.spec.whatwg.org/#protocol-component-matches-a-special-scheme @@ -136,10 +136,10 @@ URLPatternComponentResult URLPatternComponent::createComponentMatchResult(JSC::J size_t groupIndex = index - 1; String groupName = groupIndex < m_groupNameList.size() ? m_groupNameList[groupIndex] : emptyString(); - groups.append(URLPatternComponentResult::NameMatchPair { WTFMove(groupName), WTFMove(value) }); + groups.append(URLPatternComponentResult::NameMatchPair { WTF::move(groupName), WTF::move(value) }); } - return URLPatternComponentResult { !input.isEmpty() ? WTFMove(input) : emptyString(), WTFMove(groups) }; + return URLPatternComponentResult { !input.isEmpty() ? WTF::move(input) : emptyString(), WTF::move(groups) }; } } diff --git a/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp b/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp index 80d405e8203187..914b72a450d5eb 100644 --- a/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp +++ b/src/bun.js/bindings/webcore/URLPatternConstructorStringParser.cpp @@ -37,7 +37,7 @@ namespace WebCore { using namespace JSC; URLPatternConstructorStringParser::URLPatternConstructorStringParser(String&& input) - : m_input(WTFMove(input)) + : m_input(WTF::move(input)) { } @@ -116,28 +116,28 @@ static inline void setInitComponentFromState(URLPatternInit& init, URLPatternCon { switch (state) { case URLPatternConstructorStringParserState::Protocol: - init.protocol = WTFMove(componentString); + init.protocol = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Username: - init.username = WTFMove(componentString); + init.username = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Password: - init.password = WTFMove(componentString); + init.password = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Hostname: - init.hostname = WTFMove(componentString); + init.hostname = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Port: - init.port = WTFMove(componentString); + init.port = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Pathname: - init.pathname = WTFMove(componentString); + init.pathname = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Search: - init.search = WTFMove(componentString); + init.search = WTF::move(componentString); break; case URLPatternConstructorStringParserState::Hash: - init.hash = WTFMove(componentString); + init.hash = WTF::move(componentString); break; default: break; diff --git a/src/bun.js/bindings/webcore/URLPatternParser.cpp b/src/bun.js/bindings/webcore/URLPatternParser.cpp index 9224932aae0b72..2193dc0396644c 100644 --- a/src/bun.js/bindings/webcore/URLPatternParser.cpp +++ b/src/bun.js/bindings/webcore/URLPatternParser.cpp @@ -37,7 +37,7 @@ namespace URLPatternUtilities { URLPatternParser::URLPatternParser(EncodingCallbackType type, String&& segmentWildcardRegexp) : m_callbackType(type) - , m_segmentWildcardRegexp(WTFMove(segmentWildcardRegexp)) + , m_segmentWildcardRegexp(WTF::move(segmentWildcardRegexp)) { } @@ -65,7 +65,7 @@ ExceptionOr URLPatternParser::performParse(const URLPatternStringOptions& auto modifierToken = tryToConsumeModifierToken(); - maybeFunctionException = addPart(WTFMove(prefix), nameToken, regexOrWildcardToken, {}, modifierToken); + maybeFunctionException = addPart(WTF::move(prefix), nameToken, regexOrWildcardToken, {}, modifierToken); if (maybeFunctionException.hasException()) return maybeFunctionException.releaseException(); @@ -78,7 +78,7 @@ ExceptionOr URLPatternParser::performParse(const URLPatternStringOptions& fixedToken = tryToConsumeToken(TokenType::EscapedChar); if (!fixedToken.isNull()) { - m_pendingFixedValue.append(WTFMove(fixedToken.value)); + m_pendingFixedValue.append(WTF::move(fixedToken.value)); continue; } @@ -94,7 +94,7 @@ ExceptionOr URLPatternParser::performParse(const URLPatternStringOptions& return maybeCloseError.releaseException(); auto modifierToken = tryToConsumeModifierToken(); - maybeFunctionException = addPart(WTFMove(prefix), nameToken, regexOrWildcardToken, WTFMove(suffix), modifierToken); + maybeFunctionException = addPart(WTF::move(prefix), nameToken, regexOrWildcardToken, WTF::move(suffix), modifierToken); if (maybeFunctionException.hasException()) return maybeFunctionException.releaseException(); @@ -213,7 +213,7 @@ ExceptionOr URLPatternParser::addPart(String&& prefix, const Token& nameTo } if (nameToken.isNull() && regexpOrWildcardToken.isNull() && modifier == Modifier::None) { - m_pendingFixedValue.append(WTFMove(prefix)); + m_pendingFixedValue.append(WTF::move(prefix)); return {}; } @@ -228,7 +228,7 @@ ExceptionOr URLPatternParser::addPart(String&& prefix, const Token& nameTo if (prefix.isEmpty()) return {}; - auto encodedValue = callEncodingCallback(m_callbackType, WTFMove(prefix)); + auto encodedValue = callEncodingCallback(m_callbackType, WTF::move(prefix)); if (encodedValue.hasException()) return encodedValue.releaseException(); @@ -268,15 +268,15 @@ ExceptionOr URLPatternParser::addPart(String&& prefix, const Token& nameTo if (isDuplicateName(name)) return Exception { ExceptionCode::TypeError, "Duplicate name token produced when adding to parser part list."_s }; - auto encodedPrefix = callEncodingCallback(m_callbackType, WTFMove(prefix)); + auto encodedPrefix = callEncodingCallback(m_callbackType, WTF::move(prefix)); if (encodedPrefix.hasException()) return encodedPrefix.releaseException(); - auto encodedSuffix = callEncodingCallback(m_callbackType, WTFMove(suffix)); + auto encodedSuffix = callEncodingCallback(m_callbackType, WTF::move(suffix)); if (encodedSuffix.hasException()) return encodedSuffix.releaseException(); - m_partList.append(Part { type, WTFMove(regexValue), modifier, WTFMove(name), encodedPrefix.releaseReturnValue(), encodedSuffix.releaseReturnValue() }); + m_partList.append(Part { type, WTF::move(regexValue), modifier, WTF::move(name), encodedPrefix.releaseReturnValue(), encodedSuffix.releaseReturnValue() }); return {}; } @@ -424,7 +424,7 @@ std::pair> generateRegexAndNameList(const Vector& p result.append('$'); - return { result.toString(), WTFMove(nameList) }; + return { result.toString(), WTF::move(nameList) }; } // https://urlpattern.spec.whatwg.org/#generate-a-pattern-string diff --git a/src/bun.js/bindings/webcore/URLPatternParser.h b/src/bun.js/bindings/webcore/URLPatternParser.h index 3d942e454c5432..1f95d0b2e65459 100644 --- a/src/bun.js/bindings/webcore/URLPatternParser.h +++ b/src/bun.js/bindings/webcore/URLPatternParser.h @@ -70,7 +70,7 @@ class URLPatternParser { URLPatternParser(EncodingCallbackType, String&& segmentWildcardRegexp); ExceptionOr performParse(const URLPatternStringOptions&); - void setTokenList(Vector&& tokenList) { m_tokenList = WTFMove(tokenList); } + void setTokenList(Vector&& tokenList) { m_tokenList = WTF::move(tokenList); } static ExceptionOr> parse(StringView, const URLPatternStringOptions&, EncodingCallbackType); private: diff --git a/src/bun.js/bindings/webcore/URLPatternTokenizer.cpp b/src/bun.js/bindings/webcore/URLPatternTokenizer.cpp index d505f740d03412..4c8d87700c7e68 100644 --- a/src/bun.js/bindings/webcore/URLPatternTokenizer.cpp +++ b/src/bun.js/bindings/webcore/URLPatternTokenizer.cpp @@ -266,7 +266,7 @@ ExceptionOr> Tokenizer::tokenize() } addToken(TokenType::End, m_index, m_index); - return WTFMove(m_tokenList); + return WTF::move(m_tokenList); } } // namespace URLPatternUtilities diff --git a/src/bun.js/bindings/webcore/WebSocket.cpp b/src/bun.js/bindings/webcore/WebSocket.cpp index 6ce10f2119648d..5a85a027b80412 100644 --- a/src/bun.js/bindings/webcore/WebSocket.cpp +++ b/src/bun.js/bindings/webcore/WebSocket.cpp @@ -238,7 +238,7 @@ ExceptionOr> WebSocket::create(ScriptExecutionContext& context, c auto socket = adoptRef(*new WebSocket(context)); // socket->suspendIfNeeded(); - auto result = socket->connect(url, protocols, WTFMove(headers)); + auto result = socket->connect(url, protocols, WTF::move(headers)); // auto result = socket->connect(url, protocols); if (result.hasException()) @@ -255,7 +255,7 @@ ExceptionOr> WebSocket::create(ScriptExecutionContext& context, c socket->setRejectUnauthorized(rejectUnauthorized); // socket->suspendIfNeeded(); - auto result = socket->connect(url, protocols, WTFMove(headers)); + auto result = socket->connect(url, protocols, WTF::move(headers)); // auto result = socket->connect(url, protocols); if (result.hasException()) @@ -437,7 +437,7 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr Vector headerNames; Vector headerValues; - auto headersOrException = FetchHeaders::create(WTFMove(headersInit)); + auto headersOrException = FetchHeaders::create(WTF::move(headersInit)); if (headersOrException.hasException()) [[unlikely]] { m_state = CLOSED; updateHasPendingActivity(); @@ -479,8 +479,8 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr auto eventInit = createErrorEventInit(protectedThis, "Failed to connect"_s, globalObject); auto message = eventInit.message; - protectedThis->dispatchEvent(ErrorEvent::create(eventNames().errorEvent, WTFMove(eventInit), EventIsTrusted::Yes)); - protectedThis->dispatchEvent(CloseEvent::create(false, 1006, WTFMove(message))); + protectedThis->dispatchEvent(ErrorEvent::create(eventNames().errorEvent, WTF::move(eventInit), EventIsTrusted::Yes)); + protectedThis->dispatchEvent(CloseEvent::create(false, 1006, WTF::move(message))); protectedThis->decPendingActivityCount(); }); @@ -493,12 +493,12 @@ ExceptionOr WebSocket::connect(const String& url, const Vector& pr // #if ENABLE(INTELLIGENT_TRACKING_PREVENTION) // auto reportRegistrableDomain = [domain = RegistrableDomain(m_url).isolatedCopy()](auto& context) mutable { // if (auto* frame = downcast(context).frame()) - // frame->loader().client().didLoadFromRegistrableDomain(WTFMove(domain)); + // frame->loader().client().didLoadFromRegistrableDomain(WTF::move(domain)); // }; // if (is(context)) // reportRegistrableDomain(context); // else - // downcast(context).thread().workerLoaderProxy().postTaskToLoader(WTFMove(reportRegistrableDomain)); + // downcast(context).thread().workerLoaderProxy().postTaskToLoader(WTF::move(reportRegistrableDomain)); // #endif // m_pendingActivity = makePendingActivity(*this); @@ -1069,7 +1069,7 @@ void WebSocket::didConnect() void WebSocket::didReceiveMessage(String&& message) { // LOG(Network, "WebSocket %p didReceiveMessage() Text message '%s'", this, message.utf8().data()); - // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, message = WTFMove(message)]() mutable { + // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, message = WTF::move(message)]() mutable { if (m_state != OPEN) return; @@ -1083,14 +1083,14 @@ void WebSocket::didReceiveMessage(String&& message) if (this->hasEventListeners("message"_s)) { // the main reason for dispatching on a separate tick is to handle when you haven't yet attached an event listener this->incPendingActivityCount(); - dispatchEvent(MessageEvent::create(WTFMove(message), m_url.string())); + dispatchEvent(MessageEvent::create(WTF::move(message), m_url.string())); this->decPendingActivityCount(); return; } if (auto* context = scriptExecutionContext()) { this->incPendingActivityCount(); - context->postTask([this, message_ = WTFMove(message), protectedThis = Ref { *this }](ScriptExecutionContext& context) { + context->postTask([this, message_ = WTF::move(message), protectedThis = Ref { *this }](ScriptExecutionContext& context) { ASSERT(scriptExecutionContext()); protectedThis->dispatchEvent(MessageEvent::create(message_, protectedThis->m_url.string())); protectedThis->decPendingActivityCount(); @@ -1103,7 +1103,7 @@ void WebSocket::didReceiveMessage(String&& message) void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::span binaryData) { // LOG(Network, "WebSocket %p didReceiveBinaryData() %u byte binary message", this, static_cast(binaryData.size())); - // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, binaryData = WTFMove(binaryData)]() mutable { + // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, binaryData = WTF::move(binaryData)]() mutable { if (m_state != OPEN) return; @@ -1144,7 +1144,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa if (auto* context = scriptExecutionContext()) { auto arrayBuffer = JSC::ArrayBuffer::create(binaryData); this->incPendingActivityCount(); - context->postTask([this, name = eventName, buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { + context->postTask([this, name = eventName, buffer = WTF::move(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { ASSERT(scriptExecutionContext()); protectedThis->dispatchEvent(MessageEvent::create(name, buffer, m_url.string())); protectedThis->decPendingActivityCount(); @@ -1176,7 +1176,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa init.data = buffer; init.origin = this->m_url.string(); - dispatchEvent(MessageEvent::create(eventName, WTFMove(init), EventIsTrusted::Yes)); + dispatchEvent(MessageEvent::create(eventName, WTF::move(init), EventIsTrusted::Yes)); this->decPendingActivityCount(); return; } @@ -1186,7 +1186,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa this->incPendingActivityCount(); - context->postTask([name = eventName, buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { + context->postTask([name = eventName, buffer = WTF::move(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { size_t length = buffer->byteLength(); auto* globalObject = context.jsGlobalObject(); auto* subclassStructure = static_cast(globalObject)->JSBufferSubclassStructure(); @@ -1195,7 +1195,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa MessageEvent::Init init; init.data = uint8array; init.origin = protectedThis->m_url.string(); - protectedThis->dispatchEvent(MessageEvent::create(name, WTFMove(init), EventIsTrusted::Yes)); + protectedThis->dispatchEvent(MessageEvent::create(name, WTF::move(init), EventIsTrusted::Yes)); protectedThis->decPendingActivityCount(); }); } @@ -1209,7 +1209,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa void WebSocket::didReceiveClose(CleanStatus wasClean, unsigned short code, WTF::String reason, bool isConnectionError) { // LOG(Network, "WebSocket %p didReceiveErrorMessage()", this); - // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, reason = WTFMove(reason)] { + // queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, reason = WTF::move(reason)] { if (m_state == CLOSED) return; const bool wasConnecting = m_state == CONNECTING; @@ -1218,7 +1218,7 @@ void WebSocket::didReceiveClose(CleanStatus wasClean, unsigned short code, WTF:: this->incPendingActivityCount(); if (wasConnecting && isConnectionError) { auto eventInit = createErrorEventInit(*this, reason, context->jsGlobalObject()); - dispatchEvent(ErrorEvent::create(eventNames().errorEvent, WTFMove(eventInit), EventIsTrusted::Yes)); + dispatchEvent(ErrorEvent::create(eventNames().errorEvent, WTF::move(eventInit), EventIsTrusted::Yes)); } // https://html.spec.whatwg.org/multipage/web-sockets.html#feedback-from-the-protocol:concept-websocket-closed, we should synchronously fire a close event. dispatchEvent(CloseEvent::create(wasClean == CleanStatus::Clean, code, reason)); @@ -1517,13 +1517,13 @@ extern "C" void WebSocket__didAbruptClose(WebCore::WebSocket* webSocket, Bun::We extern "C" void WebSocket__didClose(WebCore::WebSocket* webSocket, uint16_t errorCode, BunString* reason) { WTF::String wtf_reason = reason->transferToWTFString(); - webSocket->didClose(0, errorCode, WTFMove(wtf_reason)); + webSocket->didClose(0, errorCode, WTF::move(wtf_reason)); } extern "C" void WebSocket__didReceiveText(WebCore::WebSocket* webSocket, bool clone, const ZigString* str) { WTF::String wtf_str = clone ? Zig::toStringCopy(*str) : Zig::toString(*str); - webSocket->didReceiveMessage(WTFMove(wtf_str)); + webSocket->didReceiveMessage(WTF::move(wtf_str)); } extern "C" void WebSocket__didReceiveBytes(WebCore::WebSocket* webSocket, const uint8_t* bytes, size_t len, const uint8_t op) { diff --git a/src/bun.js/bindings/webcore/Worker.cpp b/src/bun.js/bindings/webcore/Worker.cpp index 3891d6fba3986c..8db7b462b33a5e 100644 --- a/src/bun.js/bindings/webcore/Worker.cpp +++ b/src/bun.js/bindings/webcore/Worker.cpp @@ -94,7 +94,7 @@ void Worker::networkStateChanged(bool isOnline) Worker::Worker(ScriptExecutionContext& context, WorkerOptions&& options) : EventTargetWithInlineData() , ContextDestructionObserver(&context) - , m_options(WTFMove(options)) + , m_options(WTF::move(options)) , m_identifier(makeString("worker:"_s, Inspector::IdentifiersFactory::createIdentifier())) , m_clientIdentifier(ScriptExecutionContext::generateIdentifier()) { @@ -149,7 +149,7 @@ bool Worker::updatePtr() ExceptionOr> Worker::create(ScriptExecutionContext& context, const String& urlInit, WorkerOptions&& options) { - auto worker = adoptRef(*new Worker(context, WTFMove(options))); + auto worker = adoptRef(*new Worker(context, WTF::move(options))); WTF::String url = urlInit; if (url.startsWith("file://"_s)) { @@ -237,22 +237,22 @@ ExceptionOr Worker::postMessage(JSC::JSGlobalObject& state, JSC::JSValue m return Exception { InvalidStateError, "Worker has been terminated"_s }; Vector> ports; - auto serialized = SerializedScriptValue::create(state, messageValue, WTFMove(options.transfer), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); + auto serialized = SerializedScriptValue::create(state, messageValue, WTF::move(options.transfer), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); if (serialized.hasException()) return serialized.releaseException(); - ExceptionOr> disentangledPorts = MessagePort::disentanglePorts(WTFMove(ports)); + ExceptionOr> disentangledPorts = MessagePort::disentanglePorts(WTF::move(ports)); if (disentangledPorts.hasException()) { return disentangledPorts.releaseException(); } MessageWithMessagePorts messageWithMessagePorts { serialized.releaseReturnValue(), disentangledPorts.releaseReturnValue() }; - this->postTaskToWorkerGlobalScope([message = WTFMove(messageWithMessagePorts)](auto& context) mutable { + this->postTaskToWorkerGlobalScope([message = WTF::move(messageWithMessagePorts)](auto& context) mutable { Zig::GlobalObject* globalObject = jsCast(context.jsGlobalObject()); - auto ports = MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)); - auto event = MessageEvent::create(*globalObject, message.message.releaseNonNull(), nullptr, WTFMove(ports)); + auto ports = MessagePort::entanglePorts(context, WTF::move(message.transferredPorts)); + auto event = MessageEvent::create(*globalObject, message.message.releaseNonNull(), nullptr, WTF::move(ports)); globalObject->globalEventScope->dispatchEvent(event.event); }); @@ -336,8 +336,8 @@ void Worker::createRTCRtpScriptTransformer(RTCRtpScriptTransform& transform, Mes if (!scriptExecutionContext()) return; - m_contextProxy.postTaskToWorkerGlobalScope([transform = Ref { transform }, options = WTFMove(options)](auto& context) mutable { - if (auto transformer = downcast(context).createRTCRtpScriptTransformer(WTFMove(options))) + m_contextProxy.postTaskToWorkerGlobalScope([transform = Ref { transform }, options = WTF::move(options)](auto& context) mutable { + if (auto transformer = downcast(context).createRTCRtpScriptTransformer(WTF::move(options))) transform->setTransformer(*transformer); }); } @@ -347,7 +347,7 @@ void Worker::drainEvents() { Locker lock(this->m_pendingTasksMutex); for (auto& task : m_pendingTasks) - postTaskToWorkerGlobalScope(WTFMove(task)); + postTaskToWorkerGlobalScope(WTF::move(task)); m_pendingTasks.clear(); } @@ -386,7 +386,7 @@ void Worker::fireEarlyMessages(Zig::GlobalObject* workerGlobalObject) task(*thisContext); } } else { - thisContext->postTask([tasks = WTFMove(tasks)](auto& ctx) mutable { + thisContext->postTask([tasks = WTF::move(tasks)](auto& ctx) mutable { for (auto& task : tasks) { task(ctx); } @@ -451,11 +451,11 @@ void Worker::postTaskToWorkerGlobalScope(Function { if (!(m_onlineClosingFlags & OnlineFlag)) { Locker lock(this->m_pendingTasksMutex); - this->m_pendingTasks.append(WTFMove(task)); + this->m_pendingTasks.append(WTF::move(task)); return; } - ScriptExecutionContext::postTaskTo(m_clientIdentifier, WTFMove(task)); + ScriptExecutionContext::postTaskTo(m_clientIdentifier, WTF::move(task)); } void Worker::forEachWorker(const Function()>& callback) @@ -565,9 +565,9 @@ JSValue createNodeWorkerThreadsBinding(Zig::GlobalObject* globalObject) if (auto* worker = WebWorker__getParentWorker(globalObject->bunVM())) { auto& options = worker->options(); - auto ports = MessagePort::entanglePorts(*ScriptExecutionContext::getScriptExecutionContext(worker->clientIdentifier()), WTFMove(options.dataMessagePorts)); - RefPtr serialized = WTFMove(options.workerDataAndEnvironmentData); - JSValue deserialized = serialized->deserialize(*globalObject, globalObject, WTFMove(ports)); + auto ports = MessagePort::entanglePorts(*ScriptExecutionContext::getScriptExecutionContext(worker->clientIdentifier()), WTF::move(options.dataMessagePorts)); + RefPtr serialized = WTF::move(options.workerDataAndEnvironmentData); + JSValue deserialized = serialized->deserialize(*globalObject, globalObject, WTF::move(ports)); RETURN_IF_EXCEPTION(scope, {}); // Should always be set to an Array of length 2 in the constructor in JSWorker.cpp auto* pair = jsCast(deserialized); @@ -644,14 +644,14 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPostMessage, } Vector> ports; - ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTFMove(transferList), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); + ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTF::move(transferList), ports, SerializationForStorage::No, SerializationContext::WorkerPostMessage); if (serialized.hasException()) { WebCore::propagateException(*globalObject, scope, serialized.releaseException()); RELEASE_AND_RETURN(scope, {}); } scope.assertNoException(); - ExceptionOr> disentangledPorts = MessagePort::disentanglePorts(WTFMove(ports)); + ExceptionOr> disentangledPorts = MessagePort::disentanglePorts(WTF::move(ports)); if (disentangledPorts.hasException()) { WebCore::propagateException(*globalObject, scope, serialized.releaseException()); RELEASE_AND_RETURN(scope, {}); @@ -663,8 +663,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionPostMessage, ScriptExecutionContext::postTaskTo(context->identifier(), [message = messageWithMessagePorts, protectedThis = Ref { *worker }, ports](ScriptExecutionContext& context) mutable { Zig::GlobalObject* globalObject = jsCast(context.jsGlobalObject()); - auto ports = MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)); - auto event = MessageEvent::create(*globalObject, message.message.releaseNonNull(), nullptr, WTFMove(ports)); + auto ports = MessagePort::entanglePorts(context, WTF::move(message.transferredPorts)); + auto event = MessageEvent::create(*globalObject, message.message.releaseNonNull(), nullptr, WTF::move(ports)); protectedThis->dispatchEvent(event.event); }); diff --git a/src/bun.js/bindings/webcore/WritableStream.cpp b/src/bun.js/bindings/webcore/WritableStream.cpp index 97d56b47611f03..d0c06376a9ab51 100644 --- a/src/bun.js/bindings/webcore/WritableStream.cpp +++ b/src/bun.js/bindings/webcore/WritableStream.cpp @@ -55,16 +55,16 @@ ExceptionOr> WritableStream::create(JSC::JSGlobalObject& glo ExceptionOr> WritableStream::create(JSDOMGlobalObject& globalObject, Ref&& sink) { - return create(globalObject, toJSNewlyCreated(&globalObject, &globalObject, WTFMove(sink)), JSC::jsUndefined()); + return create(globalObject, toJSNewlyCreated(&globalObject, &globalObject, WTF::move(sink)), JSC::jsUndefined()); } Ref WritableStream::create(Ref&& internalWritableStream) { - return adoptRef(*new WritableStream(WTFMove(internalWritableStream))); + return adoptRef(*new WritableStream(WTF::move(internalWritableStream))); } WritableStream::WritableStream(Ref&& internalWritableStream) - : m_internalWritableStream(WTFMove(internalWritableStream)) + : m_internalWritableStream(WTF::move(internalWritableStream)) { } diff --git a/src/bun.js/bindings/webcore/WritableStreamSink.h b/src/bun.js/bindings/webcore/WritableStreamSink.h index b15e34d91eced8..2b20494fff5c9a 100644 --- a/src/bun.js/bindings/webcore/WritableStreamSink.h +++ b/src/bun.js/bindings/webcore/WritableStreamSink.h @@ -47,7 +47,7 @@ class WritableStreamSink : public RefCounted { class SimpleWritableStreamSink : public WritableStreamSink { public: using WriteCallback = Function(ScriptExecutionContext&, JSC::JSValue)>; - static Ref create(WriteCallback&& writeCallback) { return adoptRef(*new SimpleWritableStreamSink(WTFMove(writeCallback))); } + static Ref create(WriteCallback&& writeCallback) { return adoptRef(*new SimpleWritableStreamSink(WTF::move(writeCallback))); } private: explicit SimpleWritableStreamSink(WriteCallback&&); @@ -60,7 +60,7 @@ class SimpleWritableStreamSink : public WritableStreamSink { }; inline SimpleWritableStreamSink::SimpleWritableStreamSink(WriteCallback&& writeCallback) - : m_writeCallback(WTFMove(writeCallback)) + : m_writeCallback(WTF::move(writeCallback)) { } diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp index 318a8e15bef4df..0fd57c8e610e20 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp @@ -96,9 +96,9 @@ template static void dispatchAlgorithmOperation(WorkQueue& workQueue, ScriptExecutionContext& context, ResultCallbackType&& callback, CryptoAlgorithm::ExceptionCallback&& exceptionCallback, OperationType&& operation) { workQueue.dispatch(context.globalObject(), - [operation = WTFMove(operation), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), contextIdentifier = context.identifier()]() mutable { + [operation = WTF::move(operation), callback = WTF::move(callback), exceptionCallback = WTF::move(exceptionCallback), contextIdentifier = context.identifier()]() mutable { auto result = operation(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [result = crossThreadCopy(WTFMove(result)), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](auto& context) mutable { + ScriptExecutionContext::postTaskTo(contextIdentifier, [result = crossThreadCopy(WTF::move(result)), callback = WTF::move(callback), exceptionCallback = WTF::move(exceptionCallback)](auto& context) mutable { if (result.hasException()) { exceptionCallback(result.releaseException().code(), ""_s); return; @@ -110,12 +110,12 @@ static void dispatchAlgorithmOperation(WorkQueue& workQueue, ScriptExecutionCont void CryptoAlgorithm::dispatchOperationInWorkQueue(WorkQueue& workQueue, ScriptExecutionContext& context, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, Function>()>&& operation) { - dispatchAlgorithmOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), WTFMove(operation)); + dispatchAlgorithmOperation(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), WTF::move(operation)); } void CryptoAlgorithm::dispatchOperationInWorkQueue(WorkQueue& workQueue, ScriptExecutionContext& context, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, Function()>&& operation) { - dispatchAlgorithmOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), WTFMove(operation)); + dispatchAlgorithmOperation(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), WTF::move(operation)); } } diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp index 585ed77c2f27c3..7611b719a306ab 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp @@ -67,8 +67,8 @@ void CryptoAlgorithmAES_CBC::encrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(parameters, downcast(key.get()), plainText); }); } @@ -83,8 +83,8 @@ void CryptoAlgorithmAES_CBC::decrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(parameters, downcast(key.get()), cipherText); }); } @@ -104,7 +104,7 @@ void CryptoAlgorithmAES_CBC::generateKey(const CryptoAlgorithmParameters& parame return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -119,7 +119,7 @@ void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyAES::importRaw(parameters.identifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { auto checkAlgCallback = [](size_t length, const String& alg) -> bool { @@ -133,7 +133,7 @@ void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, c } return false; }; - result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(std::get(data)), extractable, usages, WTFMove(checkAlgCallback)); + result = CryptoKeyAES::importJwk(parameters.identifier, WTF::move(std::get(data)), extractable, usages, WTF::move(checkAlgCallback)); break; } default: @@ -178,7 +178,7 @@ void CryptoAlgorithmAES_CBC::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -186,7 +186,7 @@ void CryptoAlgorithmAES_CBC::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } ExceptionOr CryptoAlgorithmAES_CBC::getKeyLength(const CryptoAlgorithmParameters& parameters) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp index b6dd15c01c7dd8..793b97da88da08 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp @@ -122,7 +122,7 @@ ExceptionOr> CryptoAlgorithmAES_CBC::platformEncrypt(const Crypt auto output = cryptEncrypt(key.key(), parameters.ivVector(), Vector(plainText)); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } ExceptionOr> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector& cipherText, Padding) @@ -130,7 +130,7 @@ ExceptionOr> CryptoAlgorithmAES_CBC::platformDecrypt(const Crypt auto output = cryptDecrypt(key.key(), parameters.ivVector(), cipherText); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp index 34b7afe92bddd2..7d18189bce3f81 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp @@ -67,8 +67,8 @@ void CryptoAlgorithmAES_CFB::encrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(parameters, downcast(key.get()), plainText); }); } @@ -83,8 +83,8 @@ void CryptoAlgorithmAES_CFB::decrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(parameters, downcast(key.get()), cipherText); }); } @@ -104,7 +104,7 @@ void CryptoAlgorithmAES_CFB::generateKey(const CryptoAlgorithmParameters& parame return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -119,7 +119,7 @@ void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyAES::importRaw(parameters.identifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { auto checkAlgCallback = [](size_t length, const String& alg) -> bool { @@ -133,7 +133,7 @@ void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, c } return false; }; - result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(std::get(data)), extractable, usages, WTFMove(checkAlgCallback)); + result = CryptoKeyAES::importJwk(parameters.identifier, WTF::move(std::get(data)), extractable, usages, WTF::move(checkAlgCallback)); break; } default: @@ -178,7 +178,7 @@ void CryptoAlgorithmAES_CFB::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -186,7 +186,7 @@ void CryptoAlgorithmAES_CFB::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } ExceptionOr CryptoAlgorithmAES_CFB::getKeyLength(const CryptoAlgorithmParameters& parameters) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp index 4de16b439ce137..3cab769697c883 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp @@ -89,7 +89,7 @@ ExceptionOr> CryptoAlgorithmAES_CFB::platformEncrypt(const Crypt auto output = cryptEncrypt(key.key(), parameters.ivVector(), Vector(plainText)); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } ExceptionOr> CryptoAlgorithmAES_CFB::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector& cipherText) @@ -97,7 +97,7 @@ ExceptionOr> CryptoAlgorithmAES_CFB::platformDecrypt(const Crypt auto output = cryptDecrypt(key.key(), parameters.ivVector(), cipherText); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp index 8902fb3c244384..5e3d440ad7a561 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp @@ -78,8 +78,8 @@ void CryptoAlgorithmAES_CTR::encrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(parameters, downcast(key.get()), plainText); }); } @@ -92,8 +92,8 @@ void CryptoAlgorithmAES_CTR::decrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(parameters, downcast(key.get()), cipherText); }); } @@ -113,7 +113,7 @@ void CryptoAlgorithmAES_CTR::generateKey(const CryptoAlgorithmParameters& parame return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -128,7 +128,7 @@ void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyAES::importRaw(parameters.identifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { auto checkAlgCallback = [](size_t length, const String& alg) -> bool { @@ -142,7 +142,7 @@ void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, c } return false; }; - result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(std::get(data)), extractable, usages, WTFMove(checkAlgCallback)); + result = CryptoKeyAES::importJwk(parameters.identifier, WTF::move(std::get(data)), extractable, usages, WTF::move(checkAlgCallback)); break; } default: @@ -187,7 +187,7 @@ void CryptoAlgorithmAES_CTR::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -195,7 +195,7 @@ void CryptoAlgorithmAES_CTR::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } ExceptionOr CryptoAlgorithmAES_CTR::getKeyLength(const CryptoAlgorithmParameters& parameters) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp index ead077e8f77785..fbbebef8d33765 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp @@ -129,7 +129,7 @@ ExceptionOr> CryptoAlgorithmAES_CTR::platformEncrypt(const Crypt auto output = crypt(1, key.key(), parameters.counterVector(), parameters.length, plainText); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } ExceptionOr> CryptoAlgorithmAES_CTR::platformDecrypt(const CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector& cipherText) @@ -137,7 +137,7 @@ ExceptionOr> CryptoAlgorithmAES_CTR::platformDecrypt(const Crypt auto output = crypt(0, key.key(), parameters.counterVector(), parameters.length, cipherText); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp index af4b982fa7cd4f..0340d3bedf6c99 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp @@ -98,8 +98,8 @@ void CryptoAlgorithmAES_GCM::encrypt(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(parameters, downcast(key.get()), plainText); }); } @@ -131,8 +131,8 @@ void CryptoAlgorithmAES_GCM::decrypt(const CryptoAlgorithmParameters& parameters } #endif - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(aesParameters), key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(parameters, downcast(key.get()), cipherText); }); } @@ -152,7 +152,7 @@ void CryptoAlgorithmAES_GCM::generateKey(const CryptoAlgorithmParameters& parame return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -167,7 +167,7 @@ void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyAES::importRaw(parameters.identifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { auto checkAlgCallback = [](size_t length, const String& alg) -> bool { @@ -181,7 +181,7 @@ void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, c } return false; }; - result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(std::get(data)), extractable, usages, WTFMove(checkAlgCallback)); + result = CryptoKeyAES::importJwk(parameters.identifier, WTF::move(std::get(data)), extractable, usages, WTF::move(checkAlgCallback)); break; } default: @@ -226,7 +226,7 @@ void CryptoAlgorithmAES_GCM::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -234,7 +234,7 @@ void CryptoAlgorithmAES_GCM::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } ExceptionOr CryptoAlgorithmAES_GCM::getKeyLength(const CryptoAlgorithmParameters& parameters) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp index a077f38fa32a30..f65f45e505823d 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp @@ -171,7 +171,7 @@ ExceptionOr> CryptoAlgorithmAES_GCM::platformEncrypt(const Crypt auto output = cryptEncrypt(key.key(), parameters.ivVector(), plainText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } ExceptionOr> CryptoAlgorithmAES_GCM::platformDecrypt(const CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector& cipherText) @@ -179,7 +179,7 @@ ExceptionOr> CryptoAlgorithmAES_GCM::platformDecrypt(const Crypt auto output = cryptDecrypt(key.key(), parameters.ivVector(), cipherText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp index c748c892547757..ffb2a14ad0b846 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp @@ -68,7 +68,7 @@ void CryptoAlgorithmAES_KW::generateKey(const CryptoAlgorithmParameters& paramet return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmAES_KW::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -83,10 +83,10 @@ void CryptoAlgorithmAES_KW::importKey(CryptoKeyFormat format, KeyData&& data, co RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyAES::importRaw(parameters.identifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { - result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(std::get(data)), extractable, usages, [](size_t length, const String& alg) -> bool { + result = CryptoKeyAES::importJwk(parameters.identifier, WTF::move(std::get(data)), extractable, usages, [](size_t length, const String& alg) -> bool { switch (length) { case CryptoKeyAES::s_length128: return alg.isNull() || alg == ALG128; @@ -141,7 +141,7 @@ void CryptoAlgorithmAES_KW::exportKey(CryptoKeyFormat format, Ref&& k default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -149,7 +149,7 @@ void CryptoAlgorithmAES_KW::exportKey(CryptoKeyFormat format, Ref&& k return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } void CryptoAlgorithmAES_KW::wrapKey(Ref&& key, Vector&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -159,7 +159,7 @@ void CryptoAlgorithmAES_KW::wrapKey(Ref&& key, Vector&& data return; } - auto result = platformWrapKey(downcast(key.get()), WTFMove(data)); + auto result = platformWrapKey(downcast(key.get()), WTF::move(data)); if (result.hasException()) { exceptionCallback(result.releaseException().code(), ""_s); return; @@ -170,7 +170,7 @@ void CryptoAlgorithmAES_KW::wrapKey(Ref&& key, Vector&& data void CryptoAlgorithmAES_KW::unwrapKey(Ref&& key, Vector&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback) { - auto result = platformUnwrapKey(downcast(key.get()), WTFMove(data)); + auto result = platformUnwrapKey(downcast(key.get()), WTF::move(data)); if (result.hasException()) { exceptionCallback(result.releaseException().code(), ""_s); return; diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp index 4ff61e651610d3..0ac8358ee6c7cf 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp @@ -70,7 +70,7 @@ ExceptionOr> CryptoAlgorithmAES_KW::platformWrapKey(const Crypto auto output = cryptWrapKey(key.key(), data); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } ExceptionOr> CryptoAlgorithmAES_KW::platformUnwrapKey(const CryptoKeyAES& key, const Vector& data) @@ -78,7 +78,7 @@ ExceptionOr> CryptoAlgorithmAES_KW::platformUnwrapKey(const Cryp auto output = cryptUnwrapKey(key.key(), data); if (!output) return Exception { OperationError }; - return WTFMove(*output); + return WTF::move(*output); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h index 492cf764edd870..99ac3975486f00 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmAesGcmParams.h @@ -56,7 +56,7 @@ class CryptoAlgorithmAesGcmParams final : public CryptoAlgorithmParameters { if (!m_additionalDataVector.isEmpty() || !additionalData) return m_additionalDataVector; - BufferSource additionalDataBuffer = WTFMove(*additionalData); + BufferSource additionalDataBuffer = WTF::move(*additionalData); additionalData = std::nullopt; if (!additionalDataBuffer.length()) return m_additionalDataVector; diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp index acb047cc722bac..7432f8bbaee999 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp @@ -63,7 +63,7 @@ void CryptoAlgorithmECDH::generateKey(const CryptoAlgorithmParameters& parameter auto pair = result.releaseReturnValue(); pair.publicKey->setUsagesBitmap(0); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits)); - callback(WTFMove(pair)); + callback(WTF::move(pair)); } void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters, Ref&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue) @@ -90,13 +90,13 @@ void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters return; } - auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](std::optional>&& derivedKey, size_t length) mutable { + auto unifiedCallback = [callback = WTF::move(callback), exceptionCallback = WTF::move(exceptionCallback)](std::optional>&& derivedKey, size_t length) mutable { if (!derivedKey) { exceptionCallback(OperationError, ""_s); return; } if (!length) { - callback(WTFMove(*derivedKey)); + callback(WTF::move(*derivedKey)); return; } auto lengthInBytes = std::ceil(length / 8.); @@ -105,16 +105,16 @@ void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters return; } (*derivedKey).shrink(lengthInBytes); - callback(WTFMove(*derivedKey)); + callback(WTF::move(*derivedKey)); }; // This is a special case that can't use dispatchOperation() because it bundles // the result validation and callback dispatch into unifiedCallback. workQueue.dispatch(context.globalObject(), - [baseKey = WTFMove(baseKey), publicKey = ecParameters.publicKey, length, unifiedCallback = WTFMove(unifiedCallback), contextIdentifier = context.identifier()]() mutable { + [baseKey = WTF::move(baseKey), publicKey = ecParameters.publicKey, length, unifiedCallback = WTF::move(unifiedCallback), contextIdentifier = context.identifier()]() mutable { auto derivedKey = platformDeriveBits(downcast(baseKey.get()), downcast(*publicKey)); - ScriptExecutionContext::postTaskTo(contextIdentifier, [derivedKey = WTFMove(derivedKey), length, unifiedCallback = WTFMove(unifiedCallback)](auto&) mutable { - unifiedCallback(WTFMove(derivedKey), length); + ScriptExecutionContext::postTaskTo(contextIdentifier, [derivedKey = WTF::move(derivedKey), length, unifiedCallback = WTF::move(unifiedCallback)](auto&) mutable { + unifiedCallback(WTF::move(derivedKey), length); }); }); } @@ -126,7 +126,7 @@ void CryptoAlgorithmECDH::importKey(CryptoKeyFormat format, KeyData&& data, cons RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); bool isUsagesAllowed = false; if (!key.d.isNull()) { @@ -145,7 +145,7 @@ void CryptoAlgorithmECDH::importKey(CryptoKeyFormat format, KeyData&& data, cons return; } - result = CryptoKeyEC::importJwk(ecParameters.identifier, ecParameters.namedCurve, WTFMove(key), extractable, usages); + result = CryptoKeyEC::importJwk(ecParameters.identifier, ecParameters.namedCurve, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Raw: @@ -153,21 +153,21 @@ void CryptoAlgorithmECDH::importKey(CryptoKeyFormat format, KeyData&& data, cons exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importRaw(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importRaw(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Spki: if (usages) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importSpki(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importSpki(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Pkcs8: if (usages && (usages ^ CryptoKeyUsageDeriveKey) && (usages ^ CryptoKeyUsageDeriveBits) && (usages ^ (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits))) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importPkcs8(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importPkcs8(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; } if (!result) { @@ -227,7 +227,7 @@ void CryptoAlgorithmECDH::exportKey(CryptoKeyFormat format, Ref&& key } } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp index 4744b65003241c..4fb66d6f30168d 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp @@ -62,8 +62,8 @@ void CryptoAlgorithmECDSA::sign(const CryptoAlgorithmParameters& parameters, Ref return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), key = WTFMove(key), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), data = WTF::move(data)] { return platformSign(parameters, downcast(key.get()), data); }); } @@ -75,8 +75,8 @@ void CryptoAlgorithmECDSA::verify(const CryptoAlgorithmParameters& parameters, R return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), signature = WTF::move(signature), data = WTF::move(data)] { return platformVerify(parameters, downcast(key.get()), signature, data); }); } @@ -99,7 +99,7 @@ void CryptoAlgorithmECDSA::generateKey(const CryptoAlgorithmParameters& paramete auto pair = result.releaseReturnValue(); pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & CryptoKeyUsageVerify); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & CryptoKeyUsageSign); - callback(WTFMove(pair)); + callback(WTF::move(pair)); } void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -110,7 +110,7 @@ void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, con RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() && (usages ^ CryptoKeyUsageVerify)))) { exceptionCallback(SyntaxError, ""_s); @@ -133,7 +133,7 @@ void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, con return; } - result = CryptoKeyEC::importJwk(ecParameters.identifier, ecParameters.namedCurve, WTFMove(key), extractable, usages); + result = CryptoKeyEC::importJwk(ecParameters.identifier, ecParameters.namedCurve, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Raw: @@ -141,21 +141,21 @@ void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, con exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importRaw(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importRaw(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Spki: if (usages && (usages ^ CryptoKeyUsageVerify)) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importSpki(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importSpki(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Pkcs8: if (usages && (usages ^ CryptoKeyUsageSign)) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyEC::importPkcs8(ecParameters.identifier, ecParameters.namedCurve, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyEC::importPkcs8(ecParameters.identifier, ecParameters.namedCurve, WTF::move(std::get>(data)), extractable, usages); break; } if (!result) { @@ -215,7 +215,7 @@ void CryptoAlgorithmECDSA::exportKey(CryptoKeyFormat format, Ref&& ke } } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp index 826730b818e21a..c113cf7a8e055e 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp @@ -84,7 +84,7 @@ void CryptoAlgorithmEd25519::generateKey(const CryptoAlgorithmParameters&, bool auto pair = result.releaseReturnValue(); pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & CryptoKeyUsageVerify); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & CryptoKeyUsageSign); - callback(WTFMove(pair)); + callback(WTF::move(pair)); } void CryptoAlgorithmEd25519::sign(const CryptoAlgorithmParameters&, Ref&& key, Vector&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue) @@ -93,8 +93,8 @@ void CryptoAlgorithmEd25519::sign(const CryptoAlgorithmParameters&, Ref(key.get()), data); }); } @@ -105,8 +105,8 @@ void CryptoAlgorithmEd25519::verify(const CryptoAlgorithmParameters&, Ref(key.get()), signature, data); }); } @@ -116,7 +116,7 @@ void CryptoAlgorithmEd25519::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() && (usages ^ CryptoKeyUsageVerify)))) { exceptionCallback(SyntaxError, ""_s); return; @@ -125,7 +125,7 @@ void CryptoAlgorithmEd25519::importKey(CryptoKeyFormat format, KeyData&& data, c exceptionCallback(DataError, ""_s); return; } - result = CryptoKeyOKP::importJwk(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTFMove(key), extractable, usages); + result = CryptoKeyOKP::importJwk(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Raw: @@ -133,21 +133,21 @@ void CryptoAlgorithmEd25519::importKey(CryptoKeyFormat format, KeyData&& data, c exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Spki: if (usages && (usages ^ CryptoKeyUsageVerify)) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importSpki(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importSpki(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Pkcs8: if (usages && (usages ^ CryptoKeyUsageSign)) { exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importPkcs8(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importPkcs8(CryptoAlgorithmIdentifier::Ed25519, CryptoKeyOKP::NamedCurve::Ed25519, WTF::move(std::get>(data)), extractable, usages); break; } if (!result) { @@ -203,7 +203,7 @@ void CryptoAlgorithmEd25519::exportKey(CryptoKeyFormat format, Ref&& break; } } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp index a8aafe83e0a126..bf4bab881ed55a 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp @@ -52,8 +52,8 @@ void CryptoAlgorithmHKDF::deriveBits(const CryptoAlgorithmParameters& parameters return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), baseKey = WTFMove(baseKey), length] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), baseKey = WTF::move(baseKey), length] { return platformDeriveBits(parameters, downcast(baseKey.get()), length); }); } @@ -73,7 +73,7 @@ void CryptoAlgorithmHKDF::importKey(CryptoKeyFormat format, KeyData&& data, cons return; } - callback(CryptoKeyRaw::create(parameters.identifier, WTFMove(std::get>(data)), usages)); + callback(CryptoKeyRaw::create(parameters.identifier, WTF::move(std::get>(data)), usages)); } ExceptionOr CryptoAlgorithmHKDF::getKeyLength(const CryptoAlgorithmParameters&) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp index d5226cc6b6177c..f0c036ac8cd31c 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp @@ -59,16 +59,16 @@ CryptoAlgorithmIdentifier CryptoAlgorithmHMAC::identifier() const void CryptoAlgorithmHMAC::sign(const CryptoAlgorithmParameters&, Ref&& key, Vector&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue) { - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [key = WTFMove(key), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [key = WTF::move(key), data = WTF::move(data)] { return platformSign(downcast(key.get()), data); }); } void CryptoAlgorithmHMAC::verify(const CryptoAlgorithmParameters&, Ref&& key, Vector&& signature, Vector&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue) { - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [key = WTF::move(key), signature = WTF::move(signature), data = WTF::move(data)] { return platformVerify(downcast(key.get()), signature, data); }); } @@ -93,7 +93,7 @@ void CryptoAlgorithmHMAC::generateKey(const CryptoAlgorithmParameters& parameter return; } - callback(WTFMove(result)); + callback(WTF::move(result)); } void CryptoAlgorithmHMAC::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -110,7 +110,7 @@ void CryptoAlgorithmHMAC::importKey(CryptoKeyFormat format, KeyData&& data, cons RefPtr result; switch (format) { case CryptoKeyFormat::Raw: - result = CryptoKeyHMAC::importRaw(hmacParameters.length.value_or(0), hmacParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyHMAC::importRaw(hmacParameters.length.value_or(0), hmacParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Jwk: { auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const String& alg) -> bool { @@ -130,7 +130,7 @@ void CryptoAlgorithmHMAC::importKey(CryptoKeyFormat format, KeyData&& data, cons } return false; }; - result = CryptoKeyHMAC::importJwk(hmacParameters.length.value_or(0), hmacParameters.hashIdentifier, WTFMove(std::get(data)), extractable, usages, WTFMove(checkAlgCallback)); + result = CryptoKeyHMAC::importJwk(hmacParameters.length.value_or(0), hmacParameters.hashIdentifier, WTF::move(std::get(data)), extractable, usages, WTF::move(checkAlgCallback)); break; } default: @@ -181,7 +181,7 @@ void CryptoAlgorithmHMAC::exportKey(CryptoKeyFormat format, Ref&& key default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } default: @@ -189,7 +189,7 @@ void CryptoAlgorithmHMAC::exportKey(CryptoKeyFormat format, Ref&& key return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } ExceptionOr CryptoAlgorithmHMAC::getKeyLength(const CryptoAlgorithmParameters& parameters) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp index 01d42f82fba5be..3f2b816092dadf 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp @@ -69,7 +69,7 @@ ExceptionOr> CryptoAlgorithmHMAC::platformSignWithAlgorithm(cons auto result = calculateSignature(algorithm, key.key(), data.begin(), data.size()); if (!result) return Exception { OperationError }; - return WTFMove(*result); + return WTF::move(*result); } ExceptionOr> CryptoAlgorithmHMAC::platformSign(const CryptoKeyHMAC& key, const Vector& data) @@ -81,7 +81,7 @@ ExceptionOr> CryptoAlgorithmHMAC::platformSign(const CryptoKeyHM auto result = calculateSignature(algorithm, key.key(), data.begin(), data.size()); if (!result) return Exception { OperationError }; - return WTFMove(*result); + return WTF::move(*result); } ExceptionOr CryptoAlgorithmHMAC::platformVerifyWithAlgorithm(const CryptoKeyHMAC& key, CryptoAlgorithmIdentifier algorithmIdentifier, const Vector& signature, const Vector& data) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp index 52d973669529db..c72a7827ecd81e 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp @@ -52,8 +52,8 @@ void CryptoAlgorithmPBKDF2::deriveBits(const CryptoAlgorithmParameters& paramete return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), baseKey = WTFMove(baseKey), length] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), baseKey = WTF::move(baseKey), length] { return platformDeriveBits(parameters, downcast(baseKey.get()), length); }); } @@ -73,7 +73,7 @@ void CryptoAlgorithmPBKDF2::importKey(CryptoKeyFormat format, KeyData&& data, co return; } - callback(CryptoKeyRaw::create(parameters.identifier, WTFMove(std::get>(data)), usages)); + callback(CryptoKeyRaw::create(parameters.identifier, WTF::move(std::get>(data)), usages)); } ExceptionOr CryptoAlgorithmPBKDF2::getKeyLength(const CryptoAlgorithmParameters&) diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp index 691ad5f4e21b83..50685c399cd848 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp @@ -54,8 +54,8 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(const CryptoAlgorithmParameters&, return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(downcast(key.get()), plainText); }); } @@ -67,8 +67,8 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt(const CryptoAlgorithmParameters&, return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(downcast(key.get()), cipherText); }); } @@ -82,16 +82,16 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const CryptoAlgorithmParameter return; } - auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&& pair) { + auto keyPairCallback = [capturedCallback = WTF::move(callback)](CryptoKeyPair&& pair) { pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & CryptoKeyUsageEncrypt); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & CryptoKeyUsageDecrypt); - capturedCallback(WTFMove(pair)); + capturedCallback(WTF::move(pair)); }; - auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() { + auto failureCallback = [capturedCallback = WTF::move(exceptionCallback)]() { capturedCallback(OperationError, ""_s); }; // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect. - CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, CryptoAlgorithmIdentifier::SHA_1, false, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context); + CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, CryptoAlgorithmIdentifier::SHA_1, false, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTF::move(keyPairCallback), WTF::move(failureCallback), &context); } void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -99,7 +99,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageDecrypt)) || (key.d.isNull() && (usages ^ CryptoKeyUsageEncrypt)))) { exceptionCallback(SyntaxError, ""_s); return; @@ -112,7 +112,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& exceptionCallback(DataError, ""_s); return; } - result = CryptoKeyRSA::importJwk(parameters.identifier, std::nullopt, WTFMove(key), extractable, usages); + result = CryptoKeyRSA::importJwk(parameters.identifier, std::nullopt, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Spki: { @@ -120,7 +120,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyRSA::importSpki(parameters.identifier, std::nullopt, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importSpki(parameters.identifier, std::nullopt, WTF::move(std::get>(data)), extractable, usages); break; } case CryptoKeyFormat::Pkcs8: { @@ -128,7 +128,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData& exceptionCallback(SyntaxError, ""_s); return; } - result = CryptoKeyRSA::importPkcs8(parameters.identifier, std::nullopt, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importPkcs8(parameters.identifier, std::nullopt, WTF::move(std::get>(data)), extractable, usages); break; } default: @@ -157,7 +157,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey(CryptoKeyFormat format, Ref(key.get()), data); }); } @@ -74,8 +74,8 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::verify(const CryptoAlgorithmParameters&, return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [key = WTF::move(key), signature = WTF::move(signature), data = WTF::move(data)] { return platformVerify(downcast(key.get()), signature, data); }); } @@ -89,15 +89,15 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const CryptoAlgorithmParamete return; } - auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&& pair) { + auto keyPairCallback = [capturedCallback = WTF::move(callback)](CryptoKeyPair&& pair) { pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & CryptoKeyUsageVerify); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & CryptoKeyUsageSign); - capturedCallback(WTFMove(pair)); + capturedCallback(WTF::move(pair)); }; - auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() { + auto failureCallback = [capturedCallback = WTF::move(exceptionCallback)]() { capturedCallback(OperationError, ""_s); }; - CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context); + CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTF::move(keyPairCallback), WTF::move(failureCallback), &context); } void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -109,7 +109,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() && (usages ^ CryptoKeyUsageVerify)))) { exceptionCallback(SyntaxError, ""_s); @@ -145,7 +145,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData return; } - result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(key), extractable, usages); + result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Spki: { @@ -154,7 +154,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData return; } // FIXME: - result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } case CryptoKeyFormat::Pkcs8: { @@ -163,7 +163,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData return; } // FIXME: - result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } default: @@ -211,7 +211,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey(CryptoKeyFormat format, Ref(parameters)), key = WTFMove(key), plainText = WTFMove(plainText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), plainText = WTF::move(plainText)] { return platformEncrypt(parameters, downcast(key.get()), plainText); }); } @@ -76,8 +76,8 @@ void CryptoAlgorithmRSA_OAEP::decrypt(const CryptoAlgorithmParameters& parameter return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), key = WTFMove(key), cipherText = WTFMove(cipherText)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), cipherText = WTF::move(cipherText)] { return platformDecrypt(parameters, downcast(key.get()), cipherText); }); } @@ -91,15 +91,15 @@ void CryptoAlgorithmRSA_OAEP::generateKey(const CryptoAlgorithmParameters& param return; } - auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&& pair) { + auto keyPairCallback = [capturedCallback = WTF::move(callback)](CryptoKeyPair&& pair) { pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & (CryptoKeyUsageEncrypt | CryptoKeyUsageWrapKey)); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey)); - capturedCallback(WTFMove(pair)); + capturedCallback(WTF::move(pair)); }; - auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() { + auto failureCallback = [capturedCallback = WTF::move(exceptionCallback)]() { capturedCallback(OperationError, ""_s); }; - CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context); + CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTF::move(keyPairCallback), WTF::move(failureCallback), &context); } void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -111,7 +111,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); bool isUsagesAllowed = false; if (!key.d.isNull()) { @@ -159,7 +159,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, return; } - result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(key), extractable, usages); + result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Spki: { @@ -168,7 +168,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, return; } // FIXME: - result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } case CryptoKeyFormat::Pkcs8: { @@ -177,7 +177,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, return; } // FIXME: - result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } default: @@ -225,7 +225,7 @@ void CryptoAlgorithmRSA_OAEP::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } case CryptoKeyFormat::Spki: { @@ -253,7 +253,7 @@ void CryptoAlgorithmRSA_OAEP::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp index 11a851ff4abbdf..d6e585d6832392 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp @@ -63,8 +63,8 @@ void CryptoAlgorithmRSA_PSS::sign(const CryptoAlgorithmParameters& parameters, R return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), key = WTFMove(key), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), data = WTF::move(data)] { return platformSign(parameters, downcast(key.get()), data); }); } @@ -76,8 +76,8 @@ void CryptoAlgorithmRSA_PSS::verify(const CryptoAlgorithmParameters& parameters, return; } - dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), - [parameters = crossThreadCopy(downcast(parameters)), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] { + dispatchOperationInWorkQueue(workQueue, context, WTF::move(callback), WTF::move(exceptionCallback), + [parameters = crossThreadCopy(downcast(parameters)), key = WTF::move(key), signature = WTF::move(signature), data = WTF::move(data)] { return platformVerify(parameters, downcast(key.get()), signature, data); }); } @@ -91,15 +91,15 @@ void CryptoAlgorithmRSA_PSS::generateKey(const CryptoAlgorithmParameters& parame return; } - auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&& pair) { + auto keyPairCallback = [capturedCallback = WTF::move(callback)](CryptoKeyPair&& pair) { pair.publicKey->setUsagesBitmap(pair.publicKey->usagesBitmap() & CryptoKeyUsageVerify); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & CryptoKeyUsageSign); - capturedCallback(WTFMove(pair)); + capturedCallback(WTF::move(pair)); }; - auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() { + auto failureCallback = [capturedCallback = WTF::move(exceptionCallback)]() { capturedCallback(OperationError, ""_s); }; - CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_PSS, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context); + CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_PSS, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTF::move(keyPairCallback), WTF::move(failureCallback), &context); } void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) @@ -111,7 +111,7 @@ void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, c RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); if (usages && ((!key.d.isNull() && (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() && (usages ^ CryptoKeyUsageVerify)))) { exceptionCallback(SyntaxError, ""_s); @@ -147,7 +147,7 @@ void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, c return; } - result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(key), extractable, usages); + result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Spki: { @@ -156,7 +156,7 @@ void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, c return; } // FIXME: - result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } case CryptoKeyFormat::Pkcs8: { @@ -165,7 +165,7 @@ void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, c return; } // FIXME: - result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTF::move(std::get>(data)), extractable, usages); break; } default: @@ -213,7 +213,7 @@ void CryptoAlgorithmRSA_PSS::exportKey(CryptoKeyFormat format, Ref&& default: ASSERT_NOT_REACHED(); } - result = WTFMove(jwk); + result = WTF::move(jwk); break; } case CryptoKeyFormat::Spki: { @@ -239,7 +239,7 @@ void CryptoAlgorithmRSA_PSS::exportKey(CryptoKeyFormat format, Ref&& return; } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h index 4b58f7bb679d08..40874a066f4c57 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmRsaOaepParams.h @@ -46,7 +46,7 @@ class CryptoAlgorithmRsaOaepParams final : public CryptoAlgorithmParameters { if (!m_labelVector.isEmpty() || !label) return m_labelVector; - BufferSource labelBuffer = WTFMove(*label); + BufferSource labelBuffer = WTF::move(*label); label = std::nullopt; if (!labelBuffer.length()) return m_labelVector; diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp index 1332ddafef408f..16a2400f166508 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp @@ -52,19 +52,19 @@ void CryptoAlgorithmSHA1::digest(Vector&& message, VectorCallback&& cal } if (message.size() < 64) { - auto moved = WTFMove(message); + auto moved = WTF::move(message); digest->addBytes(moved.begin(), moved.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); return; } - workQueue.dispatch(context.globalObject(), [digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), contextIdentifier = context.identifier()]() mutable { + workQueue.dispatch(context.globalObject(), [digest = WTF::move(digest), message = WTF::move(message), callback = WTF::move(callback), contextIdentifier = context.identifier()]() mutable { digest->addBytes(message.begin(), message.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); }); diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp index ae5afb8913c997..d764c4b5b9ce7d 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp @@ -52,19 +52,19 @@ void CryptoAlgorithmSHA224::digest(Vector&& message, VectorCallback&& c } if (message.size() < 64) { - auto moved = WTFMove(message); + auto moved = WTF::move(message); digest->addBytes(moved.begin(), moved.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); return; } - workQueue.dispatch(context.globalObject(), [digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), contextIdentifier = context.identifier()]() mutable { + workQueue.dispatch(context.globalObject(), [digest = WTF::move(digest), message = WTF::move(message), callback = WTF::move(callback), contextIdentifier = context.identifier()]() mutable { digest->addBytes(message.begin(), message.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); }); diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp index f9bde62144f8c6..63e78ef42f5333 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp @@ -52,19 +52,19 @@ void CryptoAlgorithmSHA256::digest(Vector&& message, VectorCallback&& c } if (message.size() < 64) { - auto moved = WTFMove(message); + auto moved = WTF::move(message); digest->addBytes(moved.begin(), moved.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); return; } - workQueue.dispatch(context.globalObject(), [digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), contextIdentifier = context.identifier()]() mutable { + workQueue.dispatch(context.globalObject(), [digest = WTF::move(digest), message = WTF::move(message), callback = WTF::move(callback), contextIdentifier = context.identifier()]() mutable { digest->addBytes(message.begin(), message.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); }); diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp index cfd3b6a03026a6..880b178f176b5d 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp @@ -52,19 +52,19 @@ void CryptoAlgorithmSHA384::digest(Vector&& message, VectorCallback&& c } if (message.size() < 64) { - auto moved = WTFMove(message); + auto moved = WTF::move(message); digest->addBytes(moved.begin(), moved.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); return; } - workQueue.dispatch(context.globalObject(), [digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), contextIdentifier = context.identifier()]() mutable { + workQueue.dispatch(context.globalObject(), [digest = WTF::move(digest), message = WTF::move(message), callback = WTF::move(callback), contextIdentifier = context.identifier()]() mutable { digest->addBytes(message.begin(), message.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); }); diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp index 0d0b231cbcda4a..0adba58b4b5f50 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp @@ -52,19 +52,19 @@ void CryptoAlgorithmSHA512::digest(Vector&& message, VectorCallback&& c } if (message.size() < 64) { - auto moved = WTFMove(message); + auto moved = WTF::move(message); digest->addBytes(moved.begin(), moved.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(context.identifier(), [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); return; } - workQueue.dispatch(context.globalObject(), [digest = WTFMove(digest), message = WTFMove(message), callback = WTFMove(callback), contextIdentifier = context.identifier()]() mutable { + workQueue.dispatch(context.globalObject(), [digest = WTF::move(digest), message = WTF::move(message), callback = WTF::move(callback), contextIdentifier = context.identifier()]() mutable { digest->addBytes(message.begin(), message.size()); auto result = digest->computeHash(); - ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTFMove(callback), result = WTFMove(result)](auto&) { + ScriptExecutionContext::postTaskTo(contextIdentifier, [callback = WTF::move(callback), result = WTF::move(result)](auto&) { callback(result); }); }); diff --git a/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp b/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp index e954bdeb6d664e..a4fd7862d3b027 100644 --- a/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoAlgorithmX25519.cpp @@ -56,7 +56,7 @@ void CryptoAlgorithmX25519::generateKey(const CryptoAlgorithmParameters&, bool e auto pair = result.releaseReturnValue(); pair.publicKey->setUsagesBitmap(0); pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits)); - callback(WTFMove(pair)); + callback(WTF::move(pair)); } #if !PLATFORM(COCOA) && !USE(GCRYPT) @@ -97,13 +97,13 @@ void CryptoAlgorithmX25519::deriveBits(const CryptoAlgorithmParameters& paramete return; } - auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](std::optional>&& derivedKey, std::optional length) mutable { + auto unifiedCallback = [callback = WTF::move(callback), exceptionCallback = WTF::move(exceptionCallback)](std::optional>&& derivedKey, std::optional length) mutable { if (!derivedKey) { exceptionCallback(ExceptionCode::OperationError, ""_s); return; } if (!length) { - callback(WTFMove(*derivedKey)); + callback(WTF::move(*derivedKey)); return; } #if !HAVE(X25519_ZERO_CHECKS) @@ -121,16 +121,16 @@ void CryptoAlgorithmX25519::deriveBits(const CryptoAlgorithmParameters& paramete return; } (*derivedKey).shrink(lengthInBytes); - callback(WTFMove(*derivedKey)); + callback(WTF::move(*derivedKey)); }; // This is a special case that can't use dispatchOperation() because it bundles // the result validation and callback dispatch into unifiedCallback. workQueue.dispatch( context.globalObject(), - [baseKey = WTFMove(baseKey), publicKey = ecParameters.publicKey, length, unifiedCallback = WTFMove(unifiedCallback), contextIdentifier = context.identifier()]() mutable { + [baseKey = WTF::move(baseKey), publicKey = ecParameters.publicKey, length, unifiedCallback = WTF::move(unifiedCallback), contextIdentifier = context.identifier()]() mutable { auto derivedKey = platformDeriveBits(downcast(baseKey.get()), downcast(*publicKey)); - ScriptExecutionContext::postTaskTo(contextIdentifier, [derivedKey = WTFMove(derivedKey), length, unifiedCallback = WTFMove(unifiedCallback)](auto&) mutable { - unifiedCallback(WTFMove(derivedKey), length); + ScriptExecutionContext::postTaskTo(contextIdentifier, [derivedKey = WTF::move(derivedKey), length, unifiedCallback = WTF::move(unifiedCallback)](auto&) mutable { + unifiedCallback(WTF::move(derivedKey), length); }); }); } @@ -140,7 +140,7 @@ void CryptoAlgorithmX25519::importKey(CryptoKeyFormat format, KeyData&& data, co RefPtr result; switch (format) { case CryptoKeyFormat::Jwk: { - JsonWebKey key = WTFMove(std::get(data)); + JsonWebKey key = WTF::move(std::get(data)); bool isUsagesAllowed = false; if (!key.d.isNull()) { @@ -159,7 +159,7 @@ void CryptoAlgorithmX25519::importKey(CryptoKeyFormat format, KeyData&& data, co return; } - result = CryptoKeyOKP::importJwk(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTFMove(key), extractable, usages); + result = CryptoKeyOKP::importJwk(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTF::move(key), extractable, usages); break; } case CryptoKeyFormat::Raw: @@ -167,21 +167,21 @@ void CryptoAlgorithmX25519::importKey(CryptoKeyFormat format, KeyData&& data, co exceptionCallback(ExceptionCode::SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Spki: if (usages) { exceptionCallback(ExceptionCode::SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importSpki(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importSpki(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTF::move(std::get>(data)), extractable, usages); break; case CryptoKeyFormat::Pkcs8: if (usages && (usages ^ CryptoKeyUsageDeriveKey) && (usages ^ CryptoKeyUsageDeriveBits) && (usages ^ (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits))) { exceptionCallback(ExceptionCode::SyntaxError, ""_s); return; } - result = CryptoKeyOKP::importPkcs8(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTFMove(std::get>(data)), extractable, usages); + result = CryptoKeyOKP::importPkcs8(CryptoAlgorithmIdentifier::X25519, CryptoKeyOKP::NamedCurve::X25519, WTF::move(std::get>(data)), extractable, usages); break; } if (!result) { @@ -241,7 +241,7 @@ void CryptoAlgorithmX25519::exportKey(CryptoKeyFormat format, Ref&& k } } - callback(format, WTFMove(result)); + callback(format, WTF::move(result)); } } // namespace WebCore diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp index 12a84ebef2c2ba..fccffe6219856e 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp @@ -52,7 +52,7 @@ CryptoKeyAES::CryptoKeyAES(CryptoAlgorithmIdentifier algorithm, const Vector&& key, bool extractable, CryptoKeyUsageBitmap usage) : CryptoKey(algorithm, CryptoKeyType::Secret, extractable, usage) - , m_key(WTFMove(key)) + , m_key(WTF::move(key)) { ASSERT(isValidAESAlgorithm(algorithm)); } @@ -79,7 +79,7 @@ RefPtr CryptoKeyAES::importRaw(CryptoAlgorithmIdentifier algorithm { if (!lengthIsValid(keyData.size() * 8)) return nullptr; - return adoptRef(new CryptoKeyAES(algorithm, WTFMove(keyData), extractable, usages)); + return adoptRef(new CryptoKeyAES(algorithm, WTF::move(keyData), extractable, usages)); } RefPtr CryptoKeyAES::importJwk(CryptoAlgorithmIdentifier algorithm, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages, CheckAlgCallback&& callback) @@ -100,7 +100,7 @@ RefPtr CryptoKeyAES::importJwk(CryptoAlgorithmIdentifier algorithm if (keyData.ext && !keyData.ext.value() && extractable) return nullptr; - return adoptRef(new CryptoKeyAES(algorithm, WTFMove(*octetSequence), extractable, usages)); + return adoptRef(new CryptoKeyAES(algorithm, WTF::move(*octetSequence), extractable, usages)); } JsonWebKey CryptoKeyAES::exportJwk() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp index 596e23d8d9c050..8a4846794726b8 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp @@ -52,7 +52,7 @@ static std::optional toNamedCurve(const String& curve) CryptoKeyEC::CryptoKeyEC(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKeyContainer&& platformKey, bool extractable, CryptoKeyUsageBitmap usages) : CryptoKey(identifier, type, extractable, usages) - , m_platformKey(WTFMove(platformKey)) + , m_platformKey(WTF::move(platformKey)) , m_curve(curve) { // Only CryptoKeyEC objects for supported curves should be created. @@ -69,7 +69,7 @@ ExceptionOr CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier i if (!result) return Exception { OperationError }; - return WTFMove(*result); + return WTF::move(*result); } RefPtr CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier identifier, const String& curve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -78,7 +78,7 @@ RefPtr CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier identifier, if (!namedCurve || !platformSupportedCurve(*namedCurve)) return nullptr; - return platformImportRaw(identifier, *namedCurve, WTFMove(keyData), extractable, usages); + return platformImportRaw(identifier, *namedCurve, WTF::move(keyData), extractable, usages); } RefPtr CryptoKeyEC::importJwk(CryptoAlgorithmIdentifier identifier, const String& curve, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -106,14 +106,14 @@ RefPtr CryptoKeyEC::importJwk(CryptoAlgorithmIdentifier identifier, return nullptr; if (keyData.d.isNull()) { // import public key - return platformImportJWKPublic(identifier, *namedCurve, WTFMove(*x), WTFMove(*y), extractable, usages); + return platformImportJWKPublic(identifier, *namedCurve, WTF::move(*x), WTF::move(*y), extractable, usages); } auto d = base64URLDecode(keyData.d); if (!d) return nullptr; // import private key - return platformImportJWKPrivate(identifier, *namedCurve, WTFMove(*x), WTFMove(*y), WTFMove(*d), extractable, usages); + return platformImportJWKPrivate(identifier, *namedCurve, WTF::move(*x), WTF::move(*y), WTF::move(*d), extractable, usages); } RefPtr CryptoKeyEC::importSpki(CryptoAlgorithmIdentifier identifier, const String& curve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -122,7 +122,7 @@ RefPtr CryptoKeyEC::importSpki(CryptoAlgorithmIdentifier identifier if (!namedCurve || !platformSupportedCurve(*namedCurve)) return nullptr; - return platformImportSpki(identifier, *namedCurve, WTFMove(keyData), extractable, usages); + return platformImportSpki(identifier, *namedCurve, WTF::move(keyData), extractable, usages); } RefPtr CryptoKeyEC::importPkcs8(CryptoAlgorithmIdentifier identifier, const String& curve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -131,7 +131,7 @@ RefPtr CryptoKeyEC::importPkcs8(CryptoAlgorithmIdentifier identifie if (!namedCurve || !platformSupportedCurve(*namedCurve)) return nullptr; - return platformImportPkcs8(identifier, *namedCurve, WTFMove(keyData), extractable, usages); + return platformImportPkcs8(identifier, *namedCurve, WTF::move(keyData), extractable, usages); } ExceptionOr> CryptoKeyEC::exportRaw() const @@ -142,7 +142,7 @@ ExceptionOr> CryptoKeyEC::exportRaw() const auto&& result = platformExportRaw(); if (result.isEmpty()) return Exception { OperationError }; - return WTFMove(result); + return WTF::move(result); } ExceptionOr CryptoKeyEC::exportJwk() const @@ -175,7 +175,7 @@ ExceptionOr> CryptoKeyEC::exportSpki() const auto&& result = platformExportSpki(); if (result.isEmpty()) return Exception { OperationError }; - return WTFMove(result); + return WTF::move(result); } ExceptionOr> CryptoKeyEC::exportPkcs8() const @@ -186,7 +186,7 @@ ExceptionOr> CryptoKeyEC::exportPkcs8() const auto&& result = platformExportPkcs8(); if (result.isEmpty()) return Exception { OperationError }; - return WTFMove(result); + return WTF::move(result); } String CryptoKeyEC::namedCurveString() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyEC.h b/src/bun.js/bindings/webcrypto/CryptoKeyEC.h index 8e8f5eb351117e..f8fb270ae29c5a 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyEC.h +++ b/src/bun.js/bindings/webcrypto/CryptoKeyEC.h @@ -70,7 +70,7 @@ class CryptoKeyEC final : public CryptoKey { static Ref create(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKeyContainer&& platformKey, bool extractable, CryptoKeyUsageBitmap usages) { - return adoptRef(*new CryptoKeyEC(identifier, curve, type, WTFMove(platformKey), extractable, usages)); + return adoptRef(*new CryptoKeyEC(identifier, curve, type, WTF::move(platformKey), extractable, usages)); } virtual ~CryptoKeyEC() = default; diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp index 565d98264c159b..05a597f53fdd8b 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp @@ -130,9 +130,9 @@ std::optional CryptoKeyEC::platformGeneratePair(CryptoAlgorithmId if (EVP_PKEY_set1_EC_KEY(publicPKey.get(), publicECKey.get()) <= 0) return std::nullopt; - auto publicKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Public, WTFMove(publicPKey), true, usages); - auto privateKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Private, WTFMove(privatePKey), extractable, usages); - return CryptoKeyPair { WTFMove(publicKey), WTFMove(privateKey) }; + auto publicKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Public, WTF::move(publicPKey), true, usages); + auto privateKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Private, WTF::move(privatePKey), extractable, usages); + return CryptoKeyPair { WTF::move(publicKey), WTF::move(privateKey) }; } RefPtr CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -157,7 +157,7 @@ RefPtr CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier ide if (EVP_PKEY_set1_EC_KEY(pkey.get(), key.get()) <= 0) return nullptr; - return create(identifier, curve, CryptoKeyType::Public, WTFMove(pkey), extractable, usages); + return create(identifier, curve, CryptoKeyType::Public, WTF::move(pkey), extractable, usages); } RefPtr CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector&& x, Vector&& y, bool extractable, CryptoKeyUsageBitmap usages) @@ -183,7 +183,7 @@ RefPtr CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifi if (EVP_PKEY_set1_EC_KEY(pkey.get(), key.get()) <= 0) return nullptr; - return create(identifier, curve, CryptoKeyType::Public, WTFMove(pkey), extractable, usages); + return create(identifier, curve, CryptoKeyType::Public, WTF::move(pkey), extractable, usages); } RefPtr CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector&& x, Vector&& y, Vector&& d, bool extractable, CryptoKeyUsageBitmap usages) @@ -212,7 +212,7 @@ RefPtr CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentif if (EVP_PKEY_set1_EC_KEY(pkey.get(), key.get()) <= 0) return nullptr; - return create(identifier, curve, CryptoKeyType::Private, WTFMove(pkey), extractable, usages); + return create(identifier, curve, CryptoKeyType::Private, WTF::move(pkey), extractable, usages); } static const ASN1_OBJECT* ecPublicKeyIdentifier() @@ -342,7 +342,7 @@ RefPtr CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier id if (EVP_PKEY_set1_EC_KEY(pkey.get(), key.get()) <= 0) return nullptr; - return adoptRef(new CryptoKeyEC(identifier, curve, CryptoKeyType::Public, WTFMove(pkey), extractable, usages)); + return adoptRef(new CryptoKeyEC(identifier, curve, CryptoKeyType::Public, WTF::move(pkey), extractable, usages)); } RefPtr CryptoKeyEC::platformImportPkcs8(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -373,7 +373,7 @@ RefPtr CryptoKeyEC::platformImportPkcs8(CryptoAlgorithmIdentifier i EC_KEY_set_asn1_flag(ecKey, OPENSSL_EC_NAMED_CURVE); - return adoptRef(new CryptoKeyEC(identifier, curve, CryptoKeyType::Private, WTFMove(pkey), extractable, usages)); + return adoptRef(new CryptoKeyEC(identifier, curve, CryptoKeyType::Private, WTF::move(pkey), extractable, usages)); } Vector CryptoKeyEC::platformExportRaw() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp index 2ffd83a00b3b5c..5bde29b77e33ca 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp @@ -64,7 +64,7 @@ CryptoKeyHMAC::CryptoKeyHMAC(const Vector& key, CryptoAlgorithmIdentifi CryptoKeyHMAC::CryptoKeyHMAC(Vector&& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap usage) : CryptoKey(CryptoAlgorithmIdentifier::HMAC, CryptoKeyType::Secret, extractable, usage) , m_hash(hash) - , m_key(WTFMove(key)) + , m_key(WTF::move(key)) { } @@ -102,7 +102,7 @@ RefPtr CryptoKeyHMAC::importRaw(size_t lengthBits, CryptoAlgorith if (lengthBits && lengthBits != length) return nullptr; - return adoptRef(new CryptoKeyHMAC(WTFMove(keyData), hash, extractable, usages)); + return adoptRef(new CryptoKeyHMAC(WTF::move(keyData), hash, extractable, usages)); } RefPtr CryptoKeyHMAC::importJwk(size_t lengthBits, CryptoAlgorithmIdentifier hash, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages, CheckAlgCallback&& callback) @@ -123,7 +123,7 @@ RefPtr CryptoKeyHMAC::importJwk(size_t lengthBits, CryptoAlgorith if (keyData.ext && !keyData.ext.value() && extractable) return nullptr; - return CryptoKeyHMAC::importRaw(lengthBits, hash, WTFMove(*octetSequence), extractable, usages); + return CryptoKeyHMAC::importRaw(lengthBits, hash, WTF::move(*octetSequence), extractable, usages); } JsonWebKey CryptoKeyHMAC::exportJwk() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp index 5534416fe22d59..1f5b17a3dc2011 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp @@ -78,17 +78,17 @@ RefPtr CryptoKeyOKP::create(CryptoAlgorithmIdentifier identifier, // Import format only consists of 32 bytes of private key // Internal format is private key + public key suffix if (platformKey.size() == bytesExpectedExternal) { - auto&& privateKey = ed25519PrivateFromSeed(WTFMove(platformKey)); + auto&& privateKey = ed25519PrivateFromSeed(WTF::move(platformKey)); if (privateKey.size() == 0) return nullptr; - return adoptRef(*new CryptoKeyOKP(identifier, curve, type, WTFMove(privateKey), extractable, usages)); + return adoptRef(*new CryptoKeyOKP(identifier, curve, type, WTF::move(privateKey), extractable, usages)); } return nullptr; } - return adoptRef(*new CryptoKeyOKP(identifier, curve, type, WTFMove(platformKey), extractable, usages)); + return adoptRef(*new CryptoKeyOKP(identifier, curve, type, WTF::move(platformKey), extractable, usages)); } CryptoKeyOKP::CryptoKeyOKP(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, KeyMaterial&& data, bool extractable, CryptoKeyUsageBitmap usages) @@ -108,7 +108,7 @@ ExceptionOr CryptoKeyOKP::generatePair(CryptoAlgorithmIdentifier if (!result) return Exception { OperationError }; - return WTFMove(*result); + return WTF::move(*result); } RefPtr CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier identifier, NamedCurve namedCurve, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -116,7 +116,7 @@ RefPtr CryptoKeyOKP::importRaw(CryptoAlgorithmIdentifier identifie if (!isPlatformSupportedCurve(namedCurve)) return nullptr; - return create(identifier, namedCurve, usages & CryptoKeyUsageSign ? CryptoKeyType::Private : CryptoKeyType::Public, WTFMove(keyData), extractable, usages); + return create(identifier, namedCurve, usages & CryptoKeyUsageSign ? CryptoKeyType::Private : CryptoKeyType::Public, WTF::move(keyData), extractable, usages); } RefPtr CryptoKeyOKP::importJwkInternal(CryptoAlgorithmIdentifier identifier, NamedCurve namedCurve, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages, bool onlyPublic) @@ -157,7 +157,7 @@ RefPtr CryptoKeyOKP::importJwkInternal(CryptoAlgorithmIdentifier i auto d = base64URLDecode(keyData.d); if (!d) return nullptr; - return create(identifier, namedCurve, CryptoKeyType::Private, WTFMove(*d), extractable, usages); + return create(identifier, namedCurve, CryptoKeyType::Private, WTF::move(*d), extractable, usages); } } @@ -167,16 +167,16 @@ RefPtr CryptoKeyOKP::importJwkInternal(CryptoAlgorithmIdentifier i auto x = base64URLDecode(keyData.x); if (!x) return nullptr; - return create(identifier, namedCurve, CryptoKeyType::Public, WTFMove(*x), extractable, usages); + return create(identifier, namedCurve, CryptoKeyType::Public, WTF::move(*x), extractable, usages); } RefPtr CryptoKeyOKP::importPublicJwk(CryptoAlgorithmIdentifier identifier, NamedCurve namedCurve, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) { - return importJwkInternal(identifier, namedCurve, WTFMove(keyData), extractable, usages, true); + return importJwkInternal(identifier, namedCurve, WTF::move(keyData), extractable, usages, true); } RefPtr CryptoKeyOKP::importJwk(CryptoAlgorithmIdentifier identifier, NamedCurve namedCurve, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) { - return importJwkInternal(identifier, namedCurve, WTFMove(keyData), extractable, usages, false); + return importJwkInternal(identifier, namedCurve, WTF::move(keyData), extractable, usages, false); } ExceptionOr> CryptoKeyOKP::exportRaw() const @@ -187,7 +187,7 @@ ExceptionOr> CryptoKeyOKP::exportRaw() const auto&& result = platformExportRaw(); if (result.isEmpty()) return Exception { OperationError }; - return WTFMove(result); + return WTF::move(result); } ExceptionOr CryptoKeyOKP::exportJwk() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp index 480a42ac96ad85..de29f6f753a5d3 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp @@ -56,11 +56,11 @@ std::optional CryptoKeyOKP::platformGeneratePair(CryptoAlgorithmI } bool isPublicKeyExtractable = true; - auto publicKey = CryptoKeyOKP::create(identifier, namedCurve, CryptoKeyType::Public, WTFMove(public_key), isPublicKeyExtractable, usages); + auto publicKey = CryptoKeyOKP::create(identifier, namedCurve, CryptoKeyType::Public, WTF::move(public_key), isPublicKeyExtractable, usages); ASSERT(publicKey); auto privateKey = CryptoKeyOKP::create(identifier, namedCurve, CryptoKeyType::Private, Vector(std::span { private_key.begin(), isEd25519 ? (unsigned int)ED25519_PRIVATE_KEY_LEN : (unsigned int)X25519_PRIVATE_KEY_LEN }), extractable, usages); ASSERT(privateKey); - return CryptoKeyPair { WTFMove(publicKey), WTFMove(privateKey) }; + return CryptoKeyPair { WTF::move(publicKey), WTF::move(privateKey) }; } // Per https://www.ietf.org/rfc/rfc5280.txt @@ -179,7 +179,7 @@ ExceptionOr> CryptoKeyOKP::exportSpki() const ASSERT(result.size() == totalSize); - return WTFMove(result); + return WTF::move(result); } // Per https://www.ietf.org/rfc/rfc5280.txt @@ -288,7 +288,7 @@ ExceptionOr> CryptoKeyOKP::exportPkcs8() const ASSERT(result.size() == totalSize); - return WTFMove(result); + return WTF::move(result); } String CryptoKeyOKP::generateJwkD() const diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp index 7e2fc56194f6d2..9f69d617e987ff 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp @@ -57,7 +57,7 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm return nullptr; if (keyData.d.isNull()) { // import public key - auto publicKeyComponents = CryptoKeyRSAComponents::createPublic(WTFMove(*modulus), WTFMove(*exponent)); + auto publicKeyComponents = CryptoKeyRSAComponents::createPublic(WTF::move(*modulus), WTF::move(*exponent)); // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *publicKeyComponents, extractable, usages); } @@ -67,7 +67,7 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm if (!privateExponent) return nullptr; if (keyData.p.isNull() && keyData.q.isNull() && keyData.dp.isNull() && keyData.dp.isNull() && keyData.qi.isNull()) { - auto privateKeyComponents = CryptoKeyRSAComponents::createPrivate(WTFMove(*modulus), WTFMove(*exponent), WTFMove(*privateExponent)); + auto privateKeyComponents = CryptoKeyRSAComponents::createPrivate(WTF::move(*modulus), WTF::move(*exponent), WTF::move(*privateExponent)); // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); } @@ -92,16 +92,16 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm return nullptr; CryptoKeyRSAComponents::PrimeInfo firstPrimeInfo; - firstPrimeInfo.primeFactor = WTFMove(*firstPrimeFactor); - firstPrimeInfo.factorCRTExponent = WTFMove(*firstFactorCRTExponent); + firstPrimeInfo.primeFactor = WTF::move(*firstPrimeFactor); + firstPrimeInfo.factorCRTExponent = WTF::move(*firstFactorCRTExponent); CryptoKeyRSAComponents::PrimeInfo secondPrimeInfo; - secondPrimeInfo.primeFactor = WTFMove(*secondPrimeFactor); - secondPrimeInfo.factorCRTExponent = WTFMove(*secondFactorCRTExponent); - secondPrimeInfo.factorCRTCoefficient = WTFMove(*secondFactorCRTCoefficient); + secondPrimeInfo.primeFactor = WTF::move(*secondPrimeFactor); + secondPrimeInfo.factorCRTExponent = WTF::move(*secondFactorCRTExponent); + secondPrimeInfo.factorCRTCoefficient = WTF::move(*secondFactorCRTCoefficient); if (!keyData.oth) { - auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(*modulus), WTFMove(*exponent), WTFMove(*privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), {}); + auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTF::move(*modulus), WTF::move(*exponent), WTF::move(*privateExponent), WTF::move(firstPrimeInfo), WTF::move(secondPrimeInfo), {}); // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); } @@ -119,14 +119,14 @@ RefPtr CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm return nullptr; CryptoKeyRSAComponents::PrimeInfo info; - info.primeFactor = WTFMove(*primeFactor); - info.factorCRTExponent = WTFMove(*factorCRTExponent); - info.factorCRTCoefficient = WTFMove(*factorCRTCoefficient); + info.primeFactor = WTF::move(*primeFactor); + info.factorCRTExponent = WTF::move(*factorCRTExponent); + info.factorCRTCoefficient = WTF::move(*factorCRTCoefficient); - otherPrimeInfos.append(WTFMove(info)); + otherPrimeInfos.append(WTF::move(info)); } - auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTFMove(*modulus), WTFMove(*exponent), WTFMove(*privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), WTFMove(otherPrimeInfos)); + auto privateKeyComponents = CryptoKeyRSAComponents::createPrivateWithAdditionalData(WTF::move(*modulus), WTF::move(*exponent), WTF::move(*privateExponent), WTF::move(firstPrimeInfo), WTF::move(secondPrimeInfo), WTF::move(otherPrimeInfos)); // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt. return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages); } @@ -168,9 +168,9 @@ JsonWebKey CryptoKeyRSA::exportJwk() const otherInfo.r = Bun::base64URLEncodeToString(info.primeFactor); otherInfo.d = Bun::base64URLEncodeToString(info.factorCRTExponent); otherInfo.t = Bun::base64URLEncodeToString(info.factorCRTCoefficient); - oth.append(WTFMove(otherInfo)); + oth.append(WTF::move(otherInfo)); } - result.oth = WTFMove(oth); + result.oth = WTF::move(oth); return result; } diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.h b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.h index 70f9cf648aa348..9c26536cd3d61f 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSA.h +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSA.h @@ -69,7 +69,7 @@ class CryptoKeyRSA final : public CryptoKey { public: static Ref create(CryptoAlgorithmIdentifier identifier, CryptoAlgorithmIdentifier hash, bool hasHash, CryptoKeyType type, PlatformRSAKeyContainer&& platformKey, bool extractable, CryptoKeyUsageBitmap usage) { - return adoptRef(*new CryptoKeyRSA(identifier, hash, hasHash, type, WTFMove(platformKey), extractable, usage)); + return adoptRef(*new CryptoKeyRSA(identifier, hash, hasHash, type, WTF::move(platformKey), extractable, usage)); } static RefPtr create(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, const CryptoKeyRSAComponents&, bool extractable, CryptoKeyUsageBitmap); virtual ~CryptoKeyRSA() = default; diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp index f9b6052cd732f1..ffd0cf5f768259 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp @@ -39,8 +39,8 @@ CryptoKeyRSAComponents::CryptoKeyRSAComponents(const Vector& modulus, c CryptoKeyRSAComponents::CryptoKeyRSAComponents(Vector&& modulus, Vector&& exponent) : m_type(Type::Public) - , m_modulus(WTFMove(modulus)) - , m_exponent(WTFMove(exponent)) + , m_modulus(WTF::move(modulus)) + , m_exponent(WTF::move(exponent)) { } @@ -55,9 +55,9 @@ CryptoKeyRSAComponents::CryptoKeyRSAComponents(const Vector& modulus, c CryptoKeyRSAComponents::CryptoKeyRSAComponents(Vector&& modulus, Vector&& exponent, Vector&& privateExponent) : m_type(Type::Private) - , m_modulus(WTFMove(modulus)) - , m_exponent(WTFMove(exponent)) - , m_privateExponent(WTFMove(privateExponent)) + , m_modulus(WTF::move(modulus)) + , m_exponent(WTF::move(exponent)) + , m_privateExponent(WTF::move(privateExponent)) , m_hasAdditionalPrivateKeyParameters(false) { } @@ -76,13 +76,13 @@ CryptoKeyRSAComponents::CryptoKeyRSAComponents(const Vector& modulus, c CryptoKeyRSAComponents::CryptoKeyRSAComponents(Vector&& modulus, Vector&& exponent, Vector&& privateExponent, PrimeInfo&& firstPrimeInfo, PrimeInfo&& secondPrimeInfo, Vector&& otherPrimeInfos) : m_type(Type::Private) - , m_modulus(WTFMove(modulus)) - , m_exponent(WTFMove(exponent)) - , m_privateExponent(WTFMove(privateExponent)) + , m_modulus(WTF::move(modulus)) + , m_exponent(WTF::move(exponent)) + , m_privateExponent(WTF::move(privateExponent)) , m_hasAdditionalPrivateKeyParameters(true) - , m_firstPrimeInfo(WTFMove(firstPrimeInfo)) - , m_secondPrimeInfo(WTFMove(secondPrimeInfo)) - , m_otherPrimeInfos(WTFMove(otherPrimeInfos)) + , m_firstPrimeInfo(WTF::move(firstPrimeInfo)) + , m_secondPrimeInfo(WTF::move(secondPrimeInfo)) + , m_otherPrimeInfos(WTF::move(otherPrimeInfos)) { } diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h b/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h index 26ed55c4e71add..c8805cf28e133f 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.h @@ -50,7 +50,7 @@ class CryptoKeyRSAComponents { } static std::unique_ptr createPublic(Vector&& modulus, Vector&& exponent) { - return std::unique_ptr(new CryptoKeyRSAComponents(WTFMove(modulus), WTFMove(exponent))); + return std::unique_ptr(new CryptoKeyRSAComponents(WTF::move(modulus), WTF::move(exponent))); } static std::unique_ptr createPrivate(const Vector& modulus, const Vector& exponent, const Vector& privateExponent) @@ -59,7 +59,7 @@ class CryptoKeyRSAComponents { } static std::unique_ptr createPrivate(Vector&& modulus, Vector&& exponent, Vector&& privateExponent) { - return std::unique_ptr(new CryptoKeyRSAComponents(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent))); + return std::unique_ptr(new CryptoKeyRSAComponents(WTF::move(modulus), WTF::move(exponent), WTF::move(privateExponent))); } static std::unique_ptr createPrivateWithAdditionalData(const Vector& modulus, const Vector& exponent, const Vector& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector& otherPrimeInfos) @@ -68,7 +68,7 @@ class CryptoKeyRSAComponents { } static std::unique_ptr createPrivateWithAdditionalData(Vector&& modulus, Vector&& exponent, Vector&& privateExponent, PrimeInfo&& firstPrimeInfo, PrimeInfo&& secondPrimeInfo, Vector&& otherPrimeInfos) { - return std::unique_ptr(new CryptoKeyRSAComponents(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), WTFMove(otherPrimeInfos))); + return std::unique_ptr(new CryptoKeyRSAComponents(WTF::move(modulus), WTF::move(exponent), WTF::move(privateExponent), WTF::move(firstPrimeInfo), WTF::move(secondPrimeInfo), WTF::move(otherPrimeInfos))); } virtual ~CryptoKeyRSAComponents(); diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp index b52f7dc959a331..7693921410002a 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp @@ -143,12 +143,12 @@ RefPtr CryptoKeyRSA::create(CryptoAlgorithmIdentifier identifier, if (EVP_PKEY_set1_RSA(pkey.get(), rsa.get()) != 1) return nullptr; - return adoptRef(new CryptoKeyRSA(identifier, hash, hasHash, keyType, WTFMove(pkey), extractable, usages)); + return adoptRef(new CryptoKeyRSA(identifier, hash, hasHash, keyType, WTF::move(pkey), extractable, usages)); } CryptoKeyRSA::CryptoKeyRSA(CryptoAlgorithmIdentifier identifier, CryptoAlgorithmIdentifier hash, bool hasHash, CryptoKeyType type, PlatformRSAKeyContainer&& platformKey, bool extractable, CryptoKeyUsageBitmap usages) : CryptoKey(identifier, type, extractable, usages) - , m_platformKey(WTFMove(platformKey)) + , m_platformKey(WTF::move(platformKey)) , m_restrictedToSpecificHash(hasHash) , m_hash(hash) { @@ -223,9 +223,9 @@ void CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier algorithm, CryptoAlgor return; } - auto publicKey = CryptoKeyRSA::create(algorithm, hash, hasHash, CryptoKeyType::Public, WTFMove(publicPKey), true, usages); - auto privateKey = CryptoKeyRSA::create(algorithm, hash, hasHash, CryptoKeyType::Private, WTFMove(privatePKey), extractable, usages); - callback(CryptoKeyPair { WTFMove(publicKey), WTFMove(privateKey) }); + auto publicKey = CryptoKeyRSA::create(algorithm, hash, hasHash, CryptoKeyType::Public, WTF::move(publicPKey), true, usages); + auto privateKey = CryptoKeyRSA::create(algorithm, hash, hasHash, CryptoKeyType::Private, WTF::move(privatePKey), extractable, usages); + callback(CryptoKeyPair { WTF::move(publicKey), WTF::move(privateKey) }); } RefPtr CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifier, std::optional hash, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -238,7 +238,7 @@ RefPtr CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier identifi if (!pkey || EVP_PKEY_id(pkey.get()) != EVP_PKEY_RSA) return nullptr; - return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Public, WTFMove(pkey), extractable, usages)); + return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Public, WTF::move(pkey), extractable, usages)); } RefPtr CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, std::optional hash, Vector&& keyData, bool extractable, CryptoKeyUsageBitmap usages) @@ -255,7 +255,7 @@ RefPtr CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identif if (!pkey || EVP_PKEY_id(pkey.get()) != EVP_PKEY_RSA) return nullptr; - return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Private, WTFMove(pkey), extractable, usages)); + return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Private, WTF::move(pkey), extractable, usages)); } ExceptionOr> CryptoKeyRSA::exportSpki() const @@ -395,7 +395,7 @@ std::unique_ptr CryptoKeyRSA::exportData() const return CryptoKeyRSAComponents::createPrivateWithAdditionalData( convertToBytes(n), convertToBytes(e), convertToBytes(d), - WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), Vector {}); + WTF::move(firstPrimeInfo), WTF::move(secondPrimeInfo), Vector {}); } default: ASSERT_NOT_REACHED(); diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp b/src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp index c75684189d5b7c..405b69942f4463 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp @@ -34,7 +34,7 @@ namespace WebCore { CryptoKeyRaw::CryptoKeyRaw(CryptoAlgorithmIdentifier identifier, Vector&& keyData, CryptoKeyUsageBitmap usages) : CryptoKey(identifier, CryptoKeyType::Secret, false, usages) - , m_key(WTFMove(keyData)) + , m_key(WTF::move(keyData)) { } diff --git a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.h b/src/bun.js/bindings/webcrypto/CryptoKeyRaw.h index df5b6b831b109f..bd9d90b4e5b812 100644 --- a/src/bun.js/bindings/webcrypto/CryptoKeyRaw.h +++ b/src/bun.js/bindings/webcrypto/CryptoKeyRaw.h @@ -35,7 +35,7 @@ class CryptoKeyRaw final : public CryptoKey { public: static Ref create(CryptoAlgorithmIdentifier identifier, Vector&& keyData, CryptoKeyUsageBitmap usages) { - return adoptRef(*new CryptoKeyRaw(identifier, WTFMove(keyData), usages)); + return adoptRef(*new CryptoKeyRaw(identifier, WTF::move(keyData), usages)); } const Vector& key() const { return m_key; } diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp index 200081ab58a7be..92acf8acf34108 100644 --- a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp +++ b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp @@ -87,11 +87,11 @@ template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, template<> std::optional parseEnumeration(JSGlobalObject& lexicalGlobalObject, JSValue value) { auto stringValue = value.toWTFString(&lexicalGlobalObject); - static constexpr std::pair mappings[] = { + static constexpr std::array, 3> mappings { { { "private"_s, CryptoKey::Type::Private }, { "public"_s, CryptoKey::Type::Public }, { "secret"_s, CryptoKey::Type::Secret }, - }; + } }; static constexpr SortedArrayMap enumerationMapping { mappings }; if (auto* enumerationValue = enumerationMapping.tryGet(stringValue); enumerationValue) [[likely]] return *enumerationValue; @@ -184,7 +184,7 @@ void JSCryptoKeyPrototype::finishCreation(VM& vm) const ClassInfo JSCryptoKey::s_info = { "CryptoKey"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoKey) }; JSCryptoKey::JSCryptoKey(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -338,7 +338,7 @@ void JSCryptoKeyOwner::finalize(JSC::Handle handle, void* context) JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref&& impl) { - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CryptoKey& impl) diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.h b/src/bun.js/bindings/webcrypto/JSCryptoKey.h index 2dcf45538ffeb0..5a04c06827afb9 100644 --- a/src/bun.js/bindings/webcrypto/JSCryptoKey.h +++ b/src/bun.js/bindings/webcrypto/JSCryptoKey.h @@ -34,7 +34,7 @@ class JSCryptoKey : public JSDOMWrapper { using Base = JSDOMWrapper; static JSCryptoKey* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSCryptoKey* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCryptoKey(structure, *globalObject, WTFMove(impl)); + JSCryptoKey* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSCryptoKey(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp b/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp index 53fc4ff7339ce8..f27a254b18a7a4 100644 --- a/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp +++ b/src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp @@ -64,7 +64,7 @@ template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, template<> std::optional parseEnumeration(JSGlobalObject& lexicalGlobalObject, JSValue value) { auto stringValue = value.toWTFString(&lexicalGlobalObject); - static constexpr std::pair mappings[] = { + static constexpr std::array, 8> mappings { { { "decrypt"_s, CryptoKeyUsage::Decrypt }, { "deriveBits"_s, CryptoKeyUsage::DeriveBits }, { "deriveKey"_s, CryptoKeyUsage::DeriveKey }, @@ -73,7 +73,7 @@ template<> std::optional parseEnumeration(JSGlob { "unwrapKey"_s, CryptoKeyUsage::UnwrapKey }, { "verify"_s, CryptoKeyUsage::Verify }, { "wrapKey"_s, CryptoKeyUsage::WrapKey }, - }; + } }; static constexpr SortedArrayMap enumerationMapping { mappings }; if (auto* enumerationValue = enumerationMapping.tryGet(stringValue); enumerationValue) [[likely]] return *enumerationValue; diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp index 549de84fcd5fea..bceabcda93f78a 100644 --- a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp +++ b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp @@ -96,12 +96,12 @@ template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, template<> std::optional parseEnumeration(JSGlobalObject& lexicalGlobalObject, JSValue value) { auto stringValue = value.toWTFString(&lexicalGlobalObject); - static constexpr std::pair mappings[] = { + static constexpr std::array, 4> mappings { { { "jwk"_s, SubtleCrypto::KeyFormat::Jwk }, { "pkcs8"_s, SubtleCrypto::KeyFormat::Pkcs8 }, { "raw"_s, SubtleCrypto::KeyFormat::Raw }, { "spki"_s, SubtleCrypto::KeyFormat::Spki }, - }; + } }; static constexpr SortedArrayMap enumerationMapping { mappings }; if (auto* enumerationValue = enumerationMapping.tryGet(stringValue); enumerationValue) [[likely]] return *enumerationValue; @@ -213,7 +213,7 @@ void JSSubtleCryptoPrototype::finishCreation(VM& vm) const ClassInfo JSSubtleCrypto::s_info = { "SubtleCrypto"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubtleCrypto) }; JSSubtleCrypto::JSSubtleCrypto(Structure* structure, JSDOMGlobalObject& globalObject, Ref&& impl) - : JSDOMWrapper(structure, globalObject, WTFMove(impl)) + : JSDOMWrapper(structure, globalObject, WTF::move(impl)) { } @@ -276,7 +276,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_encryptBody(JS EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto data = convert>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.encrypt(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *key, WTFMove(data), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.encrypt(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *key, WTF::move(data), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_encrypt, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -302,7 +302,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_decryptBody(JS EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto data = convert>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.decrypt(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *key, WTFMove(data), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.decrypt(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *key, WTF::move(data), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_decrypt, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -328,7 +328,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_signBody(JSC:: EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto data = convert>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.sign(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *key, WTFMove(data), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.sign(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *key, WTF::move(data), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_sign, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -357,7 +357,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_verifyBody(JSC EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); auto data = convert>(*lexicalGlobalObject, argument3.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.verify(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *key, WTFMove(signature), WTFMove(data), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.verify(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *key, WTF::move(signature), WTF::move(data), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_verify, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -383,7 +383,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_digestBody(JSC throwScope.clearException(); return Bun::ERR::INVALID_ARG_TYPE(throwScope, lexicalGlobalObject, "data"_s, "ArrayBuffer, Buffer, TypedArray, or DataView"_s, argument1.value()); } - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.digest(*jsCast(lexicalGlobalObject), WTFMove(algorithm), WTFMove(data), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.digest(*jsCast(lexicalGlobalObject), WTF::move(algorithm), WTF::move(data), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_digest, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -409,7 +409,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_generateKeyBod EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto keyUsages = convert>>(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.generateKey(*jsCast(lexicalGlobalObject), WTFMove(algorithm), WTFMove(extractable), WTFMove(keyUsages), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.generateKey(*jsCast(lexicalGlobalObject), WTF::move(algorithm), WTF::move(extractable), WTF::move(keyUsages), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_generateKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -441,7 +441,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_deriveKeyBody( EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); auto keyUsages = convert>>(*lexicalGlobalObject, argument4.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.deriveKey(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *baseKey, WTFMove(derivedKeyType), WTFMove(extractable), WTFMove(keyUsages), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.deriveKey(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *baseKey, WTF::move(derivedKeyType), WTF::move(extractable), WTF::move(keyUsages), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_deriveKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -467,7 +467,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_deriveBitsBody EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); auto length = convert(*lexicalGlobalObject, argument2.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.deriveBits(*jsCast(lexicalGlobalObject), WTFMove(algorithm), *baseKey, WTFMove(length), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.deriveBits(*jsCast(lexicalGlobalObject), WTF::move(algorithm), *baseKey, WTF::move(length), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_deriveBits, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -499,7 +499,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_importKeyBody( EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); auto keyUsages = convert>>(*lexicalGlobalObject, argument4.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.importKey(*jsCast(lexicalGlobalObject), WTFMove(format), WTFMove(keyData), WTFMove(algorithm), WTFMove(extractable), WTFMove(keyUsages), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.importKey(*jsCast(lexicalGlobalObject), WTF::move(format), WTF::move(keyData), WTF::move(algorithm), WTF::move(extractable), WTF::move(keyUsages), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_importKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -523,7 +523,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_exportKeyBody( auto key = convert>(*lexicalGlobalObject, argument1.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 1, "key"_s, "SubtleCrypto"_s, "exportKey"_s, "CryptoKey"_s); }); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { - return impl.exportKey(WTFMove(format), *key, WTFMove(promise)); + return impl.exportKey(WTF::move(format), *key, WTF::move(promise)); }))); } @@ -553,7 +553,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_wrapKeyBody(JS EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); auto wrapAlgorithm = convert>(*lexicalGlobalObject, argument3.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.wrapKey(*jsCast(lexicalGlobalObject), WTFMove(format), *key, *wrappingKey, WTFMove(wrapAlgorithm), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.wrapKey(*jsCast(lexicalGlobalObject), WTF::move(format), *key, *wrappingKey, WTF::move(wrapAlgorithm), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_wrapKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -591,7 +591,7 @@ static inline JSC::EncodedJSValue jsSubtleCryptoPrototypeFunction_unwrapKeyBody( EnsureStillAliveScope argument6 = callFrame->uncheckedArgument(6); auto keyUsages = convert>>(*lexicalGlobalObject, argument6.value()); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.unwrapKey(*jsCast(lexicalGlobalObject), WTFMove(format), WTFMove(wrappedKey), *unwrappingKey, WTFMove(unwrapAlgorithm), WTFMove(unwrappedKeyAlgorithm), WTFMove(extractable), WTFMove(keyUsages), WTFMove(promise)); }))); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.unwrapKey(*jsCast(lexicalGlobalObject), WTF::move(format), WTF::move(wrappedKey), *unwrappingKey, WTF::move(unwrapAlgorithm), WTF::move(unwrappedKeyAlgorithm), WTF::move(extractable), WTF::move(keyUsages), WTF::move(promise)); }))); } JSC_DEFINE_HOST_FUNCTION(jsSubtleCryptoPrototypeFunction_unwrapKey, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) @@ -668,7 +668,7 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); #endif } - return createWrapper(globalObject, WTFMove(impl)); + return createWrapper(globalObject, WTF::move(impl)); } JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, SubtleCrypto& impl) diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.h b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.h index b3a26c8727a4c9..f03e52944eb544 100644 --- a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.h +++ b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.h @@ -34,7 +34,7 @@ class JSSubtleCrypto : public JSDOMWrapper { using Base = JSDOMWrapper; static JSSubtleCrypto* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref&& impl) { - JSSubtleCrypto* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSSubtleCrypto(structure, *globalObject, WTFMove(impl)); + JSSubtleCrypto* ptr = new (NotNull, JSC::allocateCell(globalObject->vm())) JSSubtleCrypto(structure, *globalObject, WTF::move(impl)); ptr->finishCreation(globalObject->vm()); return ptr; } diff --git a/src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp b/src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp index 325ce6ad0273e6..f465658ecdeda4 100644 --- a/src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp +++ b/src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp @@ -15,7 +15,7 @@ extern "C" void ConcurrentCppTask__createAndRun(EventLoopTaskNoContext* task); void PhonyWorkQueue::dispatch(JSC::JSGlobalObject* globalObject, WTF::Function&& function) { - ConcurrentCppTask__createAndRun(new EventLoopTaskNoContext(globalObject, WTFMove(function))); + ConcurrentCppTask__createAndRun(new EventLoopTaskNoContext(globalObject, WTF::move(function))); } } // namespace Bun diff --git a/src/bun.js/bindings/webcrypto/SubtleCrypto.cpp b/src/bun.js/bindings/webcrypto/SubtleCrypto.cpp index 4a233ea0646823..4ef2591c31641c 100644 --- a/src/bun.js/bindings/webcrypto/SubtleCrypto.cpp +++ b/src/bun.js/bindings/webcrypto/SubtleCrypto.cpp @@ -611,14 +611,14 @@ void SubtleCrypto::encrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg { addAuthenticatedEncryptionWarningIfNecessary(key.algorithmIdentifier()); - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::Encrypt); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::Encrypt); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; } auto params = paramsOrException.releaseReturnValue(); - auto data = copyToVector(WTFMove(dataBufferSource)); + auto data = copyToVector(WTF::move(dataBufferSource)); if (params->identifier != key.algorithmIdentifier()) { promise->reject(InvalidAccessError, "CryptoKey doesn't match AlgorithmIdentifier"_s); @@ -633,7 +633,7 @@ void SubtleCrypto::encrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg auto algorithm = CryptoAlgorithmRegistry::singleton().create(key.algorithmIdentifier()); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](const Vector& cipherText) mutable { if (auto promise = getPromise(index, weakThis)) @@ -644,7 +644,7 @@ void SubtleCrypto::encrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->encrypt(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->encrypt(*params, key, WTF::move(data), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::decrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& dataBufferSource, Ref&& promise) @@ -654,14 +654,14 @@ void SubtleCrypto::decrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg addAuthenticatedEncryptionWarningIfNecessary(key.algorithmIdentifier()); - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::Decrypt); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::Decrypt); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; } auto params = paramsOrException.releaseReturnValue(); - auto data = copyToVector(WTFMove(dataBufferSource)); + auto data = copyToVector(WTF::move(dataBufferSource)); if (params->identifier != key.algorithmIdentifier()) { promise->reject(InvalidAccessError, "CryptoKey doesn't match AlgorithmIdentifier"_s); @@ -676,7 +676,7 @@ void SubtleCrypto::decrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg auto algorithm = CryptoAlgorithmRegistry::singleton().create(key.algorithmIdentifier()); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](const Vector& plainText) mutable { if (auto promise = getPromise(index, weakThis)) @@ -687,19 +687,19 @@ void SubtleCrypto::decrypt(JSC::JSGlobalObject& state, AlgorithmIdentifier&& alg rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->decrypt(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->decrypt(*params, key, WTF::move(data), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::sign(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& dataBufferSource, Ref&& promise) { - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::Sign); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::Sign); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; } auto params = paramsOrException.releaseReturnValue(); - auto data = copyToVector(WTFMove(dataBufferSource)); + auto data = copyToVector(WTF::move(dataBufferSource)); if (params->identifier != key.algorithmIdentifier()) { promise->reject(InvalidAccessError, "CryptoKey doesn't match AlgorithmIdentifier"_s); @@ -714,7 +714,7 @@ void SubtleCrypto::sign(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algori auto algorithm = CryptoAlgorithmRegistry::singleton().create(key.algorithmIdentifier()); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](const Vector& signature) mutable { if (auto promise = getPromise(index, weakThis)) @@ -725,20 +725,20 @@ void SubtleCrypto::sign(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algori rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->sign(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->sign(*params, key, WTF::move(data), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::verify(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& signatureBufferSource, BufferSource&& dataBufferSource, Ref&& promise) { - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::Verify); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::Verify); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; } auto params = paramsOrException.releaseReturnValue(); - auto signature = copyToVector(WTFMove(signatureBufferSource)); - auto data = copyToVector(WTFMove(dataBufferSource)); + auto signature = copyToVector(WTF::move(signatureBufferSource)); + auto data = copyToVector(WTF::move(dataBufferSource)); if (params->identifier != key.algorithmIdentifier()) { promise->reject(InvalidAccessError, "CryptoKey doesn't match AlgorithmIdentifier"_s); @@ -753,7 +753,7 @@ void SubtleCrypto::verify(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algo auto algorithm = CryptoAlgorithmRegistry::singleton().create(key.algorithmIdentifier()); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](bool result) mutable { if (auto promise = getPromise(index, weakThis)) @@ -764,26 +764,26 @@ void SubtleCrypto::verify(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algo rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->verify(*params, key, WTFMove(signature), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->verify(*params, key, WTF::move(signature), WTF::move(data), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::digest(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, BufferSource&& dataBufferSource, Ref&& promise) { auto& vm = state.vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::Digest); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::Digest); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException().code(), "Unrecognized algorithm name"_s); return; } auto params = paramsOrException.releaseReturnValue(); - auto data = copyToVector(WTFMove(dataBufferSource)); + auto data = copyToVector(WTF::move(dataBufferSource)); auto algorithm = CryptoAlgorithmRegistry::singleton().create(params->identifier); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](const Vector& digest) mutable { if (auto promise = getPromise(index, weakThis)) @@ -794,14 +794,14 @@ void SubtleCrypto::digest(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algo rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->digest(WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->digest(WTF::move(data), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::generateKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, bool extractable, Vector&& keyUsages, Ref&& promise) { auto& vm = state.vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::GenerateKey); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::GenerateKey); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; @@ -813,7 +813,7 @@ void SubtleCrypto::generateKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& auto algorithm = CryptoAlgorithmRegistry::singleton().create(params->identifier); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](KeyOrKeyPair&& keyOrKeyPair) mutable { if (auto promise = getPromise(index, weakThis)) { @@ -844,12 +844,12 @@ void SubtleCrypto::generateKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& // The 26 January 2017 version of the specification suggests we should perform the following task asynchronously // regardless what kind of keys it produces: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey // That's simply not efficient for AES, HMAC and EC keys. Therefore, we perform it as an async task only for RSA keys. - RELEASE_AND_RETURN(scope, algorithm->generateKey(*params, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext())); + RELEASE_AND_RETURN(scope, algorithm->generateKey(*params, extractable, keyUsagesBitmap, WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext())); } void SubtleCrypto::deriveKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& baseKey, AlgorithmIdentifier&& derivedKeyType, bool extractable, Vector&& keyUsages, Ref&& promise) { - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::DeriveBits); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::DeriveBits); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; @@ -895,9 +895,9 @@ void SubtleCrypto::deriveKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& a auto algorithm = CryptoAlgorithmRegistry::singleton().create(params->identifier); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; - auto callback = [index, weakThis, importAlgorithm = WTFMove(importAlgorithm), importParams = crossThreadCopyImportParams(*importParams), extractable, keyUsagesBitmap](const Vector& derivedKey) mutable { + auto callback = [index, weakThis, importAlgorithm = WTF::move(importAlgorithm), importParams = crossThreadCopyImportParams(*importParams), extractable, keyUsagesBitmap](const Vector& derivedKey) mutable { // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169395 KeyData data = derivedKey; auto callback = [index, weakThis](CryptoKey& key) mutable { @@ -914,19 +914,19 @@ void SubtleCrypto::deriveKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&& a rejectWithException(promise.releaseNonNull(), ec, msg); }; - importAlgorithm->importKey(SubtleCrypto::KeyFormat::Raw, WTFMove(data), *importParams, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback)); + importAlgorithm->importKey(SubtleCrypto::KeyFormat::Raw, WTF::move(data), *importParams, extractable, keyUsagesBitmap, WTF::move(callback), WTF::move(exceptionCallback)); }; auto exceptionCallback = [index, weakThis](ExceptionCode ec, const String& msg) mutable { if (auto promise = getPromise(index, weakThis)) rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->deriveBits(*params, baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->deriveBits(*params, baseKey, length, WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::deriveBits(JSC::JSGlobalObject& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& baseKey, unsigned length, Ref&& promise) { - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::DeriveBits); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::DeriveBits); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; @@ -946,7 +946,7 @@ void SubtleCrypto::deriveBits(JSC::JSGlobalObject& state, AlgorithmIdentifier&& auto algorithm = CryptoAlgorithmRegistry::singleton().create(params->identifier); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](const Vector& derivedKey) mutable { if (auto promise = getPromise(index, weakThis)) @@ -957,21 +957,21 @@ void SubtleCrypto::deriveBits(JSC::JSGlobalObject& state, AlgorithmIdentifier&& rejectWithException(promise.releaseNonNull(), ec, msg); }; - algorithm->deriveBits(*params, baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + algorithm->deriveBits(*params, baseKey, length, WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } void SubtleCrypto::importKey(JSC::JSGlobalObject& state, KeyFormat format, KeyDataVariant&& keyDataVariant, AlgorithmIdentifier&& algorithmIdentifier, bool extractable, Vector&& keyUsages, Ref&& promise) { auto& vm = state.vm(); auto scope = DECLARE_THROW_SCOPE(vm); - auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTFMove(algorithmIdentifier), Operations::ImportKey); + auto paramsOrException = normalizeCryptoAlgorithmParameters(state, WTF::move(algorithmIdentifier), Operations::ImportKey); if (paramsOrException.hasException()) { promise->reject(paramsOrException.releaseException()); return; } auto params = paramsOrException.releaseReturnValue(); - auto keyDataOrNull = toKeyData(format, WTFMove(keyDataVariant), promise); + auto keyDataOrNull = toKeyData(format, WTF::move(keyDataVariant), promise); if (!keyDataOrNull) { // When toKeyData, it means the promise has been rejected, and we should return. return; @@ -983,7 +983,7 @@ void SubtleCrypto::importKey(JSC::JSGlobalObject& state, KeyFormat format, KeyDa auto algorithm = CryptoAlgorithmRegistry::singleton().create(params->identifier); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis](CryptoKey& key) mutable { if (auto promise = getPromise(index, weakThis)) { @@ -1002,7 +1002,7 @@ void SubtleCrypto::importKey(JSC::JSGlobalObject& state, KeyFormat format, KeyDa // The 11 December 2014 version of the specification suggests we should perform the following task asynchronously: // https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey // It is not beneficial for less time consuming operations. Therefore, we perform it synchronously. - RELEASE_AND_RETURN(scope, algorithm->importKey(format, WTFMove(keyData), *params, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback))); + RELEASE_AND_RETURN(scope, algorithm->importKey(format, WTF::move(keyData), *params, extractable, keyUsagesBitmap, WTF::move(callback), WTF::move(exceptionCallback))); } void SubtleCrypto::exportKey(KeyFormat format, CryptoKey& key, Ref&& promise) @@ -1020,7 +1020,7 @@ void SubtleCrypto::exportKey(KeyFormat format, CryptoKey& key, Refresolve>(WTFMove(std::get(key))); + promise->resolve>(WTF::move(std::get(key))); return; } ASSERT_NOT_REACHED(); @@ -1047,7 +1047,7 @@ void SubtleCrypto::exportKey(KeyFormat format, CryptoKey& key, RefexportKey(format, key, WTFMove(callback), WTFMove(exceptionCallback)); + algorithm->exportKey(format, key, WTF::move(callback), WTF::move(exceptionCallback)); } void SubtleCrypto::wrapKey(JSC::JSGlobalObject& state, KeyFormat format, CryptoKey& key, CryptoKey& wrappingKey, AlgorithmIdentifier&& wrapAlgorithmIdentifier, Ref&& promise) @@ -1094,9 +1094,9 @@ void SubtleCrypto::wrapKey(JSC::JSGlobalObject& state, KeyFormat format, CryptoK auto context = scriptExecutionContext(); auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; - auto callback = [index, weakThis, wrapAlgorithm, wrappingKey = Ref { wrappingKey }, wrapParams = WTFMove(wrapParams), isEncryption, context, workQueue = m_workQueue](SubtleCrypto::KeyFormat format, KeyData&& key) mutable { + auto callback = [index, weakThis, wrapAlgorithm, wrappingKey = Ref { wrappingKey }, wrapParams = WTF::move(wrapParams), isEncryption, context, workQueue = m_workQueue](SubtleCrypto::KeyFormat format, KeyData&& key) mutable { if (weakThis) { if (auto promise = weakThis->m_pendingPromises.get(index)) { Vector bytes; @@ -1108,7 +1108,7 @@ void SubtleCrypto::wrapKey(JSC::JSGlobalObject& state, KeyFormat format, CryptoK break; case SubtleCrypto::KeyFormat::Jwk: { // FIXME: Converting to JS just to JSON-Stringify seems inefficient. We should find a way to go directly from the struct to JSON. - auto jwk = toJS>(*(promise->globalObject()), *(promise->globalObject()), WTFMove(std::get(key))); + auto jwk = toJS>(*(promise->globalObject()), *(promise->globalObject()), WTF::move(std::get(key))); String jwkString = JSONStringify(promise->globalObject(), jwk, 0); CString jwkUTF8String = jwkString.utf8(StrictConversion); bytes.append(jwkUTF8String.span()); @@ -1128,11 +1128,11 @@ void SubtleCrypto::wrapKey(JSC::JSGlobalObject& state, KeyFormat format, CryptoK // The 11 December 2014 version of the specification suggests we should perform the following task asynchronously: // https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-wrapKey // It is not beneficial for less time consuming operations. Therefore, we perform it synchronously. - wrapAlgorithm->wrapKey(wrappingKey.get(), WTFMove(bytes), WTFMove(callback), WTFMove(exceptionCallback)); + wrapAlgorithm->wrapKey(wrappingKey.get(), WTF::move(bytes), WTF::move(callback), WTF::move(exceptionCallback)); return; } // The following operation should be performed asynchronously. - wrapAlgorithm->encrypt(*wrapParams, WTFMove(wrappingKey), WTFMove(bytes), WTFMove(callback), WTFMove(exceptionCallback), *context, workQueue); + wrapAlgorithm->encrypt(*wrapParams, WTF::move(wrappingKey), WTF::move(bytes), WTF::move(callback), WTF::move(exceptionCallback), *context, workQueue); } } }; @@ -1142,12 +1142,12 @@ void SubtleCrypto::wrapKey(JSC::JSGlobalObject& state, KeyFormat format, CryptoK }; // The following operation should be performed synchronously. - exportAlgorithm->exportKey(format, key, WTFMove(callback), WTFMove(exceptionCallback)); + exportAlgorithm->exportKey(format, key, WTF::move(callback), WTF::move(exceptionCallback)); } void SubtleCrypto::unwrapKey(JSC::JSGlobalObject& state, KeyFormat format, BufferSource&& wrappedKeyBufferSource, CryptoKey& unwrappingKey, AlgorithmIdentifier&& unwrapAlgorithmIdentifier, AlgorithmIdentifier&& unwrappedKeyAlgorithmIdentifier, bool extractable, Vector&& keyUsages, Ref&& promise) { - auto wrappedKey = copyToVector(WTFMove(wrappedKeyBufferSource)); + auto wrappedKey = copyToVector(WTF::move(wrappedKeyBufferSource)); bool isDecryption = false; @@ -1195,7 +1195,7 @@ void SubtleCrypto::unwrapKey(JSC::JSGlobalObject& state, KeyFormat format, Buffe } auto index = promise.ptr(); - m_pendingPromises.add(index, WTFMove(promise)); + m_pendingPromises.add(index, WTF::move(promise)); WeakPtr weakThis { *this }; auto callback = [index, weakThis, format, importAlgorithm, unwrappedKeyAlgorithm = crossThreadCopyImportParams(*unwrappedKeyAlgorithm), extractable, keyUsagesBitmap](const Vector& bytes) mutable { if (weakThis) { @@ -1243,7 +1243,7 @@ void SubtleCrypto::unwrapKey(JSC::JSGlobalObject& state, KeyFormat format, Buffe }; // The following operation should be performed synchronously. - importAlgorithm->importKey(format, WTFMove(keyData), *unwrappedKeyAlgorithm, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback)); + importAlgorithm->importKey(format, WTF::move(keyData), *unwrappedKeyAlgorithm, extractable, keyUsagesBitmap, WTF::move(callback), WTF::move(exceptionCallback)); } } }; @@ -1256,11 +1256,11 @@ void SubtleCrypto::unwrapKey(JSC::JSGlobalObject& state, KeyFormat format, Buffe // The 11 December 2014 version of the specification suggests we should perform the following task asynchronously: // https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-unwrapKey // It is not beneficial for less time consuming operations. Therefore, we perform it synchronously. - unwrapAlgorithm->unwrapKey(unwrappingKey, WTFMove(wrappedKey), WTFMove(callback), WTFMove(exceptionCallback)); + unwrapAlgorithm->unwrapKey(unwrappingKey, WTF::move(wrappedKey), WTF::move(callback), WTF::move(exceptionCallback)); return; } - unwrapAlgorithm->decrypt(*unwrapParams, unwrappingKey, WTFMove(wrappedKey), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue); + unwrapAlgorithm->decrypt(*unwrapParams, unwrappingKey, WTF::move(wrappedKey), WTF::move(callback), WTF::move(exceptionCallback), *scriptExecutionContext(), m_workQueue); } } diff --git a/src/bun.js/ipc.zig b/src/bun.js/ipc.zig index 5ac99756195b10..2cfe41a4da54a9 100644 --- a/src/bun.js/ipc.zig +++ b/src/bun.js/ipc.zig @@ -1,5 +1,28 @@ pub const log = Output.scoped(.IPC, .visible); +/// Union type that switches between simple ByteList (for advanced mode) +/// and JSONLineBuffer (for JSON mode with optimized newline tracking). +const IncomingBuffer = union(enum) { + /// For advanced mode - uses length-prefix, no scanning needed + advanced: bun.ByteList, + /// For JSON mode - tracks newline positions to avoid O(n²) scanning + json: JSONLineBuffer, + + pub fn init(mode: Mode) IncomingBuffer { + return switch (mode) { + .advanced => .{ .advanced = .{} }, + .json => .{ .json = .{} }, + }; + } + + pub fn deinit(self: *@This()) void { + switch (self.*) { + .advanced => |*b| b.deinit(bun.default_allocator), + .json => |*b| b.deinit(), + } + } +}; + const IsInternal = enum { internal, external }; const SerializeAndSendResult = enum { success, @@ -162,74 +185,80 @@ const json = struct { // 2 is internal // ["[{\d\.] is regular - pub fn decodeIPCMessage(data: []const u8, globalThis: *jsc.JSGlobalObject) IPCDecodeError!DecodeIPCMessageResult { + pub fn decodeIPCMessage(data: []const u8, globalThis: *jsc.JSGlobalObject, known_newline: ?u32) IPCDecodeError!DecodeIPCMessageResult { // { "foo": "bar"} // tag is 1 or 2 - if (bun.strings.indexOfChar(data, '\n')) |idx| { - var json_data = data[0..idx]; - // bounds-check for the following json_data[0] - // TODO: should we return NotEnoughBytes? - if (json_data.len == 0) return error.InvalidFormat; - - var kind: enum { regular, internal } = .regular; - if (json_data[0] == 2) { - // internal message - json_data = json_data[1..]; - kind = .internal; - } + const idx: u32 = known_newline orelse idx: { + const found = bun.strings.indexOfChar(data, '\n') orelse + return IPCDecodeError.NotEnoughBytes; + // Individual IPC messages should not exceed 4GB, and idx+1 must not overflow + if (found >= std.math.maxInt(u32)) return IPCDecodeError.InvalidFormat; + break :idx @intCast(found); + }; - const is_ascii = bun.strings.isAllASCII(json_data); - var was_ascii_string_freed = false; + var json_data = data[0..idx]; + // An empty payload (newline with no preceding data) is invalid JSON. + if (json_data.len == 0) return error.InvalidFormat; - // Use ExternalString to avoid copying data if possible. - // This is only possible for ascii data, as that fits into latin1 - // otherwise we have to convert it utf-8 into utf16-le. - var str = if (is_ascii) ascii: { + var kind: enum { regular, internal } = .regular; + if (json_data[0] == 2) { + // internal message + json_data = json_data[1..]; + kind = .internal; + } - // .dead if `json_data` exceeds max length - const s = bun.String.createExternal(*bool, json_data, true, &was_ascii_string_freed, jsonIPCDataStringFreeCB); - if (s.tag == .Dead) { - @branchHint(.unlikely); - return IPCDecodeError.OutOfMemory; - } - break :ascii s; - } else bun.String.borrowUTF8(json_data); + const is_ascii = bun.strings.isAllASCII(json_data); + var was_ascii_string_freed = false; - defer { - str.deref(); - if (is_ascii and !was_ascii_string_freed) { - @panic("Expected ascii string to be freed by ExternalString, but it wasn't. This is a bug in Bun."); - } - } + // Use ExternalString to avoid copying data if possible. + // This is only possible for ascii data, as that fits into latin1 + // otherwise we have to convert it utf-8 into utf16-le. + var str = if (is_ascii) ascii: { - const deserialized = str.toJSByParseJSON(globalThis) catch |e| switch (e) { - error.JSError => { - globalThis.clearException(); - return IPCDecodeError.InvalidFormat; - }, - error.JSTerminated => { - globalThis.clearException(); - return IPCDecodeError.InvalidFormat; - }, - error.OutOfMemory => return bun.outOfMemory(), - }; + // .dead if `json_data` exceeds max length + const s = bun.String.createExternal(*bool, json_data, true, &was_ascii_string_freed, jsonIPCDataStringFreeCB); + if (s.tag == .Dead) { + @branchHint(.unlikely); + return IPCDecodeError.OutOfMemory; + } + break :ascii s; + } else bun.String.borrowUTF8(json_data); - return switch (kind) { - .regular => .{ - .bytes_consumed = idx + 1, - .message = .{ .data = deserialized }, - }, - .internal => .{ - .bytes_consumed = idx + 1, - .message = .{ .internal = deserialized }, - }, - }; + defer { + str.deref(); + if (is_ascii and !was_ascii_string_freed) { + @panic("Expected ascii string to be freed by ExternalString, but it wasn't. This is a bug in Bun."); + } } - return IPCDecodeError.NotEnoughBytes; + + const deserialized = str.toJSByParseJSON(globalThis) catch |e| switch (e) { + error.JSError => { + globalThis.clearException(); + return IPCDecodeError.InvalidFormat; + }, + error.JSTerminated => { + globalThis.clearException(); + return IPCDecodeError.InvalidFormat; + }, + error.OutOfMemory => return bun.outOfMemory(), + }; + + return switch (kind) { + .regular => .{ + .bytes_consumed = @intCast(idx + 1), + .message = .{ .data = deserialized }, + }, + .internal => .{ + .bytes_consumed = @intCast(idx + 1), + .message = .{ .internal = deserialized }, + }, + }; } pub fn serialize(writer: *bun.io.StreamBuffer, global: *jsc.JSGlobalObject, value: JSValue, is_internal: IsInternal) !usize { var out: bun.String = undefined; - try value.jsonStringify(global, 0, &out); + // Use jsonStringifyFast which passes undefined for the space parameter, + // triggering JSC's SIMD-optimized FastStringifier code path. + try value.jsonStringifyFast(global, &out); defer out.deref(); if (out.tag == .Dead) return IPCSerializationError.SerializationFailed; @@ -256,9 +285,11 @@ const json = struct { }; /// Given potentially unfinished buffer `data`, attempt to decode and process a message from it. -pub fn decodeIPCMessage(mode: Mode, data: []const u8, global: *jsc.JSGlobalObject) IPCDecodeError!DecodeIPCMessageResult { +/// For JSON mode, `known_newline` can be provided to avoid re-scanning for the newline delimiter. +pub fn decodeIPCMessage(mode: Mode, data: []const u8, global: *jsc.JSGlobalObject, known_newline: ?u32) IPCDecodeError!DecodeIPCMessageResult { return switch (mode) { - inline else => |t| @field(@This(), @tagName(t)).decodeIPCMessage(data, global), + .advanced => advanced.decodeIPCMessage(data, global), + .json => json.decodeIPCMessage(data, global, known_newline), }; } @@ -418,7 +449,7 @@ pub const SendQueue = struct { has_written_version: if (Environment.allow_assert) u1 else u0 = 0, mode: Mode, internal_msg_queue: node_cluster_binding.InternalMsgHolder = .{}, - incoming: bun.ByteList = .{}, // Maybe we should use StreamBuffer here as well + incoming: IncomingBuffer, incoming_fd: ?bun.FileDescriptor = null, socket: SocketUnion, @@ -453,7 +484,13 @@ pub const SendQueue = struct { pub fn init(mode: Mode, owner: SendQueueOwner, socket: SocketUnion) @This() { log("SendQueue#init", .{}); - return .{ .queue = .init(bun.default_allocator), .mode = mode, .owner = owner, .socket = socket }; + return .{ + .queue = .init(bun.default_allocator), + .mode = mode, + .owner = owner, + .socket = socket, + .incoming = IncomingBuffer.init(mode), + }; } pub fn deinit(self: *@This()) void { log("SendQueue#deinit", .{}); @@ -463,7 +500,7 @@ pub const SendQueue = struct { for (self.queue.items) |*item| item.deinit(); self.queue.deinit(); self.internal_msg_queue.deinit(); - self.incoming.deinit(bun.default_allocator); + self.incoming.deinit(); if (self.waiting_for_ack) |*waiting| waiting.deinit(); // if there is a close next tick task, cancel it so it doesn't get called and then UAF @@ -1134,67 +1171,99 @@ fn onData2(send_queue: *SendQueue, all_data: []const u8) void { // Decode the message with just the temporary buffer, and if that // fails (not enough bytes) then we allocate to .ipc_buffer - if (send_queue.incoming.len == 0) { - while (true) { - const result = decodeIPCMessage(send_queue.mode, data, globalThis) catch |e| switch (e) { - error.NotEnoughBytes => { - _ = bun.handleOom(send_queue.incoming.write(bun.default_allocator, data)); - log("hit NotEnoughBytes", .{}); - return; - }, - error.InvalidFormat, error.JSError, error.JSTerminated => { - send_queue.closeSocket(.failure, .user); - return; - }, - error.OutOfMemory => { - Output.printErrorln("IPC message is too long.", .{}); - send_queue.closeSocket(.failure, .user); - return; - }, - }; - - handleIPCMessage(send_queue, result.message, globalThis); + switch (send_queue.incoming) { + .json => |*json_buf| { + // JSON mode: append to buffer (scans only new data for newline), + // then process complete messages using next(). + json_buf.append(data); + + while (json_buf.next()) |msg| { + const result = decodeIPCMessage(.json, msg.data, globalThis, msg.newline_pos) catch |e| switch (e) { + error.NotEnoughBytes => { + log("hit NotEnoughBytes", .{}); + return; + }, + error.InvalidFormat, error.JSError, error.JSTerminated => { + send_queue.closeSocket(.failure, .user); + return; + }, + error.OutOfMemory => { + Output.printErrorln("IPC message is too long.", .{}); + send_queue.closeSocket(.failure, .user); + return; + }, + }; - if (result.bytes_consumed < data.len) { - data = data[result.bytes_consumed..]; - } else { - return; + handleIPCMessage(send_queue, result.message, globalThis); + json_buf.consume(result.bytes_consumed); + } + }, + .advanced => |*adv_buf| { + // Advanced mode: uses length-prefix, no newline scanning needed. + // Try to decode directly first, only buffer if needed. + if (adv_buf.len == 0) { + while (true) { + const result = decodeIPCMessage(.advanced, data, globalThis, null) catch |e| switch (e) { + error.NotEnoughBytes => { + _ = bun.handleOom(adv_buf.write(bun.default_allocator, data)); + log("hit NotEnoughBytes", .{}); + return; + }, + error.InvalidFormat, error.JSError, error.JSTerminated => { + send_queue.closeSocket(.failure, .user); + return; + }, + error.OutOfMemory => { + Output.printErrorln("IPC message is too long.", .{}); + send_queue.closeSocket(.failure, .user); + return; + }, + }; + + handleIPCMessage(send_queue, result.message, globalThis); + + if (result.bytes_consumed < data.len) { + data = data[result.bytes_consumed..]; + } else { + return; + } + } } - } - } - - _ = bun.handleOom(send_queue.incoming.write(bun.default_allocator, data)); - var slice = send_queue.incoming.slice(); - while (true) { - const result = decodeIPCMessage(send_queue.mode, slice, globalThis) catch |e| switch (e) { - error.NotEnoughBytes => { - // copy the remaining bytes to the start of the buffer - bun.copy(u8, send_queue.incoming.ptr[0..slice.len], slice); - send_queue.incoming.len = @truncate(slice.len); - log("hit NotEnoughBytes2", .{}); - return; - }, - error.InvalidFormat, error.JSError, error.JSTerminated => { - send_queue.closeSocket(.failure, .user); - return; - }, - error.OutOfMemory => { - Output.printErrorln("IPC message is too long.", .{}); - send_queue.closeSocket(.failure, .user); - return; - }, - }; + // Buffer has existing data, append and process + _ = bun.handleOom(adv_buf.write(bun.default_allocator, data)); + var slice = adv_buf.slice(); + while (true) { + const result = decodeIPCMessage(.advanced, slice, globalThis, null) catch |e| switch (e) { + error.NotEnoughBytes => { + // copy the remaining bytes to the start of the buffer + bun.copy(u8, adv_buf.ptr[0..slice.len], slice); + bun.debugAssert(slice.len <= std.math.maxInt(u32)); + adv_buf.len = @intCast(slice.len); + log("hit NotEnoughBytes2", .{}); + return; + }, + error.InvalidFormat, error.JSError, error.JSTerminated => { + send_queue.closeSocket(.failure, .user); + return; + }, + error.OutOfMemory => { + Output.printErrorln("IPC message is too long.", .{}); + send_queue.closeSocket(.failure, .user); + return; + }, + }; - handleIPCMessage(send_queue, result.message, globalThis); + handleIPCMessage(send_queue, result.message, globalThis); - if (result.bytes_consumed < slice.len) { - slice = slice[result.bytes_consumed..]; - } else { - // clear the buffer - send_queue.incoming.len = 0; - return; - } + if (result.bytes_consumed < slice.len) { + slice = slice[result.bytes_consumed..]; + } else { + adv_buf.len = 0; + return; + } + } + }, } } @@ -1301,13 +1370,26 @@ pub const IPCHandlers = struct { pub const WindowsNamedPipe = struct { fn onReadAlloc(send_queue: *SendQueue, suggested_size: usize) []u8 { - var available = send_queue.incoming.unusedCapacitySlice(); - if (available.len < suggested_size) { - bun.handleOom(send_queue.incoming.ensureUnusedCapacity(bun.default_allocator, suggested_size)); - available = send_queue.incoming.unusedCapacitySlice(); + switch (send_queue.incoming) { + .json => |*json_buf| { + var available = json_buf.unusedCapacitySlice(); + if (available.len < suggested_size) { + json_buf.ensureUnusedCapacity(suggested_size); + available = json_buf.unusedCapacitySlice(); + } + log("NewNamedPipeIPCHandler#onReadAlloc {d}", .{suggested_size}); + return available.ptr[0..suggested_size]; + }, + .advanced => |*adv_buf| { + var available = adv_buf.unusedCapacitySlice(); + if (available.len < suggested_size) { + bun.handleOom(adv_buf.ensureUnusedCapacity(bun.default_allocator, suggested_size)); + available = adv_buf.unusedCapacitySlice(); + } + log("NewNamedPipeIPCHandler#onReadAlloc {d}", .{suggested_size}); + return available.ptr[0..suggested_size]; + }, } - log("NewNamedPipeIPCHandler#onReadAlloc {d}", .{suggested_size}); - return available.ptr[0..suggested_size]; } fn onReadError(send_queue: *SendQueue, err: bun.sys.E) void { @@ -1321,41 +1403,77 @@ pub const IPCHandlers = struct { const loop = globalThis.bunVM().eventLoop(); loop.enter(); defer loop.exit(); - send_queue.incoming.len += @as(u32, @truncate(buffer.len)); - var slice = send_queue.incoming.slice(); - bun.assert(send_queue.incoming.len <= send_queue.incoming.cap); - bun.assert(bun.isSliceInBuffer(buffer, send_queue.incoming.allocatedSlice())); - - while (true) { - const result = decodeIPCMessage(send_queue.mode, slice, globalThis) catch |e| switch (e) { - error.NotEnoughBytes => { - // copy the remaining bytes to the start of the buffer - bun.copy(u8, send_queue.incoming.ptr[0..slice.len], slice); - send_queue.incoming.len = @truncate(slice.len); - log("hit NotEnoughBytes3", .{}); - return; - }, - error.InvalidFormat, error.JSError, error.JSTerminated => { - send_queue.closeSocket(.failure, .user); - return; - }, - error.OutOfMemory => { - Output.printErrorln("IPC message is too long.", .{}); - send_queue.closeSocket(.failure, .user); - return; - }, - }; - - handleIPCMessage(send_queue, result.message, globalThis); - - if (result.bytes_consumed < slice.len) { - slice = slice[result.bytes_consumed..]; - } else { - // clear the buffer - send_queue.incoming.len = 0; - return; - } + switch (send_queue.incoming) { + .json => |*json_buf| { + // For JSON mode on Windows, use notifyWritten to update length and scan for newlines + bun.assert(json_buf.data.len + buffer.len <= json_buf.data.cap); + bun.assert(bun.isSliceInBuffer(buffer, json_buf.data.allocatedSlice())); + + json_buf.notifyWritten(buffer); + + // Process complete messages using next() - avoids O(n²) re-scanning + while (json_buf.next()) |msg| { + const result = decodeIPCMessage(.json, msg.data, globalThis, msg.newline_pos) catch |e| switch (e) { + error.NotEnoughBytes => { + log("hit NotEnoughBytes3", .{}); + return; + }, + error.InvalidFormat, error.JSError, error.JSTerminated => { + send_queue.closeSocket(.failure, .user); + return; + }, + error.OutOfMemory => { + Output.printErrorln("IPC message is too long.", .{}); + send_queue.closeSocket(.failure, .user); + return; + }, + }; + + handleIPCMessage(send_queue, result.message, globalThis); + json_buf.consume(result.bytes_consumed); + } + }, + .advanced => |*adv_buf| { + adv_buf.len +|= @as(u32, @intCast(buffer.len)); + var slice = adv_buf.slice(); + + bun.assert(adv_buf.len <= adv_buf.cap); + bun.assert(bun.isSliceInBuffer(buffer, adv_buf.allocatedSlice())); + + while (true) { + const result = decodeIPCMessage(.advanced, slice, globalThis, null) catch |e| switch (e) { + error.NotEnoughBytes => { + // copy the remaining bytes to the start of the buffer + bun.copy(u8, adv_buf.ptr[0..slice.len], slice); + // slice.len is guaranteed <= adv_buf.len (u32) since it's derived from adv_buf.slice() + bun.debugAssert(slice.len <= std.math.maxInt(u32)); + adv_buf.len = @intCast(slice.len); + log("hit NotEnoughBytes3", .{}); + return; + }, + error.InvalidFormat, error.JSError, error.JSTerminated => { + send_queue.closeSocket(.failure, .user); + return; + }, + error.OutOfMemory => { + Output.printErrorln("IPC message is too long.", .{}); + send_queue.closeSocket(.failure, .user); + return; + }, + }; + + handleIPCMessage(send_queue, result.message, globalThis); + + if (result.bytes_consumed < slice.len) { + slice = slice[result.bytes_consumed..]; + } else { + // clear the buffer + adv_buf.len = 0; + return; + } + } + }, } } @@ -1378,6 +1496,7 @@ const string = []const u8; const node_cluster_binding = @import("./node/node_cluster_binding.zig"); const std = @import("std"); +const JSONLineBuffer = @import("./JSONLineBuffer.zig").JSONLineBuffer; const bun = @import("bun"); const Environment = bun.Environment; diff --git a/src/bun.js/modules/BunJSCModule.h b/src/bun.js/modules/BunJSCModule.h index 5fa2aca13d4cf6..a9d4e8b19431f2 100644 --- a/src/bun.js/modules/BunJSCModule.h +++ b/src/bun.js/modules/BunJSCModule.h @@ -751,7 +751,7 @@ JSC_DEFINE_HOST_FUNCTION(functionGenerateHeapSnapshotForDebugging, } scope.releaseAssertNoException(); - return JSValue::encode(JSONParse(globalObject, WTFMove(jsonString))); + return JSValue::encode(JSONParse(globalObject, WTF::move(jsonString))); } JSC_DEFINE_HOST_FUNCTION(functionSerialize, @@ -782,7 +782,7 @@ JSC_DEFINE_HOST_FUNCTION(functionSerialize, Vector> transferList; Vector> dummyPorts; - ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTFMove(transferList), dummyPorts, SerializationForStorage::Yes); + ExceptionOr> serialized = SerializedScriptValue::create(*globalObject, value, WTF::move(transferList), dummyPorts, SerializationForStorage::Yes); EXCEPTION_ASSERT(serialized.hasException() == !!throwScope.exception()); if (serialized.hasException()) { WebCore::propagateException(*globalObject, throwScope, serialized.releaseException()); @@ -795,16 +795,16 @@ JSC_DEFINE_HOST_FUNCTION(functionSerialize, if (asNodeBuffer) { size_t byteLength = arrayBuffer->byteLength(); auto* subclassStructure = globalObject->JSBufferSubclassStructure(); - JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTFMove(arrayBuffer), 0, byteLength); + JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, subclassStructure, WTF::move(arrayBuffer), 0, byteLength); RETURN_IF_EXCEPTION(throwScope, {}); return JSValue::encode(uint8Array); } if (arrayBuffer->isShared()) { - return JSValue::encode(JSArrayBuffer::create(vm, globalObject->arrayBufferStructureWithSharingMode(), WTFMove(arrayBuffer))); + return JSValue::encode(JSArrayBuffer::create(vm, globalObject->arrayBufferStructureWithSharingMode(), WTF::move(arrayBuffer))); } - return JSValue::encode(JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTFMove(arrayBuffer))); + return JSValue::encode(JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(), WTF::move(arrayBuffer))); } JSC_DEFINE_HOST_FUNCTION(functionDeserialize, (JSGlobalObject * globalObject, CallFrame* callFrame)) { diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig index cb913c812d9af2..1acacb9994df77 100644 --- a/src/bun.js/test/jest.zig +++ b/src/bun.js/test/jest.zig @@ -430,7 +430,8 @@ pub fn formatLabel(globalThis: *JSGlobalObject, label: string, function_args: [] 'j', 'o' => { var str = bun.String.empty; defer str.deref(); - try current_arg.jsonStringify(globalThis, 0, &str); + // Use jsonStringifyFast for SIMD-optimized serialization + try current_arg.jsonStringifyFast(globalThis, &str); const owned_slice = bun.handleOom(str.toOwnedSlice(allocator)); defer allocator.free(owned_slice); bun.handleOom(list.appendSlice(owned_slice)); diff --git a/src/bun.js/webcore/Response.zig b/src/bun.js/webcore/Response.zig index b02967ccb6c40e..4c43c933bc44d1 100644 --- a/src/bun.js/webcore/Response.zig +++ b/src/bun.js/webcore/Response.zig @@ -529,10 +529,12 @@ pub fn constructJSON( const err = globalThis.createTypeErrorInstance("Do not know how to serialize a BigInt", .{}); return globalThis.throwValue(err); } + var str = bun.String.empty; - // calling JSON.stringify on an empty string adds extra quotes - // so this is correct - try json_value.jsonStringify(globalThis, 0, &str); + // Use jsonStringifyFast which passes undefined for the space parameter, + // triggering JSC's FastStringifier optimization. This is significantly faster + // than jsonStringify which passes 0 for space and uses the slower Stringifier. + try json_value.jsonStringifyFast(globalThis, &str); if (globalThis.hasException()) { return .zero; @@ -896,8 +898,6 @@ inline fn emptyWithStatus(_: *jsc.JSGlobalObject, status: u16) Response { /// https://developer.mozilla.org/en-US/docs/Web/API/Headers // TODO: move to http.zig. this has nothing to do with jsc or WebCore -const string = []const u8; - const std = @import("std"); const Method = @import("../../http/Method.zig").Method; diff --git a/src/bun.js/webcore/blob/write_file.zig b/src/bun.js/webcore/blob/write_file.zig index f2c942c07bddf6..0e39ba0c78f64d 100644 --- a/src/bun.js/webcore/blob/write_file.zig +++ b/src/bun.js/webcore/blob/write_file.zig @@ -301,7 +301,6 @@ pub const WriteFile = struct { if (remain.len > 0 and this.errno == null) { var wrote: usize = 0; const continue_writing = this.doWrite(remain, &wrote); - this.bytes_blob.offset += @truncate(wrote); if (!continue_writing) { // Stop writing, we errored if (this.errno != null) { diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index a52515b465d0b3..af6199fe680916 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -1904,6 +1904,7 @@ pub const BundleV2 = struct { transpiler.options.css_chunking = config.css_chunking; transpiler.options.banner = config.banner.slice(); transpiler.options.footer = config.footer.slice(); + transpiler.options.react_fast_refresh = config.react_fast_refresh; if (transpiler.options.compile) { // Emitting DCE annotations is nonsensical in --compile. diff --git a/src/cli/Arguments.zig b/src/cli/Arguments.zig index 2a11d833201319..57a2ef5986767f 100644 --- a/src/cli/Arguments.zig +++ b/src/cli/Arguments.zig @@ -218,7 +218,7 @@ pub const test_only_params = [_]ParamType{ clap.parseParam("--coverage-reporter ... Report coverage in 'text' and/or 'lcov'. Defaults to 'text'.") catch unreachable, clap.parseParam("--coverage-dir Directory for coverage files. Defaults to 'coverage'.") catch unreachable, clap.parseParam("--bail ? Exit the test suite after failures. If you do not specify a number, it defaults to 1.") catch unreachable, - clap.parseParam("-t, --test-name-pattern Run only tests with a name that matches the given regex.") catch unreachable, + clap.parseParam("-t, --test-name-pattern/--grep Run only tests with a name that matches the given regex.") catch unreachable, clap.parseParam("--reporter Test output reporter format. Available: 'junit' (requires --reporter-outfile), 'dots'. Default: console output.") catch unreachable, clap.parseParam("--reporter-outfile Output file path for the reporter format (required with --reporter).") catch unreachable, clap.parseParam("--dots Enable dots reporter. Shorthand for --reporter=dots.") catch unreachable, diff --git a/src/cli/filter_run.zig b/src/cli/filter_run.zig index 334432a281c17a..1a4fee2d1fda90 100644 --- a/src/cli/filter_run.zig +++ b/src/cli/filter_run.zig @@ -584,13 +584,10 @@ pub fn runScriptsWithFilter(ctx: Command.Context) !noreturn { } // compute dependencies (TODO: maybe we should do this only in a workspace?) for (state.handles) |*handle| { + const source_buf = handle.config.deps.source_buf; var iter = handle.config.deps.map.iterator(); while (iter.next()) |entry| { - var sfa = std.heap.stackFallback(256, ctx.allocator); - const alloc = sfa.get(); - const buf = try alloc.alloc(u8, entry.key_ptr.len()); - defer alloc.free(buf); - const name = entry.key_ptr.slice(buf); + const name = entry.key_ptr.slice(source_buf); // is it a workspace dependency? if (map.get(name)) |pkgs| { for (pkgs.items) |dep| { diff --git a/src/codegen/bindgen.ts b/src/codegen/bindgen.ts index 0ab0708612b8c0..386823736f9995 100644 --- a/src/codegen/bindgen.ts +++ b/src/codegen/bindgen.ts @@ -754,11 +754,13 @@ function emitConvertEnumFunction(w: CodeWriter, type: TypeImpl) { w.line(); w.line(`template<> std::optional<${name}> parseEnumerationFromString<${name}>(const String& stringValue)`); w.line(`{`); - w.line(` static constexpr std::pair mappings[] = {`); + w.line( + ` static constexpr std::array, ${type.data.length}> mappings { {`, + ); for (const value of type.data) { w.line(` { ${str(value)}_s, ${name}::${pascal(value)} },`); } - w.line(` };`); + w.line(` } };`); w.line(` static constexpr SortedArrayMap enumerationMapping { mappings };`); w.line(` if (auto* enumerationValue = enumerationMapping.tryGet(stringValue); enumerationValue) [[likely]]`); w.line(` return *enumerationValue;`); diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index ef054fe5b3f3ad..929585c9762284 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1501,7 +1501,7 @@ function generateClassHeader(typeName, obj: ClassDefinition) { void* m_ctx { nullptr }; ${name}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr${obj.valuesArray ? ", WTF::FixedVector>&& jsvalueArray_" : ""}) - : Base(vm, structure)${obj.valuesArray ? ", jsvalueArray(WTFMove(jsvalueArray_))" : ""} + : Base(vm, structure)${obj.valuesArray ? ", jsvalueArray(WTF::move(jsvalueArray_))" : ""} { m_ctx = sinkPtr; ${weakInit.trim()} @@ -1521,7 +1521,7 @@ function generateClassHeader(typeName, obj: ClassDefinition) { ${ obj.valuesArray && obj.values && obj.values.length > 0 ? `${name}(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr, WTF::FixedVector>&& jsvalueArray_${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) - : Base(vm, structure), jsvalueArray(WTFMove(jsvalueArray_))${obj.values.map(v => `\n , m_${v}(${v}, JSC::WriteBarrierEarlyInit)`).join("")} + : Base(vm, structure), jsvalueArray(WTF::move(jsvalueArray_))${obj.values.map(v => `\n , m_${v}(${v}, JSC::WriteBarrierEarlyInit)`).join("")} { m_ctx = sinkPtr; ${weakInit.trim()} @@ -1779,7 +1779,7 @@ ${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::St ${ obj.valuesArray ? `${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx, WTF::FixedVector>&& jsvalueArray) { - ${name}* ptr = new (NotNull, JSC::allocateCell<${name}>(vm)) ${name}(vm, structure, ctx, WTFMove(jsvalueArray)); + ${name}* ptr = new (NotNull, JSC::allocateCell<${name}>(vm)) ${name}(vm, structure, ctx, WTF::move(jsvalueArray)); ptr->finishCreation(vm); return ptr; }` @@ -1799,7 +1799,7 @@ ${ ${ obj.valuesArray && obj.values && obj.values.length > 0 ? `${name}* ${name}::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx, WTF::FixedVector>&& jsvalueArray${obj.values.map(v => `, JSC::JSValue ${v}`).join("")}) { - ${name}* ptr = new (NotNull, JSC::allocateCell<${name}>(vm)) ${name}(vm, structure, ctx, WTFMove(jsvalueArray)${obj.values.map(v => `, ${v}`).join("")}); + ${name}* ptr = new (NotNull, JSC::allocateCell<${name}>(vm)) ${name}(vm, structure, ctx, WTF::move(jsvalueArray)${obj.values.map(v => `, ${v}`).join("")}); ptr->finishCreation(vm); return ptr; }` @@ -1915,7 +1915,7 @@ ${ for (size_t i = 0; i < args->size(); ++i) { jsvalueArray[i].setWithoutWriteBarrier(args->at(i)); } - ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr, WTFMove(jsvalueArray)); + ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr, WTF::move(jsvalueArray)); ${ obj.estimatedSize ? ` @@ -1956,7 +1956,7 @@ ${ for (size_t i = 0; i < args->size(); ++i) { jsvalueArray[i].setWithoutWriteBarrier(args->at(i)); } - ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr, WTFMove(jsvalueArray)${obj.values.map(v => `, JSC::JSValue::decode(${v})`).join("")}); + ${className(typeName)}* instance = ${className(typeName)}::create(vm, globalObject, structure, ptr, WTF::move(jsvalueArray)${obj.values.map(v => `, JSC::JSValue::decode(${v})`).join("")}); ${ obj.estimatedSize ? ` diff --git a/src/deps/zig-clap/clap.zig b/src/deps/zig-clap/clap.zig index 07f9ec7b798628..edda626bba8112 100644 --- a/src/deps/zig-clap/clap.zig +++ b/src/deps/zig-clap/clap.zig @@ -8,8 +8,22 @@ pub const Names = struct { /// '-' prefix short: ?u8 = null, - /// '--' prefix + /// '--' prefix (primary name, used for display/help) long: ?[]const u8 = null, + + /// Additional '--' prefixed aliases (e.g., --grep as alias for --test-name-pattern) + long_aliases: []const []const u8 = &.{}, + + /// Check if the given name matches the primary long name or any alias + pub fn matchesLong(self: Names, name: []const u8) bool { + if (self.long) |l| { + if (mem.eql(u8, name, l)) return true; + } + for (self.long_aliases) |alias| { + if (mem.eql(u8, name, alias)) return true; + } + return false; + } }; /// Whether a param takes no value (a flag), one value, or can be specified multiple times. @@ -51,6 +65,7 @@ pub fn Param(comptime Id: type) type { /// Takes a string and parses it to a Param(Help). /// This is the reverse of 'help' but for at single parameter only. +/// Supports multiple long name variants separated by '/' (e.g., "--test-name-pattern/--grep"). pub fn parseParam(line: []const u8) !Param(Help) { @setEvalBranchQuota(999999); @@ -89,11 +104,67 @@ pub fn parseParam(line: []const u8) !Param(Help) { } else null; var res = parseParamRest(it.rest()); - res.names.long = param_str[2..]; res.names.short = short_name; + + // Parse long names - supports multiple variants separated by '/' + // e.g., "--test-name-pattern/--grep" becomes primary "test-name-pattern" with alias "grep" + const long_names = parseLongNames(param_str); + res.names.long = long_names.long; + res.names.long_aliases = long_names.long_aliases; return res; } +fn parseLongNames(comptime param_str: []const u8) Names { + comptime { + // Count how many long name variants we have (separated by '/') + var alias_count: usize = 0; + for (param_str) |c| { + if (c == '/') alias_count += 1; + } + + if (alias_count == 0) { + // No aliases, just the primary name + if (mem.startsWith(u8, param_str, "--")) { + return .{ .long = param_str[2..], .long_aliases = &.{} }; + } + return .{ .long = null, .long_aliases = &.{} }; + } + + // Parse multiple long names at comptime + // First pass: find the primary name + var primary: ?[]const u8 = null; + var name_it = mem.splitScalar(u8, param_str, '/'); + while (name_it.next()) |name_part| { + if (!mem.startsWith(u8, name_part, "--")) continue; + primary = name_part[2..]; + break; + } + + // Second pass: collect aliases into a comptime-known array type + const aliases = blk: { + var result: [alias_count][]const u8 = undefined; + var idx: usize = 0; + var it = mem.splitScalar(u8, param_str, '/'); + var is_first = true; + while (it.next()) |name_part| { + if (!mem.startsWith(u8, name_part, "--")) continue; + if (is_first) { + is_first = false; + continue; // Skip primary + } + result[idx] = name_part[2..]; + idx += 1; + } + break :blk result; + }; + + return .{ + .long = primary, + .long_aliases = &aliases, + }; + } +} + fn parseParamRest(line: []const u8) Param(Help) { if (mem.startsWith(u8, line, "<")) blk: { const len = mem.indexOfScalar(u8, line, '>') orelse break :blk; diff --git a/src/deps/zig-clap/clap/comptime.zig b/src/deps/zig-clap/clap/comptime.zig index aadeb66fd2d9fd..9c454b9d51dc13 100644 --- a/src/deps/zig-clap/clap/comptime.zig +++ b/src/deps/zig-clap/clap/comptime.zig @@ -156,6 +156,11 @@ pub fn ComptimeClap( if (mem.eql(u8, name, "--" ++ l)) return true; } + // Check aliases + for (param.names.long_aliases) |alias| { + if (mem.eql(u8, name, "--" ++ alias)) + return true; + } } return false; @@ -173,6 +178,11 @@ pub fn ComptimeClap( if (mem.eql(u8, name, "--" ++ l)) return param; } + // Check aliases + for (param.names.long_aliases) |alias| { + if (mem.eql(u8, name, "--" ++ alias)) + return param; + } } @compileError(name ++ " is not a parameter."); diff --git a/src/deps/zig-clap/clap/streaming.zig b/src/deps/zig-clap/clap/streaming.zig index 40f37a1057cc3c..39bfc132623a9d 100644 --- a/src/deps/zig-clap/clap/streaming.zig +++ b/src/deps/zig-clap/clap/streaming.zig @@ -61,9 +61,7 @@ pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type { const maybe_value = if (eql_index) |i| arg[i + 1 ..] else null; for (parser.params) |*param| { - const match = param.names.long orelse continue; - - if (!mem.eql(u8, name, match)) + if (!param.names.matchesLong(name)) continue; if (param.takes_value == .none or param.takes_value == .one_optional) { diff --git a/src/http/websocket_client.zig b/src/http/websocket_client.zig index 5845156238d76c..45e19a3a38a0a8 100644 --- a/src/http/websocket_client.zig +++ b/src/http/websocket_client.zig @@ -234,6 +234,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { deflate.decompress(data_, &decompressed) catch |err| { const error_code = switch (err) { error.InflateFailed => ErrorCode.invalid_compressed_data, + error.TooLarge => ErrorCode.message_too_big, error.OutOfMemory => ErrorCode.failed_to_allocate_memory, }; this.terminate(error_code); diff --git a/src/http/websocket_client/WebSocketDeflate.zig b/src/http/websocket_client/WebSocketDeflate.zig index d6f5acef898d1f..935721589a8729 100644 --- a/src/http/websocket_client/WebSocketDeflate.zig +++ b/src/http/websocket_client/WebSocketDeflate.zig @@ -76,6 +76,9 @@ const Z_DEFAULT_MEM_LEVEL = 8; // Buffer size for compression/decompression operations const COMPRESSION_BUFFER_SIZE = 4096; +// Maximum decompressed message size (128 MB) +const MAX_DECOMPRESSED_SIZE: usize = 128 * 1024 * 1024; + // DEFLATE trailer bytes added by Z_SYNC_FLUSH const DEFLATE_TRAILER = [_]u8{ 0x00, 0x00, 0xff, 0xff }; @@ -136,13 +139,17 @@ fn canUseLibDeflate(len: usize) bool { return len < RareData.stack_buffer_size; } -pub fn decompress(self: *PerMessageDeflate, in_buf: []const u8, out: *std.array_list.Managed(u8)) error{ InflateFailed, OutOfMemory }!void { +pub fn decompress(self: *PerMessageDeflate, in_buf: []const u8, out: *std.array_list.Managed(u8)) error{ InflateFailed, OutOfMemory, TooLarge }!void { + const initial_len = out.items.len; // First we try with libdeflate, which is both faster and doesn't need the trailing deflate bytes if (canUseLibDeflate(in_buf.len)) { const result = self.rare_data.decompressor().deflate(in_buf, out.unusedCapacitySlice()); if (result.status == .success) { out.items.len += result.written; + if (out.items.len - initial_len > MAX_DECOMPRESSED_SIZE) { + return error.TooLarge; + } return; } } @@ -163,6 +170,11 @@ pub fn decompress(self: *PerMessageDeflate, in_buf: []const u8, out: *std.array_ const res = zlib.inflate(&self.decompress_stream, zlib.FlushValue.NoFlush); out.items.len += out.unusedCapacitySlice().len - self.decompress_stream.avail_out; + // Check for decompression bomb + if (out.items.len - initial_len > MAX_DECOMPRESSED_SIZE) { + return error.TooLarge; + } + if (res == .StreamEnd) { break; } diff --git a/src/js/builtins/shell.ts b/src/js/builtins/shell.ts index 40f3e7d3a0639e..142eecccc20702 100644 --- a/src/js/builtins/shell.ts +++ b/src/js/builtins/shell.ts @@ -1,4 +1,35 @@ -export function createBunShellTemplateFunction(createShellInterpreter_, createParsedShellScript_) { +// Note: ShellTraceFlags interface documents the permission flag values returned +// by $.trace operations. These are intentionally not exported as runtime values +// to keep the trace API simple - users compare against numeric constants directly. +// The values mirror standard Unix open(2) and access(2) flags. + +interface ShellTraceOperation { + /** Permission flags (octal integer, can be combined with |) */ + flags: number; + /** Working directory at time of operation */ + cwd: string; + /** Absolute path that would be accessed (for file/execute operations) */ + path?: string; + /** Command name (for execute operations) */ + command?: string; + /** Accumulated environment variables at this point in execution */ + env?: Record; + /** Which standard stream is being redirected: "stdin", "stdout", or "stderr" */ + stream?: "stdin" | "stdout" | "stderr"; + /** Command arguments for external commands (excluding command name) */ + args?: string[]; + /** True if operation contains non-statically-analyzable values (command substitution, $1, etc.) */ + dynamic?: true; +} + +interface ShellTraceResult { + operations: ShellTraceOperation[]; + cwd: string; + success: boolean; + error: string | null; +} + +export function createBunShellTemplateFunction(createShellInterpreter_, createParsedShellScript_, traceShellScript_) { const createShellInterpreter = createShellInterpreter_ as ( resolve: (code: number, stdout: Buffer, stderr: Buffer) => void, reject: (code: number, stdout: Buffer, stderr: Buffer) => void, @@ -8,6 +39,7 @@ export function createBunShellTemplateFunction(createShellInterpreter_, createPa raw: string, args: string[], ) => $ZigGeneratedClasses.ParsedShellScript; + const traceShellScript = traceShellScript_ as (args: $ZigGeneratedClasses.ParsedShellScript) => ShellTraceResult; function lazyBufferToHumanReadableString(this: Buffer) { return this.toString(); @@ -348,6 +380,22 @@ export function createBunShellTemplateFunction(createShellInterpreter_, createPa BunShell[envSymbol] = defaultEnv; BunShell[throwsSymbol] = true; + // Trace function - analyzes shell script without running it + function trace(first, ...rest): ShellTraceResult { + if (first?.raw === undefined) + throw new Error("Please use '$.trace' as a tagged template function: $.trace`cmd arg1 arg2`"); + const parsed_shell_script = createParsedShellScript(first.raw, rest); + + const cwd = BunShell[cwdSymbol]; + const env = BunShell[envSymbol]; + + // cwd must be set before env or else it will be injected into env as "PWD=/" + if (cwd) parsed_shell_script.setCwd(cwd); + if (env) parsed_shell_script.setEnv(env); + + return traceShellScript(parsed_shell_script); + } + Object.defineProperties(BunShell, { Shell: { value: Shell, @@ -361,6 +409,10 @@ export function createBunShellTemplateFunction(createShellInterpreter_, createPa value: ShellError, enumerable: true, }, + trace: { + value: trace, + enumerable: true, + }, }); return BunShell; diff --git a/src/js/node/_http_server.ts b/src/js/node/_http_server.ts index e40bb70bb524a8..b577febc08d321 100644 --- a/src/js/node/_http_server.ts +++ b/src/js/node/_http_server.ts @@ -1332,9 +1332,9 @@ ServerResponse.prototype.end = function (chunk, encoding, callback) { } if (!handle) { - if ($isCallable(callback)) { - process.nextTick(callback); - } + // Match Node.js behavior: no socket means no "finish" or end callback. + // Still mark the response as finished so writableEnded is true. + this.finished = true; return this; } diff --git a/src/js/node/assert.ts b/src/js/node/assert.ts index 454b2b3b0d11d4..0507b5c620cc32 100644 --- a/src/js/node/assert.ts +++ b/src/js/node/assert.ts @@ -828,9 +828,10 @@ function rejects( error: nodeAssert.AssertPredicate, message?: string | Error, ): Promise; -assert.rejects = async function rejects(promiseFn: () => Promise, ...args: any[]): Promise { - expectsError(rejects, await waitForActual(promiseFn), ...args); -}; +async function rejects(block: (() => Promise) | Promise, ...args: any[]): Promise { + expectsError(rejects, await waitForActual(block), ...args); +} +assert.rejects = rejects; /** * Asserts that the function `fn` does not throw an error. diff --git a/src/resolver/package_json.zig b/src/resolver/package_json.zig index 1ccf7529cac758..380ceb4fbf4d5c 100644 --- a/src/resolver/package_json.zig +++ b/src/resolver/package_json.zig @@ -1031,7 +1031,7 @@ pub const PackageJSON = struct { const name_prop = prop.key orelse continue; const name_str = name_prop.asString(allocator) orelse continue; const name_hash = String.Builder.stringHash(name_str); - const name = String.init(name_str, name_str); + const name = String.init(package_json.dependencies.source_buf, name_str); const version_value = prop.value orelse continue; const version_str = version_value.asString(allocator) orelse continue; const sliced_str = Semver.SlicedString.init(version_str, version_str); diff --git a/src/shell/TraceInterpreter.zig b/src/shell/TraceInterpreter.zig new file mode 100644 index 00000000000000..275144a4a7f95e --- /dev/null +++ b/src/shell/TraceInterpreter.zig @@ -0,0 +1,1252 @@ +//! The trace interpreter simulates shell execution without actually running commands. +//! It walks the AST and collects information about what permissions would be needed +//! and what file paths would be accessed. +//! +//! This is used for a permission system where users can inspect what a shell command +//! would do before actually executing it. + +/// Unix-style permission flags using standard octal values +/// These mirror the constants used by open(2), chmod(2), and access(2) +pub const Permission = struct { + /// Standard Unix permission bits (octal) + pub const O_RDONLY: u32 = 0o0; // Read only + pub const O_WRONLY: u32 = 0o1; // Write only + pub const O_RDWR: u32 = 0o2; // Read and write + pub const O_CREAT: u32 = 0o100; // Create file if it doesn't exist + pub const O_EXCL: u32 = 0o200; // Fail if file exists (with O_CREAT) + pub const O_TRUNC: u32 = 0o1000; // Truncate file to zero length + pub const O_APPEND: u32 = 0o2000; // Append to file + + /// Extended operation flags (using higher bits to avoid conflicts) + pub const X_OK: u32 = 0o100000; // Execute permission / run command + pub const DELETE: u32 = 0o200000; // Delete file or directory + pub const MKDIR: u32 = 0o400000; // Create directory + pub const CHDIR: u32 = 0o1000000; // Change directory + pub const ENV: u32 = 0o2000000; // Modify environment + + /// Convenience combinations + pub const READ: u32 = O_RDONLY; + pub const WRITE: u32 = O_WRONLY; + pub const READ_WRITE: u32 = O_RDWR; + pub const CREATE: u32 = O_CREAT | O_WRONLY; + pub const CREATE_TRUNC: u32 = O_CREAT | O_TRUNC | O_WRONLY; + pub const APPEND: u32 = O_APPEND | O_WRONLY; + pub const EXECUTE: u32 = X_OK; +}; + +/// Standard stream identifiers for redirections +pub const Stream = enum(u8) { + none = 0, + stdin = 1, + stdout = 2, + stderr = 3, + + pub fn toJS(this: Stream, globalThis: *JSGlobalObject) JSValue { + return if (this == .none) .null else bun.String.static(@tagName(this)).toJS(globalThis); + } +}; + +/// A snapshot of environment variables at a point in execution +pub const EnvSnapshot = struct { + /// Map of variable name -> value + vars: bun.StringHashMapUnmanaged([]const u8), + /// Allocator used for this snapshot + allocator: Allocator, + + pub fn init(allocator: Allocator) EnvSnapshot { + return .{ + .vars = .{}, + .allocator = allocator, + }; + } + + pub fn clone(this: *const EnvSnapshot, allocator: Allocator) EnvSnapshot { + var new_vars: bun.StringHashMapUnmanaged([]const u8) = .{}; + var iter = this.vars.iterator(); + while (iter.next()) |entry| { + const key_copy = allocator.dupe(u8, entry.key_ptr.*) catch continue; + const val_copy = allocator.dupe(u8, entry.value_ptr.*) catch { + allocator.free(key_copy); + continue; + }; + new_vars.put(allocator, key_copy, val_copy) catch { + allocator.free(key_copy); + allocator.free(val_copy); + continue; + }; + } + return .{ + .vars = new_vars, + .allocator = allocator, + }; + } + + pub fn deinit(this: *EnvSnapshot) void { + var iter = this.vars.iterator(); + while (iter.next()) |entry| { + this.allocator.free(entry.key_ptr.*); + this.allocator.free(entry.value_ptr.*); + } + this.vars.deinit(this.allocator); + } + + pub fn toJS(this: *const EnvSnapshot, globalThis: *JSGlobalObject) JSValue { + var obj = jsc.JSValue.createEmptyObject(globalThis, @intCast(this.vars.count())); + var iter = this.vars.iterator(); + while (iter.next()) |entry| { + obj.put( + globalThis, + bun.String.init(entry.key_ptr.*), + bun.String.init(entry.value_ptr.*).toJS(globalThis), + ); + } + return obj; + } +}; + +/// Represents a single traced operation +pub const TracedOperation = struct { + /// The permission flags required (octal, like open/chmod) + flags: u32, + /// Absolute path that would be accessed (null for non-path operations) + path: ?[]const u8, + /// The command name (for execute operations) + command: ?[]const u8, + /// Working directory at time of operation + cwd: []const u8, + /// Snapshot of environment variables at this point + env: EnvSnapshot, + /// Which standard stream is being redirected (if any) + stream: Stream, + /// Command arguments (for execute operations, excluding the command name itself) + args: ?[]const []const u8, + /// Whether this operation contains dynamic/non-statically-analyzable values + dynamic: bool, + + pub fn deinit(this: *TracedOperation, allocator: Allocator) void { + if (this.path) |p| allocator.free(p); + if (this.command) |c| allocator.free(c); + allocator.free(this.cwd); + this.env.deinit(); + if (this.args) |args| { + for (args) |arg| allocator.free(arg); + allocator.free(args); + } + } + + pub fn toJS(this: *const TracedOperation, globalThis: *JSGlobalObject) bun.JSError!JSValue { + var obj = jsc.JSValue.createEmptyObject(globalThis, 6); + + // Return flags as integer (octal value) + obj.put( + globalThis, + bun.String.static("flags"), + jsc.JSValue.jsNumber(@as(i32, @intCast(this.flags))), + ); + + // cwd is always present + obj.put( + globalThis, + bun.String.static("cwd"), + bun.String.init(this.cwd).toJS(globalThis), + ); + + // Only set optional properties if they have values (otherwise undefined) + if (this.path) |p| { + obj.put( + globalThis, + bun.String.static("path"), + bun.String.init(p).toJS(globalThis), + ); + } + + if (this.command) |c| { + obj.put( + globalThis, + bun.String.static("command"), + bun.String.init(c).toJS(globalThis), + ); + } + + // Environment snapshot - only include if there are env vars + if (this.env.vars.count() > 0) { + obj.put( + globalThis, + bun.String.static("env"), + this.env.toJS(globalThis), + ); + } + + // Stream redirection (stdin, stdout, stderr) - only set if not none + if (this.stream != .none) { + obj.put( + globalThis, + bun.String.static("stream"), + this.stream.toJS(globalThis), + ); + } + + // Command arguments (for execute operations) + if (this.args) |args| { + const arr = try jsc.JSValue.createEmptyArray(globalThis, args.len); + for (args, 0..) |arg, i| { + try arr.putIndex(globalThis, @intCast(i), bun.String.init(arg).toJS(globalThis)); + } + obj.put(globalThis, bun.String.static("args"), arr); + } + + // Dynamic flag - only set if true + if (this.dynamic) { + obj.put( + globalThis, + bun.String.static("dynamic"), + .true, + ); + } + + return obj; + } +}; + +/// Result of tracing a shell script +pub const TraceResult = struct { + /// All traced operations + operations: std.array_list.Managed(TracedOperation), + /// The working directory + cwd: []const u8, + /// Whether tracing was successful + success: bool, + /// Error message if tracing failed + error_message: ?[]const u8, + /// Allocator used for this result + allocator: Allocator, + + pub fn init(allocator: Allocator, cwd: []const u8) TraceResult { + return .{ + .operations = std.array_list.Managed(TracedOperation).init(allocator), + .cwd = bun.handleOom(allocator.dupe(u8, cwd)), + .success = true, + .error_message = null, + .allocator = allocator, + }; + } + + pub fn deinit(this: *TraceResult) void { + for (this.operations.items) |*op| { + op.deinit(this.allocator); + } + this.operations.deinit(); + this.allocator.free(this.cwd); + if (this.error_message) |msg| { + this.allocator.free(msg); + } + } + + pub fn addOperation(this: *TraceResult, op: TracedOperation) void { + bun.handleOom(this.operations.append(op)); + } + + pub fn setError(this: *TraceResult, msg: []const u8) void { + this.success = false; + this.error_message = bun.handleOom(this.allocator.dupe(u8, msg)); + } + + pub fn toJS(this: *const TraceResult, globalThis: *JSGlobalObject) bun.JSError!JSValue { + var result_obj = jsc.JSValue.createEmptyObject(globalThis, 4); + + // Create operations array + const ops_array = try jsc.JSValue.createEmptyArray(globalThis, this.operations.items.len); + for (this.operations.items, 0..) |*op, i| { + const op_js = try op.toJS(globalThis); + try ops_array.putIndex(globalThis, @intCast(i), op_js); + } + result_obj.put(globalThis, bun.String.static("operations"), ops_array); + + // Add cwd + result_obj.put( + globalThis, + bun.String.static("cwd"), + bun.String.init(this.cwd).toJS(globalThis), + ); + + // Add success + result_obj.put( + globalThis, + bun.String.static("success"), + jsc.JSValue.jsBoolean(this.success), + ); + + // Add error if present + if (this.error_message) |msg| { + result_obj.put( + globalThis, + bun.String.static("error"), + bun.String.init(msg).toJS(globalThis), + ); + } else { + result_obj.put(globalThis, bun.String.static("error"), .null); + } + + return result_obj; + } +}; + +/// TraceContext holds state during trace interpretation. +/// Note: The allocator is stored because it's needed throughout traversal for allocating +/// strings, paths, etc. The result is a pointer because it's created before the context +/// and operations are added to it during traversal. +pub const TraceContext = struct { + /// Allocator used for all allocations during tracing + allocator: Allocator, + /// Output: traced operations are added here during traversal + result: *TraceResult, + /// Current working directory during trace (unmanaged, uses this.allocator) + cwd: std.ArrayListUnmanaged(u8), + /// Shell environment for variable expansion + shell_env: EnvMap, + /// Exported environment (for subprocess) - borrowed pointer, not owned (do not deinit) + export_env: ?*EnvMap, + /// Whether export_env is owned by us (should be freed on deinit) + owns_export_env: bool, + /// Accumulated traced environment variables (snapshot for each operation) + traced_env: bun.StringHashMapUnmanaged([]const u8), + /// Whether the current operation has dynamic (non-statically-analyzable) values + current_dynamic: bool, + /// JS objects from template literal interpolation, indexed by position + jsobjs: []JSValue, + globalThis: *JSGlobalObject, + + pub fn init( + allocator: Allocator, + result: *TraceResult, + cwd: []const u8, + export_env: ?*EnvMap, + jsobjs: []JSValue, + globalThis: *JSGlobalObject, + ) TraceContext { + var ctx = TraceContext{ + .allocator = allocator, + .result = result, + .cwd = .{}, + .shell_env = EnvMap.init(allocator), + .export_env = export_env, + .owns_export_env = false, // We borrow it, don't own it + .traced_env = .{}, + .current_dynamic = false, + .jsobjs = jsobjs, + .globalThis = globalThis, + }; + bun.handleOom(ctx.cwd.appendSlice(allocator, cwd)); + return ctx; + } + + pub fn deinit(this: *TraceContext) void { + this.cwd.deinit(this.allocator); + this.shell_env.deinit(); + // export_env is borrowed, not owned - never free it + // Free traced_env + var iter = this.traced_env.iterator(); + while (iter.next()) |entry| { + this.allocator.free(entry.key_ptr.*); + this.allocator.free(entry.value_ptr.*); + } + this.traced_env.deinit(this.allocator); + } + + /// Set an environment variable in the traced env + pub fn setTracedEnv(this: *TraceContext, name: []const u8, value: []const u8) void { + // If key already exists, free the old value + if (this.traced_env.get(name)) |old_val| { + this.allocator.free(old_val); + // Update in place + const key = this.traced_env.getKey(name).?; + this.traced_env.put(this.allocator, key, this.allocator.dupe(u8, value) catch return) catch return; + } else { + // New key + const key_copy = this.allocator.dupe(u8, name) catch return; + const val_copy = this.allocator.dupe(u8, value) catch { + this.allocator.free(key_copy); + return; + }; + this.traced_env.put(this.allocator, key_copy, val_copy) catch { + this.allocator.free(key_copy); + this.allocator.free(val_copy); + return; + }; + } + } + + /// Create a snapshot of the current traced environment + pub fn snapshotEnv(this: *TraceContext) EnvSnapshot { + var snapshot = EnvSnapshot.init(this.allocator); + var iter = this.traced_env.iterator(); + while (iter.next()) |entry| { + const key_copy = this.allocator.dupe(u8, entry.key_ptr.*) catch continue; + const val_copy = this.allocator.dupe(u8, entry.value_ptr.*) catch { + this.allocator.free(key_copy); + continue; + }; + snapshot.vars.put(this.allocator, key_copy, val_copy) catch { + this.allocator.free(key_copy); + this.allocator.free(val_copy); + continue; + }; + } + return snapshot; + } + + pub fn cwdSlice(this: *const TraceContext) []const u8 { + return this.cwd.items; + } + + pub fn resolvePath(this: *TraceContext, path: []const u8) []const u8 { + if (ResolvePath.Platform.auto.isAbsolute(path)) { + return bun.handleOom(this.allocator.dupe(u8, path)); + } + // Join with cwd + const parts: []const []const u8 = &.{ this.cwdSlice(), path }; + const joined = ResolvePath.joinZ(parts, .auto); + return bun.handleOom(this.allocator.dupe(u8, joined[0..joined.len])); + } + + pub fn addOperation(this: *TraceContext, flags: u32, path: ?[]const u8, command: ?[]const u8) void { + this.addOperationFull(flags, path, command, .none, null); + } + + pub fn addOperationWithStream(this: *TraceContext, flags: u32, path: ?[]const u8, command: ?[]const u8, stream: Stream) void { + this.addOperationFull(flags, path, command, stream, null); + } + + pub fn addOperationWithArgs(this: *TraceContext, flags: u32, path: ?[]const u8, command: ?[]const u8, args: ?[]const []const u8) void { + this.addOperationFull(flags, path, command, .none, args); + } + + pub fn addOperationFull(this: *TraceContext, flags: u32, path: ?[]const u8, command: ?[]const u8, stream: Stream, args: ?[]const []const u8) void { + const resolved_path = if (path) |p| this.resolvePath(p) else null; + + // Duplicate args array + const duped_args: ?[]const []const u8 = if (args) |a| blk: { + const arr = this.allocator.alloc([]const u8, a.len) catch break :blk null; + for (a, 0..) |arg, i| { + arr[i] = this.allocator.dupe(u8, arg) catch { + // Free already allocated + for (arr[0..i]) |prev| this.allocator.free(prev); + this.allocator.free(arr); + break :blk null; + }; + } + break :blk arr; + } else null; + + // Snapshot the current environment + const env_snapshot = this.snapshotEnv(); + + // Capture dynamic flag and reset it + const is_dynamic = this.current_dynamic; + this.current_dynamic = false; + + this.result.addOperation(.{ + .flags = flags, + .path = resolved_path, + .command = if (command) |c| bun.handleOom(this.allocator.dupe(u8, c)) else null, + .cwd = bun.handleOom(this.allocator.dupe(u8, this.cwdSlice())), + .env = env_snapshot, + .stream = stream, + .args = duped_args, + .dynamic = is_dynamic, + }); + } + + pub fn getVar(this: *TraceContext, name: []const u8) ?[]const u8 { + const key = EnvStr.initSlice(name); + if (this.shell_env.get(key)) |v| { + return v.slice(); + } + if (this.export_env) |env| { + if (env.get(key)) |v| { + return v.slice(); + } + } + return null; + } + + pub fn changeCwd(this: *TraceContext, new_cwd: []const u8) void { + // Just update the context's cwd - don't add an operation + // (the caller is responsible for adding the CHDIR operation if needed) + if (ResolvePath.Platform.auto.isAbsolute(new_cwd)) { + this.cwd.clearRetainingCapacity(); + bun.handleOom(this.cwd.appendSlice(this.allocator, new_cwd)); + } else { + // Join with current cwd and normalize (handles .. and .) + const parts: []const []const u8 = &.{ this.cwdSlice(), new_cwd }; + const joined = ResolvePath.joinZ(parts, .auto); + this.cwd.clearRetainingCapacity(); + bun.handleOom(this.cwd.appendSlice(this.allocator, joined[0..joined.len])); + } + } +}; + +// ============================================================================= +// AST Walking Functions +// ============================================================================= + +pub fn traceScript(ctx: *TraceContext, script: *const ast.Script) void { + for (script.stmts) |*stmt| { + traceStmt(ctx, stmt); + } +} + +fn traceStmt(ctx: *TraceContext, stmt: *const ast.Stmt) void { + // Stmt is a struct with exprs field, not a union + for (stmt.exprs) |*expr| { + traceExpr(ctx, expr); + } +} + +fn traceExpr(ctx: *TraceContext, expr: *const ast.Expr) void { + switch (expr.*) { + .cmd => |cmd| traceCmd(ctx, cmd), + .assign => |assigns| { + for (assigns) |*assign| { + traceAssign(ctx, assign); + } + }, + .binary => |binary| traceBinary(ctx, binary), + .pipeline => |pipeline| tracePipeline(ctx, pipeline), + .subshell => |subshell| traceSubshell(ctx, &subshell.script), + .@"if" => |if_clause| traceIfClause(ctx, if_clause), + .condexpr => |condexpr| traceCondExpr(ctx, condexpr), + .async => |async_expr| traceExpr(ctx, async_expr), + } +} + +fn traceSubshell(ctx: *TraceContext, script: *const ast.Script) void { + // Save current cwd - subshell changes shouldn't affect parent + const saved_cwd = bun.handleOom(ctx.allocator.dupe(u8, ctx.cwdSlice())); + defer ctx.allocator.free(saved_cwd); + + traceScript(ctx, script); + + // Restore cwd after subshell + ctx.cwd.clearRetainingCapacity(); + bun.handleOom(ctx.cwd.appendSlice(ctx.allocator, saved_cwd)); +} + +fn traceAssign(ctx: *TraceContext, assign: *const ast.Assign) void { + // Expand the value + const value = expandAtom(ctx, &assign.value); + defer ctx.allocator.free(value); + + // Set the env var in traced env + ctx.setTracedEnv(assign.label, value); + + // Add an ENV operation (the env snapshot will include this new var) + ctx.addOperation(Permission.ENV, null, null); +} + +fn traceBinary(ctx: *TraceContext, binary: *const ast.Binary) void { + traceExpr(ctx, &binary.left); + traceExpr(ctx, &binary.right); +} + +fn tracePipeline(ctx: *TraceContext, pipeline: *const ast.Pipeline) void { + for (pipeline.items) |*item| { + tracePipelineItem(ctx, item); + } +} + +fn tracePipelineItem(ctx: *TraceContext, item: *const ast.PipelineItem) void { + switch (item.*) { + .cmd => |cmd| traceCmd(ctx, cmd), + .assigns => |assigns| { + for (assigns) |*assign| { + traceAssign(ctx, assign); + } + }, + .subshell => |subshell| traceSubshell(ctx, &subshell.script), + .@"if" => |if_clause| traceIfClause(ctx, if_clause), + .condexpr => |condexpr| traceCondExpr(ctx, condexpr), + } +} + +fn traceIfClause(ctx: *TraceContext, if_clause: *const ast.If) void { + // Trace the condition statements + for (if_clause.cond.slice()) |*stmt| { + traceStmt(ctx, stmt); + } + // Trace the then branch statements + for (if_clause.then.slice()) |*stmt| { + traceStmt(ctx, stmt); + } + // Trace the else parts + // else_parts is a SmolList of SmolList(Stmt, 1) + // Length 0 = no else, length 1 = just else, length 2n = elif/then pairs, length 2n+1 = elif/then pairs + else + for (if_clause.else_parts.slice()) |*part| { + for (part.slice()) |*stmt| { + traceStmt(ctx, stmt); + } + } +} + +fn traceCondExpr(ctx: *TraceContext, cond: *const ast.CondExpr) void { + const op = cond.op; + // File test operators (single argument) + const is_file_test = op == .@"-e" or op == .@"-f" or op == .@"-d" or + op == .@"-r" or op == .@"-w" or op == .@"-x" or + op == .@"-s" or op == .@"-L" or op == .@"-h" or + op == .@"-b" or op == .@"-c" or op == .@"-g" or + op == .@"-k" or op == .@"-p" or op == .@"-u" or + op == .@"-O" or op == .@"-G" or op == .@"-S" or + op == .@"-a" or op == .@"-N"; + + // File comparison operators (two arguments) + const is_file_comparison = op == .@"-ef" or op == .@"-nt" or op == .@"-ot"; + + if (is_file_test or is_file_comparison) { + // Expand all arguments and add read operations for file paths + for (cond.args.slice()) |*arg| { + const path = expandAtom(ctx, arg); + if (path.len > 0) { + ctx.addOperation(Permission.READ, path, null); + } + ctx.allocator.free(path); + } + } +} + +/// Information about a command's redirections +const RedirectInfo = struct { + /// Path for stdin redirection (if any) + stdin_path: ?[]const u8 = null, + /// Path for stdout redirection (if any) + stdout_path: ?[]const u8 = null, + /// Flags for stdout redirection + stdout_flags: u32 = 0, + /// Path for stderr redirection (if any) + stderr_path: ?[]const u8 = null, + /// Flags for stderr redirection + stderr_flags: u32 = 0, +}; + +fn traceCmd(ctx: *TraceContext, cmd: *const ast.Cmd) void { + // First, trace any assignments + for (cmd.assigns) |*assign| { + traceAssign(ctx, assign); + } + + // Expand the command name and arguments + if (cmd.name_and_args.len == 0) { + return; + } + + const cmd_name = expandAtom(ctx, &cmd.name_and_args[0]); + defer ctx.allocator.free(cmd_name); + + if (cmd_name.len == 0) { + return; + } + + // Get redirection info first + const redir = getRedirectInfo(ctx, cmd); + defer { + if (redir.stdin_path) |p| ctx.allocator.free(p); + if (redir.stdout_path) |p| ctx.allocator.free(p); + if (redir.stderr_path) |p| ctx.allocator.free(p); + } + + // Check for known commands (builtins) and map them to permissions + // Use stringToEnum directly to recognize all known commands, even if they're + // disabled as builtins on this platform (e.g., cat/cp on POSIX) + if (std.meta.stringToEnum(Interpreter.Builtin.Kind, cmd_name)) |builtin_kind| { + traceBuiltin(ctx, builtin_kind, cmd, &redir); + } else { + // External command - needs execute permission + traceExternalCommand(ctx, cmd_name, cmd, &redir); + } +} + +/// Expand command arguments and extract file paths (skipping flags). +/// Returns a list of expanded file paths. Caller owns the returned memory. +/// Handles brace expansion ({a,b}.txt) and glob expansion (*.txt). +fn extractFileArgs(ctx: *TraceContext, cmd: *const ast.Cmd) std.array_list.Managed([]const u8) { + var file_args = std.array_list.Managed([]const u8).init(ctx.allocator); + + for (cmd.name_and_args[1..]) |*arg| { + var expanded_list = expandAtomMultiple(ctx, arg); + defer expanded_list.deinit(); + + for (expanded_list.items) |expanded| { + if (expanded.len > 0 and expanded[0] != '-') { + // Keep this path - transfer ownership + bun.handleOom(file_args.append(expanded)); + } else { + ctx.allocator.free(expanded); + } + } + } + + // Expand glob patterns (e.g., *.txt -> file1.txt, file2.txt) + expandGlobs(ctx, &file_args); + + return file_args; +} + +/// Free a list of file args +fn freeFileArgs(ctx: *TraceContext, file_args: *std.array_list.Managed([]const u8)) void { + for (file_args.items) |path| { + ctx.allocator.free(path); + } + file_args.deinit(); +} + +/// Add redirections as operations with stream info +fn traceRedirections(ctx: *TraceContext, redir: *const RedirectInfo) void { + if (redir.stdin_path) |stdin| { + ctx.addOperationWithStream(Permission.READ, stdin, null, .stdin); + } + if (redir.stdout_path) |out| { + ctx.addOperationWithStream(redir.stdout_flags, out, null, .stdout); + } + if (redir.stderr_path) |err_path| { + ctx.addOperationWithStream(redir.stderr_flags, err_path, null, .stderr); + } +} + +fn traceBuiltin(ctx: *TraceContext, kind: Interpreter.Builtin.Kind, cmd: *const ast.Cmd, redir: *const RedirectInfo) void { + // Builtins run in-process, so they don't need EXECUTE permission on a binary. + // We only trace the file operations they perform. + + switch (kind) { + .cat => { + // cat reads files and writes to stdout (or redirect) + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + for (file_args.items) |path| { + ctx.addOperation(Permission.READ, path, null); + } + traceRedirections(ctx, redir); + }, + .touch => { + // touch creates/modifies files + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + for (file_args.items) |path| { + ctx.addOperation(Permission.CREATE, path, null); + } + }, + .mkdir => { + // mkdir creates directories + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + for (file_args.items) |path| { + ctx.addOperation(Permission.MKDIR, path, null); + } + }, + .rm => { + // rm deletes files/directories + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + for (file_args.items) |path| { + ctx.addOperation(Permission.DELETE, path, null); + } + }, + .mv => { + // mv moves files (read+delete source, create dest) + // Handles: mv src dest OR mv src1 src2 ... dest_dir/ + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + if (file_args.items.len >= 2) { + const dest = file_args.items[file_args.items.len - 1]; + // All but the last arg are sources + for (file_args.items[0 .. file_args.items.len - 1]) |src| { + ctx.addOperation(Permission.READ | Permission.DELETE, src, null); + } + ctx.addOperation(Permission.CREATE, dest, null); + } else if (file_args.items.len == 1) { + // Just one arg - read it (mv will fail but we trace the access) + ctx.addOperation(Permission.READ | Permission.DELETE, file_args.items[0], null); + } + }, + .cp => { + // cp copies files (read source, create dest) + // Handles: cp src dest OR cp src1 src2 ... dest_dir/ + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + if (file_args.items.len >= 2) { + const dest = file_args.items[file_args.items.len - 1]; + // All but the last arg are sources + for (file_args.items[0 .. file_args.items.len - 1]) |src| { + ctx.addOperation(Permission.READ, src, null); + } + ctx.addOperation(Permission.CREATE, dest, null); + } else if (file_args.items.len == 1) { + // Just one arg - read it (cp will fail but we trace the access) + ctx.addOperation(Permission.READ, file_args.items[0], null); + } + }, + .ls => { + // ls reads directory contents and writes to stdout (or redirect) + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + if (file_args.items.len == 0) { + // ls with no args reads current directory + ctx.addOperation(Permission.READ, ".", null); + } else { + for (file_args.items) |path| { + ctx.addOperation(Permission.READ, path, null); + } + } + traceRedirections(ctx, redir); + }, + .cd => { + // cd changes directory - takes first non-flag arg + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + if (file_args.items.len >= 1) { + ctx.addOperation(Permission.CHDIR, file_args.items[0], null); + // Actually update the context's cwd for subsequent commands + ctx.changeCwd(file_args.items[0]); + } + }, + .@"export" => { + // export sets environment variables + // Parse arguments like FOO=bar or just FOO + var file_args = extractFileArgs(ctx, cmd); + defer freeFileArgs(ctx, &file_args); + + for (file_args.items) |arg| { + // Look for = sign + if (std.mem.indexOfScalar(u8, arg, '=')) |eq_idx| { + const name = arg[0..eq_idx]; + const value = arg[eq_idx + 1 ..]; + ctx.setTracedEnv(name, value); + } else { + // Just exporting existing var - set to empty if not already set + if (ctx.traced_env.get(arg) == null) { + ctx.setTracedEnv(arg, ""); + } + } + } + // Add ENV operation after setting all vars + if (file_args.items.len > 0) { + ctx.addOperation(Permission.ENV, null, null); + } + }, + .echo, .pwd, .which, .yes, .seq, .dirname, .basename => { + // These only write to stdout (or redirect) - no file reads + traceRedirections(ctx, redir); + }, + .exit, .true, .false => { + // These don't access any files + }, + } +} + +fn traceExternalCommand(ctx: *TraceContext, cmd_name: []const u8, cmd: *const ast.Cmd, redir: *const RedirectInfo) void { + // Resolve the command path using which + // Get PATH from environment + const path_env = ctx.getVar("PATH") orelse "/usr/bin:/bin"; + var path_buf: bun.PathBuffer = undefined; + const resolved = which(&path_buf, path_env, ctx.cwdSlice(), cmd_name); + + // Collect arguments (skip the command name itself) + var args_list = std.array_list.Managed([]const u8).init(ctx.allocator); + defer args_list.deinit(); + + if (cmd.name_and_args.len > 1) { + for (cmd.name_and_args[1..]) |*arg| { + const expanded = expandAtom(ctx, arg); + args_list.append(expanded) catch {}; + } + } + + const args: ?[]const []const u8 = if (args_list.items.len > 0) args_list.items else null; + + // Record the command execution with args + if (resolved) |exe_path| { + ctx.addOperationWithArgs(Permission.EXECUTE, exe_path, cmd_name, args); + } else { + // Command not found, but still record the execute attempt + ctx.addOperationWithArgs(Permission.EXECUTE, null, cmd_name, args); + } + + // Free the expanded args (they were duped in addOperationWithArgs) + for (args_list.items) |arg| { + ctx.allocator.free(arg); + } + + // Handle stdin redirection + if (redir.stdin_path) |stdin| { + ctx.addOperationWithStream(Permission.READ, stdin, null, .stdin); + } + + // Handle stdout redirection + if (redir.stdout_path) |out| { + ctx.addOperationWithStream(redir.stdout_flags, out, null, .stdout); + } + + // Handle stderr redirection + if (redir.stderr_path) |err_path| { + ctx.addOperationWithStream(redir.stderr_flags, err_path, null, .stderr); + } +} + +fn getRedirectInfo(ctx: *TraceContext, cmd: *const ast.Cmd) RedirectInfo { + var info = RedirectInfo{}; + + if (cmd.redirect_file) |redirect| { + switch (redirect) { + .atom => |*atom| { + const path = expandAtom(ctx, atom); + if (path.len > 0) { + if (cmd.redirect.stdin) { + info.stdin_path = path; + } else { + const flags = if (cmd.redirect.append) Permission.APPEND else Permission.CREATE_TRUNC; + // Handle stdout and stderr separately + if (cmd.redirect.stdout and cmd.redirect.stderr) { + // &> or similar - both go to same file + info.stdout_path = path; + info.stdout_flags = flags; + // Also set stderr to same path (duplicate the path) + info.stderr_path = bun.handleOom(ctx.allocator.dupe(u8, path)); + info.stderr_flags = flags; + } else if (cmd.redirect.stdout) { + info.stdout_path = path; + info.stdout_flags = flags; + } else if (cmd.redirect.stderr) { + info.stderr_path = path; + info.stderr_flags = flags; + } else { + ctx.allocator.free(path); + } + } + } else { + ctx.allocator.free(path); + } + }, + .jsbuf => { + // JS buffer redirections don't involve file paths + }, + } + } + + return info; +} + +// ============================================================================= +// Expansion (simplified for tracing) +// ============================================================================= + +/// Expand an atom, potentially returning multiple strings due to brace expansion. +/// Returns a list of expanded strings. Caller owns the memory. +fn expandAtomMultiple(ctx: *TraceContext, atom: *const ast.Atom) std.array_list.Managed([]const u8) { + var result = std.array_list.Managed(u8).init(ctx.allocator); + var has_braces = false; + + switch (atom.*) { + .simple => |*simple| { + if (simple.* == .brace_begin) has_braces = true; + expandSimple(ctx, simple, &result); + }, + .compound => |compound| { + for (compound.atoms) |*simple| { + if (simple.* == .brace_begin) has_braces = true; + expandSimple(ctx, simple, &result); + } + }, + } + + const expanded_str = result.toOwnedSlice() catch ""; + + // If there are braces, expand them + if (has_braces and expanded_str.len > 0) { + const expanded = expandBraces(ctx, expanded_str); + ctx.allocator.free(expanded_str); + return expanded; + } + + // No braces - return single result + var out = std.array_list.Managed([]const u8).init(ctx.allocator); + if (expanded_str.len > 0) { + bun.handleOom(out.append(expanded_str)); + } else { + ctx.allocator.free(expanded_str); + } + return out; +} + +/// Expand brace patterns like {a,b,c} into multiple strings +fn expandBraces(ctx: *TraceContext, input: []const u8) std.array_list.Managed([]const u8) { + // Use the shared brace expansion helper + const unmanaged = Braces.expandBracesAlloc(input, ctx.allocator); + return .{ .items = unmanaged.items, .capacity = unmanaged.capacity, .allocator = ctx.allocator }; +} + +/// Expand glob patterns like *.txt into matching file paths +fn expandGlobs(ctx: *TraceContext, patterns: *std.array_list.Managed([]const u8)) void { + var i: usize = 0; + while (i < patterns.items.len) { + const pattern = patterns.items[i]; + + // Check if this pattern contains glob syntax + if (!bun.glob.detectGlobSyntax(pattern)) { + i += 1; + continue; + } + + // This pattern has glob syntax - expand it + var arena = std.heap.ArenaAllocator.init(ctx.allocator); + defer arena.deinit(); + + var walker: GlobWalker = .{}; + const init_result = walker.initWithCwd( + &arena, + pattern, + ctx.cwdSlice(), + false, // dot + true, // absolute (return absolute paths) + false, // follow_symlinks + false, // error_on_broken_symlinks + false, // only_files (include directories too) + ) catch { + i += 1; + continue; + }; + + switch (init_result) { + .err => { + i += 1; + continue; + }, + .result => {}, + } + + var iter: GlobWalker.Iterator = .{ .walker = &walker }; + const iter_init = iter.init() catch { + i += 1; + continue; + }; + switch (iter_init) { + .err => { + i += 1; + continue; + }, + .result => {}, + } + + // Collect all matched paths + var matched_paths = std.array_list.Managed([]const u8).init(ctx.allocator); + while (true) { + const next_result = iter.next() catch break; + switch (next_result) { + .err => break, + .result => |maybe_path| { + if (maybe_path) |path| { + // Dupe the path since it's owned by the arena + const duped = ctx.allocator.dupe(u8, path) catch break; + matched_paths.append(duped) catch { + ctx.allocator.free(duped); + break; + }; + } else { + // No more matches + break; + } + }, + } + } + + // If we found matches, replace the pattern with matched paths + if (matched_paths.items.len > 0) { + // Free the original pattern + ctx.allocator.free(pattern); + + // Remove the pattern from the list + _ = patterns.orderedRemove(i); + + // Insert all matched paths at position i + for (matched_paths.items) |matched_path| { + patterns.insert(i, matched_path) catch { + ctx.allocator.free(matched_path); + continue; + }; + i += 1; + } + matched_paths.deinit(); + } else { + // No matches - keep original pattern + matched_paths.deinit(); + i += 1; + } + } +} + +/// Expand an atom to a single string (for backward compatibility). +/// For brace expansions, only returns the first result. +fn expandAtom(ctx: *TraceContext, atom: *const ast.Atom) []const u8 { + var results = expandAtomMultiple(ctx, atom); + defer { + // Free all but the first + if (results.items.len > 1) { + for (results.items[1..]) |s| { + ctx.allocator.free(s); + } + } + results.deinit(); + } + + if (results.items.len > 0) { + return results.items[0]; + } + return bun.handleOom(ctx.allocator.dupe(u8, "")); +} + +fn expandSimple(ctx: *TraceContext, simple: *const ast.SimpleAtom, out: *std.array_list.Managed(u8)) void { + switch (simple.*) { + .Text => |text| { + bun.handleOom(out.appendSlice(text)); + }, + .Var => |varname| { + if (ctx.getVar(varname)) |val| { + bun.handleOom(out.appendSlice(val)); + } + }, + .VarArgv => { + // Special variables like $1, $@, etc. depend on runtime args + ctx.current_dynamic = true; + }, + .cmd_subst => { + // Command substitutions can't be statically analyzed + // Mark as dynamic and skip the actual substitution + ctx.current_dynamic = true; + }, + .asterisk => { + // Glob pattern - output as literal for tracing + bun.handleOom(out.appendSlice("*")); + }, + .double_asterisk => { + // Glob pattern - output as literal for tracing + bun.handleOom(out.appendSlice("**")); + }, + .brace_begin => { + bun.handleOom(out.appendSlice("{")); + }, + .brace_end => { + bun.handleOom(out.appendSlice("}")); + }, + .comma => { + bun.handleOom(out.appendSlice(",")); + }, + .tilde => { + // Expand tilde to home directory + if (ctx.getVar("HOME")) |home| { + bun.handleOom(out.appendSlice(home)); + } else { + bun.handleOom(out.appendSlice("~")); + } + }, + } +} + +// ============================================================================= +// Public API +// ============================================================================= + +/// Trace a shell script and return the trace result +pub fn trace( + allocator: Allocator, + shargs: *ShellArgs, + jsobjs: []JSValue, + export_env: ?*EnvMap, + cwd: ?[]const u8, + globalThis: *JSGlobalObject, +) TraceResult { + // Get current working directory + var cwd_buf: bun.PathBuffer = undefined; + const current_cwd = cwd orelse brk: { + const result = bun.sys.getcwdZ(&cwd_buf); + switch (result) { + .result => |c| break :brk c[0..c.len], + .err => break :brk "/", + } + }; + + var result = TraceResult.init(allocator, current_cwd); + var ctx = TraceContext.init(allocator, &result, current_cwd, export_env, jsobjs, globalThis); + defer ctx.deinit(); + + traceScript(&ctx, &shargs.script_ast); + + return result; +} + +/// JavaScript-callable function to trace a shell script +pub fn traceShellScript(globalThis: *JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!JSValue { + const allocator = bun.default_allocator; + const parsed_shell_script_js = callframe.argumentsAsArray(1)[0]; + if (parsed_shell_script_js.isUndefined()) { + return globalThis.throw("trace: expected a ParsedShellScript", .{}); + } + + const parsed_shell_script = jsc.Codegen.JSParsedShellScript.fromJS(parsed_shell_script_js) orelse { + return globalThis.throw("trace: expected a ParsedShellScript", .{}); + }; + + if (parsed_shell_script.args == null) { + return globalThis.throw("trace: shell args is null", .{}); + } + + const shargs = parsed_shell_script.args.?; + const jsobjs = parsed_shell_script.jsobjs.items; + + // Get cwd from parsed script if set + var cwd_utf8: ?bun.ZigString.Slice = null; + defer if (cwd_utf8) |*utf8| utf8.deinit(); + + const cwd_slice: ?[]const u8 = if (parsed_shell_script.cwd) |c| blk: { + cwd_utf8 = c.toUTF8(bun.default_allocator); + break :blk cwd_utf8.?.slice(); + } else null; + + var result = trace( + allocator, + shargs, + jsobjs, + if (parsed_shell_script.export_env != null) &parsed_shell_script.export_env.? else null, + cwd_slice, + globalThis, + ); + defer result.deinit(); + + return result.toJS(globalThis); +} + +const std = @import("std"); +const Allocator = std.mem.Allocator; + +const bun = @import("bun"); +const ResolvePath = bun.path; +const which = bun.which; +const GlobWalker = bun.glob.BunGlobWalker; + +const jsc = bun.jsc; +const JSGlobalObject = jsc.JSGlobalObject; +const JSValue = jsc.JSValue; + +const shell = bun.shell; +const EnvMap = shell.EnvMap; +const EnvStr = shell.EnvStr; +const Interpreter = shell.Interpreter; +const ast = shell.AST; + +const Braces = shell.interpret.Braces; +const ShellArgs = shell.interpret.ShellArgs; diff --git a/src/shell/braces.zig b/src/shell/braces.zig index 3f9ef5cf6c95b2..832adab71aeea0 100644 --- a/src/shell/braces.zig +++ b/src/shell/braces.zig @@ -723,6 +723,68 @@ test Lexer { } } +/// High-level helper that expands brace patterns in a string. +/// Returns a list of expanded strings. Caller owns the returned memory. +/// On error or if no expansion is needed, returns the input as a single-element list. +pub fn expandBracesAlloc(input: []const u8, allocator: Allocator) std.ArrayListUnmanaged([]const u8) { + var out: std.ArrayListUnmanaged([]const u8) = .{}; + + // Use arena for temporary tokenization + var arena = std.heap.ArenaAllocator.init(allocator); + defer arena.deinit(); + const arena_alloc = arena.allocator(); + + // Tokenize - use appropriate lexer based on content + const lexer_output = if (bun.strings.isAllASCII(input)) + Lexer.tokenize(arena_alloc, input) catch { + out.append(allocator, allocator.dupe(u8, input) catch return out) catch {}; + return out; + } + else + NewLexer(.wtf8).tokenize(arena_alloc, input) catch { + out.append(allocator, allocator.dupe(u8, input) catch return out) catch {}; + return out; + }; + + const expansion_count = calculateExpandedAmount(lexer_output.tokens.items[0..]); + if (expansion_count == 0) { + out.append(allocator, allocator.dupe(u8, input) catch return out) catch {}; + return out; + } + + // Allocate expanded strings + const expanded_strings = arena_alloc.alloc(std.array_list.Managed(u8), expansion_count) catch { + out.append(allocator, allocator.dupe(u8, input) catch return out) catch {}; + return out; + }; + + for (0..expansion_count) |i| { + expanded_strings[i] = std.array_list.Managed(u8).init(allocator); + } + + // Perform brace expansion + expand( + arena_alloc, + lexer_output.tokens.items[0..], + expanded_strings, + lexer_output.contains_nested, + ) catch { + for (expanded_strings) |*s| s.deinit(); + out.append(allocator, allocator.dupe(u8, input) catch return out) catch {}; + return out; + }; + + // Collect results + for (expanded_strings) |*s| { + const slice = s.toOwnedSlice() catch ""; + if (slice.len > 0) { + out.append(allocator, slice) catch {}; + } + } + + return out; +} + const SmolStr = @import("../string.zig").SmolStr; const Encoding = @import("./shell.zig").StringEncoding; diff --git a/src/shell/shell.zig b/src/shell/shell.zig index 8243f63bb67a5d..83e720948535bc 100644 --- a/src/shell/shell.zig +++ b/src/shell/shell.zig @@ -2,6 +2,7 @@ pub const interpret = @import("./interpreter.zig"); pub const subproc = @import("./subproc.zig"); pub const AllocScope = @import("./AllocScope.zig"); +pub const TraceInterpreter = @import("./TraceInterpreter.zig"); pub const EnvMap = interpret.EnvMap; pub const EnvStr = interpret.EnvStr; @@ -3918,6 +3919,12 @@ pub fn handleTemplateValue( if (store.data == .file) { if (store.data.file.pathlike == .path) { const path = store.data.file.pathlike.path.slice(); + + // Check for null bytes in path (security: prevent null byte injection) + if (bun.strings.indexOfChar(path, 0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received {f}", .{bun.fmt.quote(path)}).throw(); + } + if (!try builder.appendUTF8(path, true)) { return globalThis.throw("Shell script string contains invalid UTF-16", .{}); } @@ -3983,6 +3990,12 @@ pub fn handleTemplateValue( if (try template_value.getOwnTruthy(globalThis, "raw")) |maybe_str| { const bunstr = try maybe_str.toBunString(globalThis); defer bunstr.deref(); + + // Check for null bytes in shell argument (security: prevent null byte injection) + if (bunstr.indexOfAsciiChar(0) != null) { + return globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toZigString()}).throw(); + } + if (!try builder.appendBunStr(bunstr, false)) { return globalThis.throw("Shell script string contains invalid UTF-16", .{}); } @@ -4032,6 +4045,11 @@ pub const ShellSrcBuilder = struct { const bunstr = try jsval.toBunString(this.globalThis); defer bunstr.deref(); + // Check for null bytes in shell argument (security: prevent null byte injection) + if (bunstr.indexOfAsciiChar(0) != null) { + return this.globalThis.ERR(.INVALID_ARG_VALUE, "The shell argument must be a string without null bytes. Received \"{f}\"", .{bunstr.toZigString()}).throw(); + } + return try this.appendBunStr(bunstr, allow_escape); } diff --git a/src/sql/mysql/MySQLTypes.zig b/src/sql/mysql/MySQLTypes.zig index 0280718592e2f0..a4efe2fdba2261 100644 --- a/src/sql/mysql/MySQLTypes.zig +++ b/src/sql/mysql/MySQLTypes.zig @@ -486,7 +486,8 @@ pub const Value = union(enum) { .MYSQL_TYPE_JSON => { var str: bun.String = bun.String.empty; - try value.jsonStringify(globalObject, 0, &str); + // Use jsonStringifyFast for SIMD-optimized serialization + try value.jsonStringifyFast(globalObject, &str); defer str.deref(); return Value{ .string = str.toUTF8(bun.default_allocator) }; }, diff --git a/src/sql/postgres/PostgresRequest.zig b/src/sql/postgres/PostgresRequest.zig index 775ab536c9c2e6..c06bc28c198893 100644 --- a/src/sql/postgres/PostgresRequest.zig +++ b/src/sql/postgres/PostgresRequest.zig @@ -101,7 +101,8 @@ pub fn writeBind( .jsonb, .json => { var str = bun.String.empty; defer str.deref(); - try value.jsonStringify(globalObject, 0, &str); + // Use jsonStringifyFast for SIMD-optimized serialization + try value.jsonStringifyFast(globalObject, &str); const slice = str.toUTF8WithoutRef(bun.default_allocator); defer slice.deinit(); const l = try writer.length(); diff --git a/src/vm/SigintWatcher.h b/src/vm/SigintWatcher.h index dbdf33c1c4441d..6cb033fb49c29d 100644 --- a/src/vm/SigintWatcher.h +++ b/src/vm/SigintWatcher.h @@ -54,7 +54,7 @@ class SigintWatcher { GlobalObjectHolder(const GlobalObjectHolder&) = delete; GlobalObjectHolder(GlobalObjectHolder&& other) : m_globalObject(std::exchange(other.m_globalObject, nullptr)) - , m_receivers(WTFMove(other.m_receivers)) + , m_receivers(WTF::move(other.m_receivers)) { } @@ -62,7 +62,7 @@ class SigintWatcher { GlobalObjectHolder& operator=(GlobalObjectHolder&& other) { m_globalObject = std::exchange(other.m_globalObject, nullptr); - m_receivers = WTFMove(other.m_receivers); + m_receivers = WTF::move(other.m_receivers); return *this; } diff --git a/test/cli/run/filter-workspace.test.ts b/test/cli/run/filter-workspace.test.ts index 8a6b064a774d72..42bd082cf791d4 100644 --- a/test/cli/run/filter-workspace.test.ts +++ b/test/cli/run/filter-workspace.test.ts @@ -275,7 +275,10 @@ describe("bun", () => { test("respect dependency order", () => { const dir = tempDirWithFiles("testworkspace", { dep0: { - "index.js": "Bun.write('out.txt', 'success')", + "index.js": [ + "await new Promise((resolve) => setTimeout(resolve, 100))", + "Bun.write('out.txt', 'success')", + ].join(";"), "package.json": JSON.stringify({ name: "dep0", scripts: { @@ -305,6 +308,44 @@ describe("bun", () => { }); }); + test("respect dependency order when dependency name is larger than 8 characters", () => { + const largeNamePkgName = "larger-than-8-char"; + const fileContent = `${largeNamePkgName} - ${new Date().getTime()}`; + const largeNamePkg = { + "index.js": [ + "await new Promise((resolve) => setTimeout(resolve, 100))", + `Bun.write('out.txt', '${fileContent}')`, + ].join(";"), + "package.json": JSON.stringify({ + name: largeNamePkgName, + scripts: { + script: `${bunExe()} run index.js`, + }, + }), + }; + const dir = tempDirWithFiles("testworkspace", { + main: { + "index.js": `console.log(await Bun.file("../${largeNamePkgName}/out.txt").text())`, + "package.json": JSON.stringify({ + name: "main", + dependencies: { + [largeNamePkgName]: "*", + }, + scripts: { + script: `${bunExe()} run index.js`, + }, + }), + }, + [largeNamePkgName]: largeNamePkg, + }); + runInCwdSuccess({ + cwd: dir, + pattern: "*", + target_pattern: [new RegExp(fileContent)], + command: ["script"], + }); + }); + test("ignore dependency order on cycle, preserving pre and post script order", () => { const dir = tempDirWithFiles("testworkspace", { dep0: { diff --git a/test/js/bun/resolve/load-same-js-file-a-lot.test.ts b/test/js/bun/resolve/load-same-js-file-a-lot.test.ts index cea9a08290af3b..2fbd4699b6d94b 100644 --- a/test/js/bun/resolve/load-same-js-file-a-lot.test.ts +++ b/test/js/bun/resolve/load-same-js-file-a-lot.test.ts @@ -1,8 +1,11 @@ import { expect, test } from "bun:test"; -import { isDebug } from "harness"; +import { isASAN, isDebug } from "harness"; + +const asanIsSlowMultiplier = isASAN ? 0.2 : 1; +const count = Math.floor(10000 * asanIsSlowMultiplier); test( - "load the same file 10,000 times", + `load the same file ${count} times`, async () => { const meta = { url: import.meta.url.toLocaleLowerCase().replace(".test.ts", ".js"), @@ -14,7 +17,7 @@ test( }; const prev = Bun.unsafe.gcAggressionLevel(); Bun.unsafe.gcAggressionLevel(0); - for (let i = 0; i < 10000; i++) { + for (let i = 0; i < count; i++) { const { default: { url, dir, file, path, dirname, filename }, } = await import("./load-same-js-file-a-lot.js?i=" + i); @@ -28,13 +31,13 @@ test( Bun.gc(true); Bun.unsafe.gcAggressionLevel(prev); }, - isDebug ? 20_000 : 5000, + isDebug || isASAN ? 20_000 : 5000, ); -test("load the same empty JS file 10,000 times", async () => { +test(`load the same empty JS file ${count} times`, async () => { const prev = Bun.unsafe.gcAggressionLevel(); Bun.unsafe.gcAggressionLevel(0); - for (let i = 0; i < 10000; i++) { + for (let i = 0; i < count; i++) { const { default: obj } = await import("./load-same-empty-js-file-a-lot.js?i=" + i); expect(obj).toEqual({}); } diff --git a/test/js/bun/shell/trace.test.ts b/test/js/bun/shell/trace.test.ts new file mode 100644 index 00000000000000..41808088be6719 --- /dev/null +++ b/test/js/bun/shell/trace.test.ts @@ -0,0 +1,417 @@ +import { $ } from "bun"; +import { describe, expect, test } from "bun:test"; +import { tempDir } from "harness"; + +// Normalize path separators for cross-platform tests +const normalizePath = (p: string) => p.replaceAll("\\", "/"); + +// Permission flags (octal) - mirrors the Zig constants +const Permission = { + O_RDONLY: 0o0, + O_WRONLY: 0o1, + O_RDWR: 0o2, + O_CREAT: 0o100, + O_EXCL: 0o200, + O_TRUNC: 0o1000, + O_APPEND: 0o2000, + X_OK: 0o100000, + DELETE: 0o200000, + MKDIR: 0o400000, + CHDIR: 0o1000000, + ENV: 0o2000000, +} as const; + +// Convenience combinations +const READ = Permission.O_RDONLY; +const WRITE = Permission.O_WRONLY; +const CREATE = Permission.O_CREAT | Permission.O_WRONLY; +const CREATE_TRUNC = Permission.O_CREAT | Permission.O_TRUNC | Permission.O_WRONLY; +const APPEND = Permission.O_APPEND | Permission.O_WRONLY; +const EXECUTE = Permission.X_OK; + +describe("Bun.$.trace", () => { + test("returns trace result object", () => { + const result = $.trace`echo hello`; + expect(result).toHaveProperty("operations"); + expect(result).toHaveProperty("cwd"); + expect(result).toHaveProperty("success"); + expect(result).toHaveProperty("error"); + expect(result.success).toBe(true); + expect(result.error).toBeNull(); + expect(Array.isArray(result.operations)).toBe(true); + }); + + test("traces echo command (builtin, no file access)", () => { + const result = $.trace`echo hello world`; + expect(result.success).toBe(true); + + // echo is a builtin that runs in-process - no file access, no operations + // It just writes to stdout (terminal) which doesn't require any permissions + expect(result.operations.length).toBe(0); + }); + + test("traces cat command with file read", () => { + const result = $.trace`cat /tmp/test.txt`; + expect(result.success).toBe(true); + + // cat is a builtin - it reads files but runs in-process (no EXECUTE) + const readOps = result.operations.filter(op => op.flags === READ && op.path?.endsWith("test.txt")); + expect(readOps.length).toBe(1); + expect(normalizePath(readOps[0].path!)).toBe("/tmp/test.txt"); + }); + + test("traces rm command with delete permission", () => { + const result = $.trace`rm /tmp/to-delete.txt`; + expect(result.success).toBe(true); + + // Should have delete for the file + const deleteOps = result.operations.filter(op => op.flags === Permission.DELETE); + expect(deleteOps.length).toBe(1); + expect(normalizePath(deleteOps[0].path!)).toBe("/tmp/to-delete.txt"); + }); + + test("traces mkdir command", () => { + const result = $.trace`mkdir /tmp/newdir`; + expect(result.success).toBe(true); + + // Should have mkdir permission + const mkdirOps = result.operations.filter(op => op.flags === Permission.MKDIR); + expect(mkdirOps.length).toBe(1); + expect(normalizePath(mkdirOps[0].path!)).toBe("/tmp/newdir"); + }); + + test("traces touch command with create permission", () => { + const result = $.trace`touch /tmp/newfile.txt`; + expect(result.success).toBe(true); + + // Should have create permission + const createOps = result.operations.filter(op => op.flags === CREATE); + expect(createOps.length).toBe(1); + expect(normalizePath(createOps[0].path!)).toBe("/tmp/newfile.txt"); + }); + + test("traces cp command with read and write", () => { + const result = $.trace`cp /tmp/src.txt /tmp/dst.txt`; + expect(result.success).toBe(true); + + // Should have read for source + const readOps = result.operations.filter(op => op.flags === READ && op.path?.endsWith("src.txt")); + expect(readOps.length).toBe(1); + + // Should have create for destination + const writeOps = result.operations.filter(op => op.flags === CREATE && op.path?.endsWith("dst.txt")); + expect(writeOps.length).toBe(1); + }); + + test("traces mv command with read, delete, and write", () => { + const result = $.trace`mv /tmp/old.txt /tmp/new.txt`; + expect(result.success).toBe(true); + + // Should have read+delete for source (combined in one operation) + const srcOps = result.operations.filter( + op => op.flags === (READ | Permission.DELETE) && op.path?.endsWith("old.txt"), + ); + expect(srcOps.length).toBe(1); + + // Should have create for destination + const dstOps = result.operations.filter(op => op.flags === CREATE && op.path?.endsWith("new.txt")); + expect(dstOps.length).toBe(1); + }); + + test("traces cd command with chdir permission", () => { + const result = $.trace`cd /tmp`; + expect(result.success).toBe(true); + + const chdirOps = result.operations.filter(op => op.flags === Permission.CHDIR); + expect(chdirOps.length).toBe(1); + expect(normalizePath(chdirOps[0].path!)).toBe("/tmp"); + }); + + test("traces environment variable assignments with accumulated env", () => { + const result = $.trace`FOO=1 BAR=2 echo test`; + expect(result.success).toBe(true); + + const envOps = result.operations.filter(op => op.flags === Permission.ENV); + expect(envOps.length).toBe(2); + // First op has FOO + expect(envOps[0].env).toEqual({ FOO: "1" }); + // Second op has both FOO and BAR + expect(envOps[1].env?.FOO).toBe("1"); + expect(envOps[1].env?.BAR).toBe("2"); + }); + + test("traces export with env values", () => { + const result = $.trace`export FOO=hello BAR=world`; + expect(result.success).toBe(true); + + const envOps = result.operations.filter(op => op.flags === Permission.ENV); + expect(envOps.length).toBe(1); + expect(envOps[0].env?.FOO).toBe("hello"); + expect(envOps[0].env?.BAR).toBe("world"); + }); + + test("traces output redirection combined with command", () => { + const result = $.trace`echo hello > /tmp/output.txt`; + expect(result.success).toBe(true); + + // echo is a builtin - redirect creates the output file (CREATE_TRUNC, no EXECUTE) + const redirectOps = result.operations.filter(op => op.flags === CREATE_TRUNC && op.path?.endsWith("output.txt")); + expect(redirectOps.length).toBe(1); + }); + + test("traces append redirection combined with command", () => { + const result = $.trace`echo hello >> /tmp/append.txt`; + expect(result.success).toBe(true); + + // echo is a builtin - append redirect opens file for appending (no EXECUTE) + const appendOps = result.operations.filter(op => op.flags === APPEND && op.path?.endsWith("append.txt")); + expect(appendOps.length).toBe(1); + }); + + test("traces input redirection with read and stdin stream", () => { + const result = $.trace`cat < /tmp/input.txt`; + expect(result.success).toBe(true); + + // Should have read for input file with stdin stream marker + const stdinOps = result.operations.filter( + op => op.flags === READ && op.path?.endsWith("input.txt") && op.stream === "stdin", + ); + expect(stdinOps.length).toBe(1); + }); + + test("traces stderr redirection with stream marker", () => { + const result = $.trace`cat /nonexistent 2> /tmp/err.txt`; + expect(result.success).toBe(true); + + // Should have stderr stream for error redirect + const stderrOps = result.operations.filter(op => op.stream === "stderr" && op.path?.endsWith("err.txt")); + expect(stderrOps.length).toBe(1); + expect(stderrOps[0].flags).toBe(CREATE_TRUNC); + }); + + test("stdout redirect has stream marker", () => { + const result = $.trace`echo hello > /tmp/out.txt`; + expect(result.success).toBe(true); + + const stdoutOps = result.operations.filter(op => op.stream === "stdout"); + expect(stdoutOps.length).toBe(1); + expect(normalizePath(stdoutOps[0].path!)).toBe("/tmp/out.txt"); + }); + + test("traces export command with env permission", () => { + const result = $.trace`export FOO=bar`; + expect(result.success).toBe(true); + + const envOps = result.operations.filter(op => op.flags === Permission.ENV); + expect(envOps.length).toBeGreaterThan(0); + }); + + test("traces variable assignment with env permission", () => { + const result = $.trace`FOO=bar echo $FOO`; + expect(result.success).toBe(true); + + const envOps = result.operations.filter(op => op.flags === Permission.ENV); + expect(envOps.length).toBeGreaterThan(0); + }); + + test("traces pipeline", () => { + const result = $.trace`cat /tmp/file.txt | grep pattern`; + expect(result.success).toBe(true); + + // cat is a builtin - reads file (no EXECUTE, no command field) + const readOps = result.operations.filter(op => op.flags === READ && op.path?.endsWith("file.txt")); + expect(readOps.length).toBe(1); + + // grep is external, should have execute permission and command field + const grepOps = result.operations.filter(op => op.command === "grep" && (op.flags & EXECUTE) !== 0); + expect(grepOps.length).toBe(1); + }); + + test("traces ls with directory read", () => { + const result = $.trace`ls /tmp`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ && normalizePath(op.path || "") === "/tmp"); + expect(readOps.length).toBe(1); + }); + + test("traces ls without args (current dir)", () => { + const result = $.trace`ls`; + expect(result.success).toBe(true); + + // Should read current directory (.) + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(1); + }); + + test("includes cwd in result", () => { + const result = $.trace`echo test`; + expect(result.cwd).toBeTruthy(); + expect(typeof result.cwd).toBe("string"); + }); + + test("includes cwd in each operation", () => { + const result = $.trace`cat /tmp/test.txt`; + for (const op of result.operations) { + expect(op.cwd).toBeTruthy(); + expect(typeof op.cwd).toBe("string"); + } + }); + + test("handles template literal interpolation", () => { + const filename = "test.txt"; + const result = $.trace`cat /tmp/${filename}`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ && op.path?.endsWith("test.txt")); + expect(readOps.length).toBe(1); + }); + + test("does not actually execute commands", () => { + // This would fail if it actually ran, since the file doesn't exist + const result = $.trace`cat /nonexistent/path/that/does/not/exist.txt`; + expect(result.success).toBe(true); + expect(result.operations.length).toBeGreaterThan(0); + }); + + test("external command resolves path when available", () => { + // Use a cross-platform external command + const cmd = process.platform === "win32" ? "cmd" : "/bin/ls"; + const result = $.trace`${cmd} --version`; + expect(result.success).toBe(true); + + const execOps = result.operations.filter(op => op.flags === EXECUTE); + expect(execOps.length).toBeGreaterThan(0); + // Command name should be captured + expect(execOps[0].command).toBe(cmd); + }); + + test("external commands include args array", () => { + const result = $.trace`grep -r 'pattern' src/`; + expect(result.success).toBe(true); + + const execOps = result.operations.filter(op => op.flags === EXECUTE); + expect(execOps.length).toBe(1); + expect(execOps[0].command).toBe("grep"); + expect(execOps[0].args).toEqual(["-r", "pattern", "src/"]); + }); + + test("pipeline commands each have their own args", () => { + const result = $.trace`git diff HEAD^ -- src/ | head -100`; + expect(result.success).toBe(true); + + const execOps = result.operations.filter(op => op.flags === EXECUTE); + expect(execOps.length).toBe(2); + + expect(execOps[0].command).toBe("git"); + expect(execOps[0].args).toEqual(["diff", "HEAD^", "--", "src/"]); + + expect(execOps[1].command).toBe("head"); + expect(execOps[1].args).toEqual(["-100"]); + }); + + test("builtins do not have args (tracked as file operations)", () => { + const result = $.trace`cat file1.txt file2.txt`; + expect(result.success).toBe(true); + + // Builtins track files, not args + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(2); + expect(readOps[0].args).toBeUndefined(); + expect(readOps[1].args).toBeUndefined(); + }); + + test("traces && (and) operator", () => { + const result = $.trace`cat /tmp/a.txt && cat /tmp/b.txt`; + expect(result.success).toBe(true); + + // Both commands should be traced + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(2); + expect(normalizePath(readOps[0].path!)).toBe("/tmp/a.txt"); + expect(normalizePath(readOps[1].path!)).toBe("/tmp/b.txt"); + }); + + test("traces || (or) operator", () => { + const result = $.trace`cat /tmp/a.txt || cat /tmp/b.txt`; + expect(result.success).toBe(true); + + // Both commands should be traced + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(2); + }); + + test("traces subshell with cwd isolation", () => { + const result = $.trace`(cd /tmp && ls) && ls`; + expect(result.success).toBe(true); + + // Should have: CHDIR /tmp, READ /tmp (inside subshell), READ . (outside subshell) + const chdirOps = result.operations.filter(op => op.flags === Permission.CHDIR); + expect(chdirOps.length).toBe(1); + expect(normalizePath(chdirOps[0].path!)).toBe("/tmp"); + + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(2); + // First ls inside subshell should see /tmp + expect(normalizePath(readOps[0].cwd!)).toBe("/tmp"); + // Second ls outside subshell should see original cwd (subshell cwd is restored) + expect(normalizePath(readOps[1].cwd!)).not.toBe("/tmp"); + }); + + test("cd updates cwd for subsequent commands", () => { + const result = $.trace`cd /tmp && ls`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(1); + expect(normalizePath(readOps[0].cwd!)).toBe("/tmp"); + expect(normalizePath(readOps[0].path!)).toBe("/tmp"); // ls reads cwd + }); + + test("expands brace patterns", () => { + const result = $.trace`cat /tmp/{a,b,c}.txt`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(3); + expect(normalizePath(readOps[0].path!)).toBe("/tmp/a.txt"); + expect(normalizePath(readOps[1].path!)).toBe("/tmp/b.txt"); + expect(normalizePath(readOps[2].path!)).toBe("/tmp/c.txt"); + }); + + test("expands tilde to home directory", () => { + const result = $.trace`cat ~/.config/test.txt`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(1); + expect(readOps[0].path).not.toContain("~"); + // Home directory path varies by platform + if (process.platform === "win32") { + // Windows uses USERPROFILE which expands to something like C:\Users\username + expect(readOps[0].path).toMatch(/\.config[/\\]test\.txt$/); + } else { + expect(readOps[0].path).toContain(".config/test.txt"); + } + }); + + test("expands glob patterns to matching files", () => { + // Create test files for glob expansion using tempDir helper + const { join } = require("path"); + using dir = tempDir("trace-glob-test", { + "a.txt": "", + "b.txt": "", + "c.txt": "", + }); + const testDir = String(dir); + + const result = $.trace`cat ${testDir}/*.txt`; + expect(result.success).toBe(true); + + const readOps = result.operations.filter(op => op.flags === READ); + expect(readOps.length).toBe(3); + const paths = readOps.map(op => normalizePath(op.path!)).sort(); + const expected = [join(testDir, "a.txt"), join(testDir, "b.txt"), join(testDir, "c.txt")].map(normalizePath); + expect(paths).toEqual(expected); + }); +}); diff --git a/test/js/bun/spawn/null-byte-injection.test.ts b/test/js/bun/spawn/null-byte-injection.test.ts new file mode 100644 index 00000000000000..e5a58ac92a45ab --- /dev/null +++ b/test/js/bun/spawn/null-byte-injection.test.ts @@ -0,0 +1,125 @@ +import { $ } from "bun"; +import { describe, expect, test } from "bun:test"; + +describe("null byte injection protection", () => { + describe("Bun.spawn", () => { + test("throws error when command contains null byte", async () => { + const command = "echo\0evil"; + expect(() => { + Bun.spawn([command]); + }).toThrow(/must be a string without null bytes/); + }); + + test("throws error when argument contains null byte", async () => { + const arg = "x.html\0.txt"; + expect(() => { + Bun.spawn(["echo", arg]); + }).toThrow(/must be a string without null bytes/); + }); + + test("throws error with ERR_INVALID_ARG_VALUE code for args with null byte", async () => { + const arg = "test\0value"; + try { + Bun.spawn(["echo", arg]); + expect.unreachable(); + } catch (e: any) { + expect(e.code).toBe("ERR_INVALID_ARG_VALUE"); + expect(e.message).toMatch(/args\[1\]/); + expect(e.message).toMatch(/must be a string without null bytes/); + } + }); + + test("throws error for null byte in env key", async () => { + expect(() => { + Bun.spawn(["echo", "hello"], { + env: { + "MY\0VAR": "value", + }, + }); + }).toThrow(/must be a string without null bytes/); + }); + + test("throws error for null byte in env value", async () => { + expect(() => { + Bun.spawn(["echo", "hello"], { + env: { + MY_VAR: "val\0ue", + }, + }); + }).toThrow(/must be a string without null bytes/); + }); + + test("works normally with valid arguments", async () => { + await using proc = Bun.spawn(["echo", "hello"], { stdout: "pipe" }); + const stdout = await new Response(proc.stdout).text(); + expect(stdout.trim()).toBe("hello"); + expect(await proc.exited).toBe(0); + }); + + test("works with spread process.env", async () => { + await using proc = Bun.spawn(["echo", "hello"], { + env: { ...process.env }, + stdout: "pipe", + }); + const stdout = await new Response(proc.stdout).text(); + expect(stdout.trim()).toBe("hello"); + expect(await proc.exited).toBe(0); + }); + }); + + describe("Bun.spawnSync", () => { + test("throws error when command contains null byte", () => { + const command = "echo\0evil"; + expect(() => { + Bun.spawnSync([command]); + }).toThrow(/must be a string without null bytes/); + }); + + test("throws error when argument contains null byte", () => { + const arg = "x.html\0.txt"; + expect(() => { + Bun.spawnSync(["echo", arg]); + }).toThrow(/must be a string without null bytes/); + }); + + test("works normally with valid arguments", () => { + const result = Bun.spawnSync(["echo", "hello"]); + expect(result.stdout.toString().trim()).toBe("hello"); + expect(result.exitCode).toBe(0); + }); + }); + + describe("Shell ($)", () => { + test("throws error when interpolated string contains null byte", () => { + const name = "x.html\0.txt"; + expect(() => $`echo ${name}`).toThrow(/must be a string without null bytes/); + }); + + test("throws error with ERR_INVALID_ARG_VALUE code for shell args with null byte", () => { + const arg = "test\0value"; + try { + $`echo ${arg}`; + expect.unreachable(); + } catch (e: any) { + expect(e.code).toBe("ERR_INVALID_ARG_VALUE"); + expect(e.message).toMatch(/must be a string without null bytes/); + } + }); + + test("throws error when array element contains null byte", () => { + const args = ["valid", "x\0y", "also valid"]; + expect(() => $`echo ${args}`).toThrow(/must be a string without null bytes/); + }); + + test("throws error when object with raw property contains null byte", () => { + const raw = { raw: "test\0value" }; + expect(() => $`echo ${raw}`).toThrow(/must be a string without null bytes/); + }); + + test("works normally with valid arguments", async () => { + const name = "hello.txt"; + const result = await $`echo ${name}`.text(); + expect(result.trim()).toBe("hello.txt"); + }); + }); +}); diff --git a/test/js/web/html/URLSearchParams.test.ts b/test/js/web/html/URLSearchParams.test.ts index f8f8260e4dfd97..6c9ca97ae5688f 100644 --- a/test/js/web/html/URLSearchParams.test.ts +++ b/test/js/web/html/URLSearchParams.test.ts @@ -212,6 +212,13 @@ describe("URLSearchParams", () => { }); }); +it("size property should be configurable (issue #9251)", () => { + const descriptor = Object.getOwnPropertyDescriptor(URLSearchParams.prototype, "size"); + expect(descriptor).toBeDefined(); + expect(descriptor!.configurable).toBe(true); + expect(descriptor!.enumerable).toBe(true); +}); + it(".delete second argument", () => { const params = new URLSearchParams("a=1&a=2&b=3"); params.delete("a", 1); diff --git a/test/js/web/websocket/websocket-permessage-deflate-edge-cases.test.ts b/test/js/web/websocket/websocket-permessage-deflate-edge-cases.test.ts index 934f2f0e3bb8c4..37a718e034654e 100644 --- a/test/js/web/websocket/websocket-permessage-deflate-edge-cases.test.ts +++ b/test/js/web/websocket/websocket-permessage-deflate-edge-cases.test.ts @@ -1,5 +1,8 @@ import { serve } from "bun"; -import { expect, test } from "bun:test"; +import { expect, setDefaultTimeout, test } from "bun:test"; + +// The decompression bomb test needs extra time to compress 150MB of test data +setDefaultTimeout(30_000); // Test compressed continuation frames test("WebSocket client handles compressed continuation frames correctly", async () => { @@ -198,3 +201,133 @@ test("WebSocket client handles compression errors gracefully", async () => { client.close(); server.stop(); }); + +// Test that decompression is limited to prevent decompression bombs +test("WebSocket client rejects decompression bombs", async () => { + const net = await import("net"); + const zlib = await import("zlib"); + const crypto = await import("crypto"); + + // Create a raw TCP server that speaks WebSocket protocol + const tcpServer = net.createServer(); + + const serverReady = new Promise(resolve => { + tcpServer.listen(0, () => { + const addr = tcpServer.address(); + resolve(typeof addr === "object" && addr ? addr.port : 0); + }); + }); + + const port = await serverReady; + + tcpServer.on("connection", socket => { + let buffer = Buffer.alloc(0); + + socket.on("data", data => { + buffer = Buffer.concat([buffer, data]); + + // Look for end of HTTP headers + const headerEnd = buffer.indexOf("\r\n\r\n"); + if (headerEnd === -1) return; + + const headers = buffer.slice(0, headerEnd).toString(); + + // Extract Sec-WebSocket-Key + const keyMatch = headers.match(/Sec-WebSocket-Key: ([A-Za-z0-9+/=]+)/i); + if (!keyMatch) { + socket.end(); + return; + } + + const key = keyMatch[1]; + const acceptKey = crypto + .createHash("sha1") + .update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11") + .digest("base64"); + + // Send WebSocket upgrade response with permessage-deflate + socket.write( + "HTTP/1.1 101 Switching Protocols\r\n" + + "Upgrade: websocket\r\n" + + "Connection: Upgrade\r\n" + + `Sec-WebSocket-Accept: ${acceptKey}\r\n` + + "Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n" + + "\r\n", + ); + + // Create a decompression bomb: 150MB of zeros (exceeds the 128MB limit) + const uncompressedSize = 150 * 1024 * 1024; + const payload = Buffer.alloc(uncompressedSize, 0); + + // Compress with raw deflate (no header, no trailing bytes that permessage-deflate removes) + const compressed = zlib.deflateRawSync(payload, { level: 9 }); + + // Build WebSocket frame (binary, FIN=1, RSV1=1 for compression) + // Frame format: FIN(1) RSV1(1) RSV2(0) RSV3(0) Opcode(4) Mask(1) PayloadLen(7) [ExtendedLen] [MaskKey] Payload + const frameHeader: number[] = []; + + // First byte: FIN=1, RSV1=1 (compressed), RSV2=0, RSV3=0, Opcode=2 (binary) + frameHeader.push(0b11000010); + + // Second byte: Mask=0 (server to client), payload length + if (compressed.length < 126) { + frameHeader.push(compressed.length); + } else if (compressed.length < 65536) { + frameHeader.push(126); + frameHeader.push((compressed.length >> 8) & 0xff); + frameHeader.push(compressed.length & 0xff); + } else { + frameHeader.push(127); + // 64-bit length (we only need lower 32 bits for this test) + frameHeader.push(0, 0, 0, 0); + frameHeader.push((compressed.length >> 24) & 0xff); + frameHeader.push((compressed.length >> 16) & 0xff); + frameHeader.push((compressed.length >> 8) & 0xff); + frameHeader.push(compressed.length & 0xff); + } + + const frame = Buffer.concat([Buffer.from(frameHeader), compressed]); + socket.write(frame); + }); + }); + + let client: WebSocket | null = null; + let messageReceived = false; + + try { + // Connect with Bun's WebSocket client + client = new WebSocket(`ws://localhost:${port}`); + + const result = await new Promise<{ code: number; reason: string }>(resolve => { + client!.onopen = () => { + // Connection opened, waiting for the bomb to be sent + }; + + client!.onmessage = () => { + // Should NOT receive the message - it should be rejected + messageReceived = true; + }; + + client!.onerror = () => { + // Error is expected + }; + + client!.onclose = event => { + resolve({ + code: messageReceived ? -1 : event.code, + reason: messageReceived ? "Message was received but should have been rejected" : event.reason, + }); + }; + }); + + // The connection should be closed with code 1009 (Message Too Big) + expect(result.code).toBe(1009); + expect(result.reason).toBe("Message too big"); + } finally { + // Ensure cleanup happens even on test failure/timeout + if (client && client.readyState !== WebSocket.CLOSED) { + client.close(); + } + await new Promise(resolve => tcpServer.close(() => resolve())); + } +}); diff --git a/test/regression/issue/25609.test.ts b/test/regression/issue/25609.test.ts new file mode 100644 index 00000000000000..5e647d6b37d40e --- /dev/null +++ b/test/regression/issue/25609.test.ts @@ -0,0 +1,28 @@ +import { expect, test } from "bun:test"; +import { bunEnv, bunExe, tempDir } from "harness"; + +// https://github.com/oven-sh/bun/issues/25609 +test("empty object in spread with DCE does not produce invalid syntax", async () => { + using dir = tempDir("25609", { + "chunk.js": `module.exports=()=>{var a,b=({...a,x:{}},0)};`, + "index.js": `require('./chunk.js');`, + }); + + // This should not throw a syntax error when requiring the module + await using proc = Bun.spawn({ + cmd: [bunExe(), "index.js"], + cwd: String(dir), + env: bunEnv, + stdout: "pipe", + stderr: "pipe", + }); + + const [stdout, stderr, exitCode] = await Promise.all([ + new Response(proc.stdout).text(), + new Response(proc.stderr).text(), + proc.exited, + ]); + + expect(stderr).toBe(""); + expect(exitCode).toBe(0); +}); diff --git a/test/regression/issue/25632.test.ts b/test/regression/issue/25632.test.ts new file mode 100644 index 00000000000000..9b2dd73e4b781a --- /dev/null +++ b/test/regression/issue/25632.test.ts @@ -0,0 +1,72 @@ +/** + * Regression test for issue #25632 + * ServerResponse.end() should always result in writableEnded being set to/returning true + * + * @see https://github.com/oven-sh/bun/issues/25632 + */ +import { test, expect, describe } from "bun:test"; +import { createServer, ServerResponse, IncomingMessage } from "node:http"; + +describe("ServerResponse.writableEnded", () => { + test("should be true after end() is called without a socket", async () => { + // Create a ServerResponse without a valid socket/handle + const req = new IncomingMessage(null as any); + const res = new ServerResponse(req); + + expect(res.writableEnded).toBe(false); + expect(res.finished).toBe(false); + + res.end(); + + // Per Node.js spec, writableEnded should be true after end() is called + expect(res.writableEnded).toBe(true); + expect(res.finished).toBe(true); + }); + + test("should be true after end() is called with callback but without socket", async () => { + const req = new IncomingMessage(null as any); + const res = new ServerResponse(req); + + let called = false; + res.end(() => { + // Note: In Node.js, callback is NOT invoked when there's no socket + // This matches Node.js behavior where the 'finish' event never fires without a socket + called = true; + }); + + // Per Node.js spec, writableEnded should be true after end() is called + expect(res.writableEnded).toBe(true); + expect(res.finished).toBe(true); + + await new Promise(resolve => process.nextTick(resolve)); + expect(called).toBe(false); + }); + + test("should be true after end() with chunk but without socket", async () => { + const req = new IncomingMessage(null as any); + const res = new ServerResponse(req); + + res.end("test data"); + + expect(res.writableEnded).toBe(true); + expect(res.finished).toBe(true); + }); + + test("should be true in normal server context", async () => { + const server = createServer((req, res) => { + expect(res.writableEnded).toBe(false); + res.end("Hello"); + expect(res.writableEnded).toBe(true); + }); + + await new Promise(resolve => server.listen({ port: 0 }, resolve)); + const { port } = server.address() as { port: number }; + + try { + const response = await fetch(`http://localhost:${port}`); + expect(await response.text()).toBe("Hello"); + } finally { + await new Promise(resolve => server.close(resolve)); + } + }); +}); diff --git a/test/regression/issue/25716.test.ts b/test/regression/issue/25716.test.ts new file mode 100644 index 00000000000000..a21331f268780f --- /dev/null +++ b/test/regression/issue/25716.test.ts @@ -0,0 +1,49 @@ +// https://github.com/oven-sh/bun/issues/25716 +// Expose `--react-fast-refresh` option in `Bun.build` JS API +import { expect, test } from "bun:test"; +import { tempDirWithFiles } from "harness"; +import { join } from "path"; + +test("Bun.build reactFastRefresh option enables React Fast Refresh transform", async () => { + const dir = tempDirWithFiles("react-fast-refresh-test", { + "component.tsx": ` + import { useState } from "react"; + + export function Counter() { + const [count, setCount] = useState(0); + return ; + } + + export default function App() { + return

; + } + `, + }); + + // With reactFastRefresh: true, output should contain $RefreshReg$ and $RefreshSig$ + const buildEnabled = await Bun.build({ + entrypoints: [join(dir, "component.tsx")], + reactFastRefresh: true, + target: "browser", + external: ["react"], + }); + + expect(buildEnabled.success).toBe(true); + expect(buildEnabled.outputs).toHaveLength(1); + + const outputEnabled = await buildEnabled.outputs[0].text(); + expect(outputEnabled).toContain("$RefreshReg$"); + expect(outputEnabled).toContain("$RefreshSig$"); + + // Without reactFastRefresh (default), output should NOT contain refresh calls + const buildDisabled = await Bun.build({ + entrypoints: [join(dir, "component.tsx")], + target: "browser", + external: ["react"], + }); + + expect(buildDisabled.success).toBe(true); + const outputDisabled = await buildDisabled.outputs[0].text(); + expect(outputDisabled).not.toContain("$RefreshReg$"); + expect(outputDisabled).not.toContain("$RefreshSig$"); +}); diff --git a/test/regression/issue/8254.test.ts b/test/regression/issue/8254.test.ts new file mode 100644 index 00000000000000..76a9195ade5872 --- /dev/null +++ b/test/regression/issue/8254.test.ts @@ -0,0 +1,40 @@ +// https://github.com/oven-sh/bun/issues/8254 +// Bun.write() should correctly write files larger than 2GB without data corruption + +import { expect, test } from "bun:test"; +import { tempDir } from "harness"; +import { join } from "path"; + +test("Bun.write() should write past 2GB boundary without corruption", async () => { + using tmpbase = tempDir("issue-8254", {}); + + const TWO_GB = 2 ** 31; + const CHUNK_SIZE = 1024 * 1024; // 1MB + // Force a second write iteration by crossing the 2GB boundary + const NUM_CHUNKS = Math.floor(TWO_GB / CHUNK_SIZE) + 1; + const path = join(tmpbase, "large-file.bin"); + + const chunks: Uint8Array[] = []; + for (let i = 0; i < NUM_CHUNKS; i++) { + const chunk = new Uint8Array(CHUNK_SIZE); + chunk.fill(i % 256); + chunks.push(chunk); + } + + const blob = new Blob(chunks); + const written = await Bun.write(path, blob); + + expect(written).toBeGreaterThan(TWO_GB); + + const file = Bun.file(path); + + // Check bytes just before and after 2GB boundary + const positions = [TWO_GB - 1, TWO_GB, TWO_GB + 1]; + + for (const pos of positions) { + const buf = new Uint8Array(await file.slice(pos, pos + 1).arrayBuffer()); + + const expected = Math.floor(pos / CHUNK_SIZE) % 256; + expect(buf[0]).toBe(expected); + } +});