Skip to content

feat(extensions): expose extension popup as page event#41260

Draft
Skn0tt wants to merge 5 commits into
microsoft:mainfrom
Skn0tt:skn0tt/extension-attach-test
Draft

feat(extensions): expose extension popup as page event#41260
Skn0tt wants to merge 5 commits into
microsoft:mainfrom
Skn0tt:skn0tt/extension-attach-test

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jun 12, 2026

Copy link
Copy Markdown
Member

See #40554

Skn0tt added 5 commits June 11, 2026 15:24
…t#40554)

Adds an MV3 popup extension asset and an it.fixme test asserting that an
extension action popup should surface as a context 'page' event. Currently
blocked upstream: initializing the popup target as a CRPage under
PW_CHROMIUM_ATTACH_TO_OTHER crashes Chrome.

The launchPersistentContext fixture now appends options.args additively so
tests can pass extra Chromium flags.
Experimental, PW_PROBE-gated scaffolding (NOT for shipping). Demonstrates
that a tab-target migration CAN capture a popup's first navigation request
when Network.enable is enqueued synchronously and the paused renderer is
resumed immediately after (without awaiting the enable ack).

Finding: requestWillBeSent + responseReceived are delivered to the popup's
own page session and the popup surfaces as a context event. The only gap is
Network.loadingFinished, which Chrome routes to the tab/browser session
(no Network domain) instead of the page session, so response.finished()
hangs. This is a narrow session-routing issue, not the structural
"first request is lost" limitation previously assumed.

Default behavior is unchanged when PW_PROBE is unset.
Connection-level CDP tap + waitingForDebugger logging establish, across
three resume orderings, why the tab-target model cannot preserve the
popup main-request lifecycle:

- nested page attaches UN-paused (pre-exists the tab setAutoAttach);
- tab-level pause freezes Network.enable on the page session;
- await-ack-before-resume deadlocks -> ERR_ABORTED + target teardown;
- enqueue+resume-together captures will+response (replayed from cached
  metadata) but Chrome never streams dataReceived/loadingFinished.

Classic mode works only because the page attaches PAUSED at the page
level, where domain setup completes before the renderer is resumed.
The tab-target migration cannot preserve the popup main-request
lifecycle guarantee (page-network-request.spec.ts:478) -- see the two
preceding WIP commits for the empirical proof. Restoring the chromium
core files to baseline so the branch ships only the safe deliverable
(extension-popup asset + documented it.fixme test).
@Skn0tt

Skn0tt commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant