Extensions: fix GlicPrivate.invoke failed in webview [chromium/src : main]

0 views
Skip to first unread message

Yuheng Huang (Gerrit)

unread,
May 29, 2026, 1:57:21 PM (3 days ago) May 29
to Devlin Cronin, Justin DeWitt, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Devlin Cronin and Justin DeWitt

Yuheng Huang voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
  • Justin DeWitt
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: I9e43e4349d1098086a5e6e0b7e783e7c6a3d6703
Gerrit-Change-Number: 7885468
Gerrit-PatchSet: 3
Gerrit-Owner: Yuheng Huang <yuh...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Justin DeWitt <dew...@chromium.org>
Gerrit-Reviewer: Yuheng Huang <yuh...@chromium.org>
Gerrit-CC: David Trainor <dtra...@chromium.org>
Gerrit-CC: Tommy Nyquist <nyq...@chromium.org>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Attention: Justin DeWitt <dew...@chromium.org>
Gerrit-Comment-Date: Fri, 29 May 2026 17:57:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Devlin Cronin (Gerrit)

unread,
May 29, 2026, 2:20:27 PM (3 days ago) May 29
to Yuheng Huang, Devlin Cronin, Justin DeWitt, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Justin DeWitt and Yuheng Huang

Devlin Cronin added 2 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Devlin Cronin . resolved

Thanks, Yuheng!

File extensions/browser/api/messaging/extension_message_port.cc
Line 446, Patchset 3 (Latest): if (!source_frame.document_id.is_empty()) {
Devlin Cronin . unresolved

As I mentioned in the associated bug, this is a *public-facing* API that's used today by lots and lots of extensions. Changing this behavior risks breaking them, since some could potentially be relying on this being undefined in various contexts. For instance, something like the code below:

```
if (sender.documentId) {
// Sender is in a tab; otherwise documentId is undefined.
executeScript(getTabWithDocumentId(sender.documentId));
}
```

I'm amenable to changing this for all extensions, but it is something we need to a) discuss, b) communicate, and c) test (as part of the public API).

WDYT about:
1) Filing a public bug and starting the discussion to always populate documentId when there's an associated frame?
2) As a *temporary* hack, populating documentId unconditionally if the connection is a webview to a component extension? (I think Justin mentioned this already in the bug?)

The reason I say 2) should be temporary is because it a) adds technical debt and b) makes these APIs (which are already complicated and nuanced) harder to reason about, so we should strive to remove it rather than introducing another possible path for confusion.

Open in Gerrit

Related details

Attention is currently required from:
  • Justin DeWitt
  • Yuheng Huang
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: I9e43e4349d1098086a5e6e0b7e783e7c6a3d6703
    Gerrit-Change-Number: 7885468
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Justin DeWitt <dew...@chromium.org>
    Gerrit-Reviewer: Yuheng Huang <yuh...@chromium.org>
    Gerrit-CC: David Trainor <dtra...@chromium.org>
    Gerrit-CC: Tommy Nyquist <nyq...@chromium.org>
    Gerrit-Attention: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Attention: Justin DeWitt <dew...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 18:20:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin DeWitt (Gerrit)

    unread,
    May 29, 2026, 4:05:31 PM (3 days ago) May 29
    to Yuheng Huang, Devlin Cronin, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Yuheng Huang

    Justin DeWitt added 2 comments

    File chrome/browser/extensions/api/glic_private/glic_private_api.cc
    Line 456, Patchset 3 (Latest): // Get the outer web contents to handle cases where the frame is inside a
    Justin DeWitt . unresolved

    This is very general, I think the code should be more tailored to this case. For example:

    ```
    if (auto* guest_view = WebViewGuest::FromRenderFrameHost(rfh) &&
    contextual_tasks::GetWebUiInterface(guest_view->embedder_web_contents()) {
    web_contents = guest_view->embedder_web_contents();
    }
    ```
    Line 460, Patchset 3 (Latest): while (web_contents->GetOuterWebContents()) {
    Justin DeWitt . unresolved

    is this loop just web_contents->GetOutermostWebContents()

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yuheng Huang
    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: I9e43e4349d1098086a5e6e0b7e783e7c6a3d6703
    Gerrit-Change-Number: 7885468
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Justin DeWitt <dew...@chromium.org>
    Gerrit-Reviewer: Yuheng Huang <yuh...@chromium.org>
    Gerrit-CC: David Trainor <dtra...@chromium.org>
    Gerrit-CC: Tommy Nyquist <nyq...@chromium.org>
    Gerrit-Attention: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 20:05:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin DeWitt (Gerrit)

    unread,
    May 29, 2026, 4:08:29 PM (3 days ago) May 29
    to Yuheng Huang, Devlin Cronin, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Yuheng Huang

    Justin DeWitt added 2 comments

    File chrome/browser/extensions/api/glic_private/glic_messaging_browsertest.cc
    Line 206, Patchset 3 (Latest): // Navigate the active tab to chrome://glic/.
    Justin DeWitt . unresolved

    we want this to work in contextual tasks, not chrome://glic

    Line 215, Patchset 3 (Latest): while (document.body.firstChild) {
    document.body.removeChild(document.body.firstChild);
    }
    Justin DeWitt . unresolved

    why?

    Gerrit-Comment-Date: Fri, 29 May 2026 20:08:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yuheng Huang (Gerrit)

    unread,
    May 29, 2026, 6:40:12 PM (3 days ago) May 29
    to Devlin Cronin, Justin DeWitt, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Devlin Cronin

    Yuheng Huang added 1 comment

    File extensions/browser/api/messaging/extension_message_port.cc
    Line 446, Patchset 3 (Latest): if (!source_frame.document_id.is_empty()) {
    Devlin Cronin . unresolved

    As I mentioned in the associated bug, this is a *public-facing* API that's used today by lots and lots of extensions. Changing this behavior risks breaking them, since some could potentially be relying on this being undefined in various contexts. For instance, something like the code below:

    ```
    if (sender.documentId) {
    // Sender is in a tab; otherwise documentId is undefined.
    executeScript(getTabWithDocumentId(sender.documentId));
    }
    ```

    I'm amenable to changing this for all extensions, but it is something we need to a) discuss, b) communicate, and c) test (as part of the public API).

    WDYT about:
    1) Filing a public bug and starting the discussion to always populate documentId when there's an associated frame?
    2) As a *temporary* hack, populating documentId unconditionally if the connection is a webview to a component extension? (I think Justin mentioned this already in the bug?)

    The reason I say 2) should be temporary is because it a) adds technical debt and b) makes these APIs (which are already complicated and nuanced) harder to reason about, so we should strive to remove it rather than introducing another possible path for confusion.

    Yuheng Huang

    Thanks Devlin. That makes sense. Can we land this before the API change discussion if 2 is addressed?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Devlin Cronin
    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: I9e43e4349d1098086a5e6e0b7e783e7c6a3d6703
    Gerrit-Change-Number: 7885468
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Justin DeWitt <dew...@chromium.org>
    Gerrit-Reviewer: Yuheng Huang <yuh...@chromium.org>
    Gerrit-CC: David Trainor <dtra...@chromium.org>
    Gerrit-CC: Tommy Nyquist <nyq...@chromium.org>
    Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 22:40:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Devlin Cronin (Gerrit)

    unread,
    1:56 PM (3 hours ago) 1:56 PM
    to Yuheng Huang, Devlin Cronin, Justin DeWitt, Tommy Nyquist, David Trainor, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Yuheng Huang

    Devlin Cronin added 1 comment

    File extensions/browser/api/messaging/extension_message_port.cc
    Line 446, Patchset 3 (Latest): if (!source_frame.document_id.is_empty()) {
    Devlin Cronin . unresolved

    As I mentioned in the associated bug, this is a *public-facing* API that's used today by lots and lots of extensions. Changing this behavior risks breaking them, since some could potentially be relying on this being undefined in various contexts. For instance, something like the code below:

    ```
    if (sender.documentId) {
    // Sender is in a tab; otherwise documentId is undefined.
    executeScript(getTabWithDocumentId(sender.documentId));
    }
    ```

    I'm amenable to changing this for all extensions, but it is something we need to a) discuss, b) communicate, and c) test (as part of the public API).

    WDYT about:
    1) Filing a public bug and starting the discussion to always populate documentId when there's an associated frame?
    2) As a *temporary* hack, populating documentId unconditionally if the connection is a webview to a component extension? (I think Justin mentioned this already in the bug?)

    The reason I say 2) should be temporary is because it a) adds technical debt and b) makes these APIs (which are already complicated and nuanced) harder to reason about, so we should strive to remove it rather than introducing another possible path for confusion.

    Yuheng Huang

    Thanks Devlin. That makes sense. Can we land this before the API change discussion if 2 is addressed?

    Devlin Cronin

    Yes, as long as a) it's intended as temporary (I'd like if we can start the discussion for 1] before landing this) and b) it has no public-facing API implications.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yuheng Huang
    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: I9e43e4349d1098086a5e6e0b7e783e7c6a3d6703
    Gerrit-Change-Number: 7885468
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Reviewer: Justin DeWitt <dew...@chromium.org>
    Gerrit-Reviewer: Yuheng Huang <yuh...@chromium.org>
    Gerrit-CC: David Trainor <dtra...@chromium.org>
    Gerrit-CC: Tommy Nyquist <nyq...@chromium.org>
    Gerrit-Attention: Yuheng Huang <yuh...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 17:56:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
    Comment-In-Reply-To: Yuheng Huang <yuh...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages