Skip to content

Electron IPC doesn't supports Web Stream API #46863

Closed as not planned
Closed as not planned

Description

@himself65

Preflight Checklist

Electron Version

35

What operating system(s) are you using?

macOS

Operating System Version

macOS 15

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

In document https://www.electronjs.org/docs/latest/tutorial/ipc#object-serialization

Electron's IPC implementation uses the HTML standard Structured Clone Algorithm to serialize objects passed between processes, meaning that only certain types of objects can be passed through IPC channels.

Web Stream is transferable objects https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects

Actual Behavior

Stream is an empty object

Testcase Gist URL

himself65/electron-stream-api@132349d

Additional Information

No response

Activity

  1. added theissue type on Apr 29, 2025
  2. moved this to 👀 Unsorted Items in 35-x-yon Apr 29, 2025
  3. added
    blocked/need-repro
    on Apr 29, 2025
  4. electron-issue-triage commented on Apr 29, 2025

    @electron-issue-triage

    Hello @himself65. Thanks for reporting this and helping to make Electron better!

    Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

    Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

    Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

  5. himself65 commented on Apr 29, 2025

    @himself65
    Author
  6. removed
    blocked/need-repro
    on Apr 29, 2025
  7. nikwen commented on Apr 30, 2025

    @nikwen
    Member

    Thanks for sharing!

    Notes:

    1. You make it easier for the team to fix your issue (and thus increase the likelihood of it happening) if you use Electron Fiddle to publish a testcase.
    2. Just a tip: Make sure that you're not exposing a generic "on" handler over the context bridge in production. Refer to the Electron security guide on that topic.
  8. added
    has-repro-repo
    on Apr 30, 2025
  9. nikwen commented on May 2, 2025

    @nikwen
    Member

    Related: #46901

  10. himself65 commented on Jul 5, 2025

    @himself65
    Author

    I might wonder how to make this possible, I read the soruce code and looks like electron has it's own v8 value encode logic, but afaik there's already have a transferable class to transfer some internal class (like Web Stream) in node.js. Not sure how it happen to electron.

  11. himself65 commented on Jul 5, 2025

    @himself65
    Author

    maybe this is where I should start

    void PostMessage(v8::Isolate* isolate,
    gin_helper::ErrorThrower thrower,
    const std::string& channel,
    v8::Local<v8::Value> message_value,
    std::optional<v8::Local<v8::Value>> transfer) {
    if (!electron_ipc_remote_) {
    thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
    return;
    }
    blink::TransferableMessage transferable_message;
    if (!electron::SerializeV8Value(isolate, message_value,
    &transferable_message)) {
    // SerializeV8Value sets an exception.
    return;
    }
    std::vector<v8::Local<v8::Object>> transferables;
    if (transfer && !transfer.value()->IsUndefined()) {
    if (!gin::ConvertFromV8(isolate, *transfer, &transferables)) {
    thrower.ThrowTypeError("Invalid value for transfer");
    return;
    }
    }
    std::vector<blink::MessagePortChannel> ports;
    for (auto& transferable : transferables) {
    std::optional<blink::MessagePortChannel> port =
    blink::WebMessagePortConverter::
    DisentangleAndExtractMessagePortChannel(isolate, transferable);
    if (!port.has_value()) {
    thrower.ThrowTypeError("Invalid value for transfer");
    return;
    }
    ports.emplace_back(port.value());
    }
    transferable_message.ports = std::move(ports);
    electron_ipc_remote_->ReceivePostMessage(channel,
    std::move(transferable_message));
    }

    try to use some node js internal class to share the transfer stuff, instread of blink logic

  12. electron-issue-triage commented on Oct 4, 2025

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  13. electron-issue-triage commented on Nov 3, 2025

    @electron-issue-triage

    This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    35-x-ybug 🪲component/ipchas-repro-repoplatform/macOSstale

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions