Extensions: SidePanel: Delay .onOpened until ExtensionHost loads [chromium/src : main]

0 views
Skip to first unread message

Solomon Kinard (Gerrit)

unread,
Jun 25, 2026, 8:58:20 PMJun 25
to chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

Solomon Kinard has uploaded the change for review

Commit message

Extensions: SidePanel: Delay .onOpened until ExtensionHost loads

Previously, the chrome.sidePanel.onOpened event was dispatched
immediately when the side panel UI opened. However, at this exact
moment, the ExtensionHost had not yet finished its first load, meaning
its underlying RenderFrameHost was not fully registered with the
ProcessManager. As a result, calls to chrome.runtime.getContexts()
within an onOpened listener would fail to discover the newly created
side panel context and unexpectedly return an empty array.

This CL fixes the race condition by having ExtensionSidePanelCoordinator
observe the ExtensionHost. We now delay dispatching the onOpened event
until the host completes its first load (has_loaded_once() becomes true).
Additionally, this introduces has_dispatched_on_opened_ to track the
dispatch state. This guarantees that if a user rapidly closes the side
panel before it finishes loading (preventing onOpened from firing),
we avoid dispatching an unmatched onClosed event.
Bug: 524864604
Change-Id: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8

Change diff


Change information

Files:
  • M chrome/browser/extensions/api/runtime/runtime_apitest.cc
  • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
  • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.h
Change size: M
Delta: 3 files changed, 106 insertions(+), 5 deletions(-)
Open in Gerrit

Related details

Attention set is empty
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: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
Gerrit-Change-Number: 8008154
Gerrit-PatchSet: 1
Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Solomon Kinard (Gerrit)

unread,
Jun 25, 2026, 10:06:32 PMJun 25
to Kelvin Jiang, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Kelvin Jiang

Solomon Kinard added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Solomon Kinard . resolved

Review?

Open in Gerrit

Related details

Attention is currently required from:
  • Kelvin Jiang
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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
Gerrit-Change-Number: 8008154
Gerrit-PatchSet: 1
Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
Gerrit-Attention: Kelvin Jiang <kelvi...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Jun 2026 02:06:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kelvin Jiang (Gerrit)

unread,
Jun 29, 2026, 6:20:36 PMJun 29
to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Solomon Kinard

Kelvin Jiang added 9 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Kelvin Jiang . resolved

Thanks Solomon!

File chrome/browser/extensions/api/runtime/runtime_apitest.cc
Line 1393, Patchset 2 (Latest):IN_PROC_BROWSER_TEST_F(RuntimeGetContextsSidePanelTest,
Kelvin Jiang . unresolved

Curious: Were we able to successfully repro the race condition?

Line 1430, Patchset 2 (Latest): chrome.test.fail('Expected 1 context, but got ' + contexts.length);
Kelvin Jiang . unresolved

nit: template strings

Line 1447, Patchset 2 (Latest): // Wait for the result. If it fails (e.g., the bug is present and returns 0),
Kelvin Jiang . unresolved

tiny nit: extra comma

File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.h
Line 178, Patchset 2 (Latest): bool has_dispatched_on_opened_ = false;
Kelvin Jiang . unresolved

nit: `on_opened_dispatched_` ?

Line 82, Patchset 2 (Latest): // is destroyed.
Kelvin Jiang . unresolved

nit: since it's mentioned in the CL description, let's update the comment here to mention that the actual OnClosed() event should only be dispatched if OnOpened() was dispatched prior?

File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
Line 231, Patchset 2 (Latest): OnOpened();
Kelvin Jiang . unresolved

So it's possible that OnOpened never gets called because the panel UI is open but the host never finishes loading so the extension's side panel content never gets rendered, but this would be WAI?

Line 285, Patchset 2 (Latest): scoped_host_observation_.Reset();
Kelvin Jiang . unresolved

nit: let's reset the observation right after `host_` gets created, around line 265?

Line 338, Patchset 2 (Latest): if (has_dispatched_on_opened_) {
OnClosed();
}
Kelvin Jiang . unresolved

Nit: noticed a few times OnClosed() was wrapped with this if statement. Why not have OnClosed() no-op if `has_dispatched_on_opened_` is false inside the function?

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 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
    Gerrit-Change-Number: 8008154
    Gerrit-PatchSet: 2
    Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Comment-Date: Mon, 29 Jun 2026 22:20:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Solomon Kinard (Gerrit)

    unread,
    Jul 21, 2026, 6:15:39 PM (3 days ago) Jul 21
    to Kelvin Jiang, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Kelvin Jiang

    Solomon Kinard added 8 comments

    Patchset-level comments
    File-level comment, Patchset 4 (Latest):
    Solomon Kinard . resolved

    Thanks. Back from vacay.

    File chrome/browser/extensions/api/runtime/runtime_apitest.cc
    Line 1393, Patchset 2:IN_PROC_BROWSER_TEST_F(RuntimeGetContextsSidePanelTest,
    Kelvin Jiang . unresolved

    Curious: Were we able to successfully repro the race condition?

    Solomon Kinard

    Is the question does the test not pass before changes to the non-test files? If so, the answer is yes.

    Line 1430, Patchset 2: chrome.test.fail('Expected 1 context, but got ' + contexts.length);
    Kelvin Jiang . resolved

    nit: template strings

    Solomon Kinard

    Done

    Line 1447, Patchset 2: // Wait for the result. If it fails (e.g., the bug is present and returns 0),
    Kelvin Jiang . resolved

    tiny nit: extra comma

    Solomon Kinard

    Done

    File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.h
    Line 178, Patchset 2: bool has_dispatched_on_opened_ = false;
    Kelvin Jiang . resolved

    nit: `on_opened_dispatched_` ?

    Solomon Kinard

    Done

    Line 82, Patchset 2: // is destroyed.
    Kelvin Jiang . resolved

    nit: since it's mentioned in the CL description, let's update the comment here to mention that the actual OnClosed() event should only be dispatched if OnOpened() was dispatched prior?

    Solomon Kinard

    Done

    File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
    Kelvin Jiang . unresolved

    So it's possible that OnOpened never gets called because the panel UI is open but the host never finishes loading so the extension's side panel content never gets rendered, but this would be WAI?

    Solomon Kinard

    Yes, the intention was that it is safer to not fire onOpened at all rather than fire it before the context is ready (which causes the empty array issue).

    However, I might be missing a downstream consequence of leaving the extension waiting indefinitely if the host hangs. Is there a preferred way to handle this edge case?

    Line 285, Patchset 2: scoped_host_observation_.Reset();
    Kelvin Jiang . resolved

    nit: let's reset the observation right after `host_` gets created, around line 265?

    Solomon Kinard

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Kelvin Jiang
    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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
    Gerrit-Change-Number: 8008154
    Gerrit-PatchSet: 4
    Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Attention: Kelvin Jiang <kelvi...@chromium.org>
    Gerrit-Comment-Date: Tue, 21 Jul 2026 22:15:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kelvin Jiang <kelvi...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kelvin Jiang (Gerrit)

    unread,
    Jul 22, 2026, 6:11:04 AM (3 days ago) Jul 22
    to Solomon Kinard, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Devlin Cronin and Solomon Kinard

    Kelvin Jiang voted and added 6 comments

    Votes added by Kelvin Jiang

    Code-Review+1

    6 comments

    Patchset-level comments
    Kelvin Jiang . resolved

    Thanks Solomon! This LG though I'm passing this comment to Devlin:

    https://chromium-review.git.corp.google.com/c/chromium/src/+/8008154/comment/0e1acc71_372b1030/

    File chrome/browser/extensions/api/runtime/runtime_apitest.cc
    Line 1393, Patchset 2:IN_PROC_BROWSER_TEST_F(RuntimeGetContextsSidePanelTest,
    Kelvin Jiang . resolved

    Curious: Were we able to successfully repro the race condition?

    Solomon Kinard

    Is the question does the test not pass before changes to the non-test files? If so, the answer is yes.

    Kelvin Jiang

    works for me

    Line 1453, Patchset 4 (Latest): // Trigger the action.onClicked listener
    Kelvin Jiang . unresolved

    miniscule nit: missing period

    File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
    Kelvin Jiang . unresolved

    So it's possible that OnOpened never gets called because the panel UI is open but the host never finishes loading so the extension's side panel content never gets rendered, but this would be WAI?

    Solomon Kinard

    Yes, the intention was that it is safer to not fire onOpened at all rather than fire it before the context is ready (which causes the empty array issue).

    However, I might be missing a downstream consequence of leaving the extension waiting indefinitely if the host hangs. Is there a preferred way to handle this edge case?

    Kelvin Jiang

    Someone more familiar with top level extension UI itself may be more knowledgeable on this since extension hosts aren't just for side panels?

    Line 269, Patchset 4 (Latest): scoped_host_observation_.Observe(host_.get());
    Kelvin Jiang . unresolved

    nit: move this after the `if (!host_)` block

    Line 338, Patchset 2: if (has_dispatched_on_opened_) {
    OnClosed();
    }
    Kelvin Jiang . resolved

    Nit: noticed a few times OnClosed() was wrapped with this if statement. Why not have OnClosed() no-op if `has_dispatched_on_opened_` is false inside the function?

    Kelvin Jiang

    (this is resolved)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Devlin Cronin
    • Solomon Kinard
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
    Gerrit-Change-Number: 8008154
    Gerrit-PatchSet: 4
    Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-CC: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Comment-Date: Wed, 22 Jul 2026 10:10:50 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Solomon Kinard <solomo...@chromium.org>
    Comment-In-Reply-To: Kelvin Jiang <kelvi...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Devlin Cronin (Gerrit)

    unread,
    Jul 22, 2026, 6:37:36 PM (2 days ago) Jul 22
    to Solomon Kinard, Kelvin Jiang, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Solomon Kinard

    Devlin Cronin added 2 comments

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

    (just responding; didn't review fully. But no high level concerns)

    File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
    Kelvin Jiang . unresolved

    So it's possible that OnOpened never gets called because the panel UI is open but the host never finishes loading so the extension's side panel content never gets rendered, but this would be WAI?

    Solomon Kinard

    Yes, the intention was that it is safer to not fire onOpened at all rather than fire it before the context is ready (which causes the empty array issue).

    However, I might be missing a downstream consequence of leaving the extension waiting indefinitely if the host hangs. Is there a preferred way to handle this edge case?

    Kelvin Jiang

    Someone more familiar with top level extension UI itself may be more knowledgeable on this since extension hosts aren't just for side panels?

    Devlin Cronin

    ExtensionHosts aren't just for side panels, but this doesn't seem to be changing ExtensionHosts at all -- it's just using the notification from the host to trigger the OnOpened event, which is only for side panels.

    I think this is fine -- if the extension never loads once, we don't dispatch the onOpened event, but that could even be working as intended. A developer would expect that the side panel be "available" once onOpened is fired, and any number of operations (such as getContexts, as in the bug, or sending a message) might fail if it's not initialized yet.

    Overall, I think this is fine.

    Kelvin, did you have a particular concern with regard to the extension host integration?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Solomon Kinard
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
    Gerrit-Change-Number: 8008154
    Gerrit-PatchSet: 5
    Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-CC: Devlin Cronin <rdevlin...@chromium.org>
    Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Comment-Date: Wed, 22 Jul 2026 22:37:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kelvin Jiang (Gerrit)

    unread,
    Jul 22, 2026, 6:40:06 PM (2 days ago) Jul 22
    to Solomon Kinard, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Solomon Kinard

    Kelvin Jiang voted and added 4 comments

    Votes added by Kelvin Jiang

    Code-Review+1

    4 comments

    Patchset-level comments
    Kelvin Jiang . resolved

    s LGTM thanks Solomon!

    File chrome/browser/extensions/api/runtime/runtime_apitest.cc
    Line 1453, Patchset 4: // Trigger the action.onClicked listener
    Kelvin Jiang . resolved

    miniscule nit: missing period

    Kelvin Jiang

    (resolved)

    File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
    Kelvin Jiang . resolved

    So it's possible that OnOpened never gets called because the panel UI is open but the host never finishes loading so the extension's side panel content never gets rendered, but this would be WAI?

    Solomon Kinard

    Yes, the intention was that it is safer to not fire onOpened at all rather than fire it before the context is ready (which causes the empty array issue).

    However, I might be missing a downstream consequence of leaving the extension waiting indefinitely if the host hangs. Is there a preferred way to handle this edge case?

    Kelvin Jiang

    Someone more familiar with top level extension UI itself may be more knowledgeable on this since extension hosts aren't just for side panels?

    Devlin Cronin

    ExtensionHosts aren't just for side panels, but this doesn't seem to be changing ExtensionHosts at all -- it's just using the notification from the host to trigger the OnOpened event, which is only for side panels.

    I think this is fine -- if the extension never loads once, we don't dispatch the onOpened event, but that could even be working as intended. A developer would expect that the side panel be "available" once onOpened is fired, and any number of operations (such as getContexts, as in the bug, or sending a message) might fail if it's not initialized yet.

    Overall, I think this is fine.

    Kelvin, did you have a particular concern with regard to the extension host integration?

    Kelvin Jiang

    no just wanted to make sure I'm not missing anything

    Line 269, Patchset 4: scoped_host_observation_.Observe(host_.get());
    Kelvin Jiang . resolved

    nit: move this after the `if (!host_)` block

    Kelvin Jiang

    (Resolved)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Solomon Kinard
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
      Gerrit-Change-Number: 8008154
      Gerrit-PatchSet: 5
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-CC: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Comment-Date: Wed, 22 Jul 2026 22:39:52 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
      satisfied_requirement
      open
      diffy

      Solomon Kinard (Gerrit)

      unread,
      Jul 23, 2026, 3:19:28 AM (2 days ago) Jul 23
      to Kelvin Jiang, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Solomon Kinard voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
      Gerrit-Change-Number: 8008154
      Gerrit-PatchSet: 5
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-CC: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Comment-Date: Thu, 23 Jul 2026 07:19:13 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Jul 23, 2026, 3:26:37 AM (2 days ago) Jul 23
      to Solomon Kinard, Kelvin Jiang, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Chromium LUCI CQ submitted the change

      Unreviewed changes

      5 is the latest approved patch-set.
      No files were changed between the latest approved patch-set and the submitted one.

      Change information

      Commit message:
      Extensions: SidePanel: Delay .onOpened until ExtensionHost loads

      Previously, the chrome.sidePanel.onOpened event was dispatched
      immediately when the side panel UI opened. However, at this exact
      moment, the ExtensionHost had not yet finished its first load, meaning
      its underlying RenderFrameHost was not fully registered with the
      ProcessManager. As a result, calls to chrome.runtime.getContexts()
      within an onOpened listener would fail to discover the newly created
      side panel context and unexpectedly return an empty array.

      This CL fixes the race condition by having ExtensionSidePanelCoordinator
      observe the ExtensionHost. Dispatching now delays the onOpened event

      until the host completes its first load (has_loaded_once() becomes
      true). Additionally, this introduces on_opened_dispatched_ to track the

      dispatch state. This guarantees that if a user rapidly closes the side
      panel before it finishes loading (preventing onOpened from firing), it
      avoids dispatching an unmatched onClosed event.
      Bug: 524864604
      Change-Id: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
      Commit-Queue: Solomon Kinard <solomo...@chromium.org>
      Reviewed-by: Kelvin Jiang <kelvi...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1666877}
      Files:
      • M chrome/browser/extensions/api/runtime/runtime_apitest.cc
      • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
      • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.h
      Change size: M
      Delta: 3 files changed, 111 insertions(+), 2 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Kelvin Jiang
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
      Gerrit-Change-Number: 8008154
      Gerrit-PatchSet: 10
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      open
      diffy
      satisfied_requirement

      luci-bisection@appspot.gserviceaccount.com (Gerrit)

      unread,
      Jul 23, 2026, 5:47:26 AM (2 days ago) Jul 23
      to Solomon Kinard, Chromium LUCI CQ, Kelvin Jiang, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Message from luci-bi...@appspot.gserviceaccount.com

      LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5368776729034752

      Sample build with failed test: https://ci.chromium.org/b/8675502500319981073
      Affected test(s):
      [://chrome/test\:browser_tests!gtest::ExtensionOnClosedEventSidePanelBrowserTest#OnClosedEvent_WindowClosed](https://ci.chromium.org/ui/test/chromium/:%2F%2Fchrome%2Ftest%5C:browser_tests%21gtest::ExtensionOnClosedEventSidePanelBrowserTest%23OnClosedEvent_WindowClosed?q=VHash%3Aec8fe31d28138961)
      A revert for this change was not created because the builder that this CL broke is not watched by gardeners, therefore less important. You can consider revert this CL, fix forward or let builder owners resolve it themselves.

      If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5368776729034752&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F8008154&type=BUG

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Ibe9ef1920eef62aa9d1298d4ef1194736348a3a8
      Gerrit-Change-Number: 8008154
      Gerrit-PatchSet: 10
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-CC: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Comment-Date: Thu, 23 Jul 2026 09:47:12 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy

      Ali Hijazi (Gerrit)

      unread,
      Jul 23, 2026, 8:42:42 AM (2 days ago) Jul 23
      to Solomon Kinard, Chromium LUCI CQ, luci-bi...@appspot.gserviceaccount.com, Kelvin Jiang, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Ali Hijazi has created a revert of this change

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: revert
      satisfied_requirement
      open
      diffy

      Solomon Kinard (Gerrit)

      unread,
      Jul 24, 2026, 1:38:41 AM (yesterday) Jul 24
      to chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Solomon Kinard has uploaded the change for review

      Commit message

      Extensions: SidePanel: Delay .onOpened until ExtensionHost loads

      Previously, the chrome.sidePanel.onOpened event was dispatched
      immediately when the side panel UI opened. However, at this exact
      moment, the ExtensionHost had not yet finished its first load, meaning
      its underlying RenderFrameHost was not fully registered with the
      ProcessManager. As a result, calls to chrome.runtime.getContexts()
      within an onOpened listener would fail to discover the newly created
      side panel context and unexpectedly return an empty array.

      This CL fixes the race condition by having ExtensionSidePanelCoordinator
      observe the ExtensionHost. Dispatching now delays the onOpened event
      until the host completes its first load (has_loaded_once() becomes
      true). Additionally, this introduces on_opened_dispatched_ to track the
      dispatch state. This guarantees that if a user rapidly closes the side
      panel before it finishes loading (preventing onOpened from firing), it
      avoids dispatching an unmatched onClosed event.
      Bug: 524864604
      Change-Id: Ia136fcb23507abd9b96d7e9c6f5ee6574a57e0d7

      Change diff


      Change information

      Files:
      • M chrome/browser/extensions/api/runtime/runtime_apitest.cc
      • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.cc
      • M chrome/browser/ui/views/side_panel/extensions/extension_side_panel_coordinator.h
      Change size: M
      Delta: 3 files changed, 111 insertions(+), 2 deletions(-)

      Related details

      Attention set is empty
      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: newchange
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ia136fcb23507abd9b96d7e9c6f5ee6574a57e0d7
      Gerrit-Change-Number: 8137935
      Gerrit-PatchSet: 1
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Solomon Kinard (Gerrit)

      unread,
      Jul 24, 2026, 8:34:52 AM (20 hours ago) Jul 24
      to Kelvin Jiang, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
      Attention needed from Kelvin Jiang

      Solomon Kinard added 2 comments

      Patchset-level comments
      File-level comment, Patchset 2 (Latest):
      Solomon Kinard . resolved

      Reland?

      File chrome/browser/ui/views/side_panel/extensions/extension_side_panel_browsertest.cc
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Kelvin Jiang
      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: Ia136fcb23507abd9b96d7e9c6f5ee6574a57e0d7
      Gerrit-Change-Number: 8137935
      Gerrit-PatchSet: 2
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Attention: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Comment-Date: Fri, 24 Jul 2026 12:34:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Kelvin Jiang (Gerrit)

      unread,
      2:12 AM (2 hours ago) 2:12 AM
      to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
      Attention needed from Solomon Kinard

      Kelvin Jiang voted and added 1 comment

      Votes added by Kelvin Jiang

      Code-Review+1

      1 comment

      Patchset-level comments
      Kelvin Jiang . resolved

      LGTM thanks Solomon!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Solomon Kinard
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Ia136fcb23507abd9b96d7e9c6f5ee6574a57e0d7
      Gerrit-Change-Number: 8137935
      Gerrit-PatchSet: 2
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Comment-Date: Sat, 25 Jul 2026 06:12:15 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Solomon Kinard (Gerrit)

      unread,
      2:17 AM (2 hours ago) 2:17 AM
      to Kelvin Jiang, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Solomon Kinard voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement 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: Ia136fcb23507abd9b96d7e9c6f5ee6574a57e0d7
      Gerrit-Change-Number: 8137935
      Gerrit-PatchSet: 2
      Gerrit-Owner: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Reviewer: Kelvin Jiang <kelvi...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Comment-Date: Sat, 25 Jul 2026 06:17:02 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages