[Extensions] Add Blob support to extension messaging. [chromium/src : main]

38 views
Skip to first unread message

Justin Lulejian (Gerrit)

unread,
Feb 4, 2026, 12:02:22 PM (7 days ago) Feb 4
to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
Attention needed from Solomon Kinard

Justin Lulejian added 1 comment

Patchset-level comments
File-level comment, Patchset 13 (Latest):
Justin Lulejian . resolved

Hi Solomon (again 😄)! Here's the actual Blob support impl now that we can use CloneableMessage.

Open in Gerrit

Related details

Attention is currently required from:
  • Solomon Kinard
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
Gerrit-Change-Number: 7311207
Gerrit-PatchSet: 13
Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
Gerrit-Comment-Date: Wed, 04 Feb 2026 17:02:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Solomon Kinard (Gerrit)

unread,
Feb 4, 2026, 6:48:17 PM (7 days ago) Feb 4
to Justin Lulejian, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
Attention needed from Justin Lulejian

Solomon Kinard added 7 comments

Patchset-level comments
Solomon Kinard . resolved

A few quick questions.

File extensions/common/api/messaging/message.h
Line 72, Patchset 13 (Latest): // (UUID, content type, and size) to determine identity, rather than
Solomon Kinard . unresolved

Any risks to comparing for identity without checking for content equality?

Line 20, Patchset 13 (Parent):using StructuredCloneMessageWireData = mojo_base::BigBuffer;
Solomon Kinard . unresolved

OOC, why drop Wire?

File extensions/common/api/messaging/message.cc
Line 88, Patchset 13 (Latest): if (this_msg.blobs[i]->uuid != other_msg.blobs[i]->uuid ||
this_msg.blobs[i]->content_type !=
other_msg.blobs[i]->content_type ||
this_msg.blobs[i]->size != other_msg.blobs[i]->size) {
return false;
}
Solomon Kinard . unresolved

Ok to avoid relying on the possibility of CSE (Common Subexpression Elimination), or `this_msg_blob` with `other_msg_blob`, in case it's easier to read?

```suggestion
const auto& blob_a = *this_msg.blobs[i];
const auto& blob_b = *other_msg.blobs[i];
        if (blob_a.uuid != blob_b.uuid ||
blob_a.content_type != blob_b.content_type ||
blob_a.size != blob_b.size) {
return false;
}
```
File extensions/common/mojom/message_port_mojom_traits_unittest.cc
Line 115, Patchset 13 (Latest): "uuid", "content_type", 10, std::move(blob_remote)));
Solomon Kinard . unresolved
? here and elsewhere?
```suggestion
"uuid", "content_type", /*size=*/10, std::move(blob_remote)));
```
File extensions/renderer/api/messaging/native_renderer_messaging_service.cc
Line 719, Patchset 13 (Latest): if (one_time_message_handler_.HasPort(script_context, target_port_id)) {
Solomon Kinard . unresolved

Is it possible/likely to reach this point where the context does not have a port with with this specified id?

File extensions/test/data/api_test/messaging/serialization/serialization_common_tests.js
Line 125, Patchset 13 (Latest): let blobMessagePromise = sendMessage(blobMessage);
let blobResponse = await blobMessagePromise;
Solomon Kinard . unresolved
?
```suggestion
let blobResponse = await sendMessage(blobMessage);
```
Open in Gerrit

Related details

Attention is currently required from:
  • Justin Lulejian
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
    Gerrit-Change-Number: 7311207
    Gerrit-PatchSet: 13
    Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
    Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Justin Lulejian <jlul...@chromium.org>
    Gerrit-Comment-Date: Wed, 04 Feb 2026 23:48:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Lulejian (Gerrit)

    unread,
    Feb 5, 2026, 4:39:49 PM (6 days ago) Feb 5
    to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
    Attention needed from Solomon Kinard

    Justin Lulejian added 6 comments

    File extensions/common/api/messaging/message.h
    Line 72, Patchset 13: // (UUID, content type, and size) to determine identity, rather than
    Solomon Kinard . resolved

    Any risks to comparing for identity without checking for content equality?

    Justin Lulejian

    Actually I assumed UUID was a unguessable token, but it is not. it's a [base::UUID but stored as a string](https://source.chromium.org/chromium/chromium/src/+/main:base/uuid.h;l=31-32;drc=8393737e4619e84795f4c565912e1b044fef2a82) so I suspect there could be collisions at some point. Thankfully we actually don't use this operator (except in tests) so I'm going to create a testing method and delete the operator to avoid any confusion.

    Line 20, Patchset 13 (Parent):using StructuredCloneMessageWireData = mojo_base::BigBuffer;
    Solomon Kinard . resolved

    OOC, why drop Wire?

    Justin Lulejian

    It changed it because the underlying type changed from mojo_base::BigBuffer to blink::CloneableMessage. CloneableMessage is a higher-level object that can contain mojo remotes for Blobs, so the suffix 'Wire'(format) felt less accurate and data is more consistent with data() and message_data().

    File extensions/common/api/messaging/message.cc
    Line 88, Patchset 13: if (this_msg.blobs[i]->uuid != other_msg.blobs[i]->uuid ||

    this_msg.blobs[i]->content_type !=
    other_msg.blobs[i]->content_type ||
    this_msg.blobs[i]->size != other_msg.blobs[i]->size) {
    return false;
    }
    Solomon Kinard . resolved

    Ok to avoid relying on the possibility of CSE (Common Subexpression Elimination), or `this_msg_blob` with `other_msg_blob`, in case it's easier to read?

    ```suggestion
    const auto& blob_a = *this_msg.blobs[i];
    const auto& blob_b = *other_msg.blobs[i];
            if (blob_a.uuid != blob_b.uuid ||
    blob_a.content_type != blob_b.content_type ||
    blob_a.size != blob_b.size) {
    return false;
    }
    ```
    Justin Lulejian

    Done

    File extensions/common/mojom/message_port_mojom_traits_unittest.cc
    Line 115, Patchset 13: "uuid", "content_type", 10, std::move(blob_remote)));
    Solomon Kinard . resolved
    ? here and elsewhere?
    ```suggestion
    "uuid", "content_type", /*size=*/10, std::move(blob_remote)));
    ```
    Justin Lulejian

    Done

    File extensions/renderer/api/messaging/native_renderer_messaging_service.cc
    Line 719, Patchset 13: if (one_time_message_handler_.HasPort(script_context, target_port_id)) {
    Solomon Kinard . resolved

    Is it possible/likely to reach this point where the context does not have a port with with this specified id?

    Justin Lulejian

    No, due to the earlier check in [DeliverMessageToScriptContext](https://source.chromium.org/chromium/chromium/src/+/main:extensions/renderer/api/messaging/native_renderer_messaging_service.cc;l=498;drc=8393737e4619e84795f4c565912e1b044fef2a82) that returns early if there's no one-time message or long lived port. So one of them will have it, but this function assumes it could be either.

    File extensions/test/data/api_test/messaging/serialization/serialization_common_tests.js
    Line 125, Patchset 13: let blobMessagePromise = sendMessage(blobMessage);

    let blobResponse = await blobMessagePromise;
    Solomon Kinard . resolved
    ?
    ```suggestion
    let blobResponse = await sendMessage(blobMessage);
    ```
    Justin Lulejian

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Solomon Kinard
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
      Gerrit-Change-Number: 7311207
      Gerrit-PatchSet: 17
      Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
      Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-CC: Kentaro Hara <har...@chromium.org>
      Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
      Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Comment-Date: Thu, 05 Feb 2026 21:39:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Solomon Kinard <solomo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Solomon Kinard (Gerrit)

      unread,
      Feb 6, 2026, 2:58:20 PM (5 days ago) Feb 6
      to Justin Lulejian, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
      Attention needed from Justin Lulejian

      Solomon Kinard voted and added 1 comment

      Votes added by Solomon Kinard

      Code-Review+1

      1 comment

      File extensions/renderer/api/messaging/messaging_util.cc
      Line 248, Patchset 17 (Latest): // `message` no longer has valid message data!
      Solomon Kinard . unresolved

      OOC, why? optional: add a few words to the comment e.g. ` because ...`

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Justin Lulejian
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
        Gerrit-Change-Number: 7311207
        Gerrit-PatchSet: 17
        Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
        Gerrit-CC: Kentaro Hara <har...@chromium.org>
        Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
        Gerrit-Attention: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Comment-Date: Fri, 06 Feb 2026 19:58:10 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Justin Lulejian (Gerrit)

        unread,
        Feb 9, 2026, 4:18:00 PM (2 days ago) Feb 9
        to Chromium IPC Reviews, Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
        Attention needed from Chromium IPC Reviews

        Justin Lulejian added 1 comment

        Patchset-level comments
        File-level comment, Patchset 18 (Latest):
        Justin Lulejian . resolved

        Hi Chromium IPC Reviews! Could you review
        extensions/common/mojom/.* please?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Chromium IPC Reviews
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
        Gerrit-Change-Number: 7311207
        Gerrit-PatchSet: 18
        Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
        Gerrit-CC: Kentaro Hara <har...@chromium.org>
        Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
        Gerrit-Attention: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-Comment-Date: Mon, 09 Feb 2026 21:17:56 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        gwsq (Gerrit)

        unread,
        Feb 9, 2026, 4:21:26 PM (2 days ago) Feb 9
        to Justin Lulejian, Chromium IPC Reviews, Dominic Farolino, Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
        Attention needed from Dominic Farolino

        Message from gwsq

        From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
        IPC: d...@chromium.org

        📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

        IPC reviewer(s): d...@chromium.org


        Reviewer source(s):
        d...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Dominic Farolino
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
        Gerrit-Change-Number: 7311207
        Gerrit-PatchSet: 18
        Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
        Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
        Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
        Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-CC: Kentaro Hara <har...@chromium.org>
        Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
        Gerrit-CC: gwsq
        Gerrit-Attention: Dominic Farolino <d...@chromium.org>
        Gerrit-Comment-Date: Mon, 09 Feb 2026 21:20:50 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Justin Lulejian (Gerrit)

        unread,
        Feb 9, 2026, 4:48:36 PM (2 days ago) Feb 9
        to Chromium IPC Reviews, Dominic Farolino, Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, jbroma...@chromium.org
        Attention needed from Dominic Farolino

        Justin Lulejian added 1 comment

        File extensions/renderer/api/messaging/messaging_util.cc
        Line 248, Patchset 17: // `message` no longer has valid message data!
        Solomon Kinard . resolved

        OOC, why? optional: add a few words to the comment e.g. ` because ...`

        Justin Lulejian

        The goal here was to avoid copying the `extensions::Message` `data_` field, which can be significant in size; so TakeStructuredMessage() `std::move`s `data_`. After the std::move `data_` no longer points to valid data. Appended the explanation to the comment.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Dominic Farolino
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I07339a8f7b87baf736f8e6fef4af12adf54b90fe
          Gerrit-Change-Number: 7311207
          Gerrit-PatchSet: 19
          Gerrit-Owner: Justin Lulejian <jlul...@chromium.org>
          Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
          Gerrit-Reviewer: Justin Lulejian <jlul...@chromium.org>
          Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
          Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-CC: Kentaro Hara <har...@chromium.org>
          Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Dominic Farolino <d...@chromium.org>
          Gerrit-Comment-Date: Mon, 09 Feb 2026 21:48:31 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Solomon Kinard <solomo...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages