fix extension runtime session routing for oopif iframe locators
Route Runtime.enable/disable through the incoming child sessionId instead of always using the tab root session so OOPIF iframe targets receive execution contexts reliably. Add a focused relay regression test for empty-src cross-origin iframe attach flow and update extension version/changelog for release tracking.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.71
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **Route Runtime.enable to child CDP sessions**: Runtime enable/disable now uses the incoming `sessionId` when targeting OOPIF child sessions instead of always using the tab root session. This fixes missing `Runtime.executionContextCreated` events for child iframe targets, which could cause iframe locator operations to hang.
|
||||
|
||||
## 0.0.69
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Playwriter",
|
||||
"version": "0.0.70",
|
||||
"version": "0.0.71",
|
||||
"description": "Automate your Browser using Cursor, Claude, VS Code. More capable and context efficient than Playwright MCP.",
|
||||
"permissions": ["debugger", "tabGroups", "contextMenus", "tabs", "tabCapture", "offscreen", "identity", "identity.email"],
|
||||
"host_permissions": ["<all_urls>"],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mcp-extension",
|
||||
"version": "0.0.69",
|
||||
"version": "0.0.71",
|
||||
"description": "Playwright MCP Browser Extension",
|
||||
"private": true,
|
||||
"repository": {
|
||||
|
||||
@@ -859,6 +859,13 @@ async function handleCommand(msg: ExtensionCommandMessage): Promise<any> {
|
||||
if (!debuggee) {
|
||||
throw new Error(`No debuggee found for Runtime.enable (sessionId: ${msg.params.sessionId})`)
|
||||
}
|
||||
// Keep Runtime.enable bound to the incoming child sessionId for OOPIF iframes.
|
||||
// If we send Runtime.enable on the tab root session, child iframe targets never
|
||||
// emit Runtime.executionContextCreated and frame locators can hang.
|
||||
const runtimeSession: chrome.debugger.DebuggerSession = {
|
||||
...debuggee,
|
||||
sessionId: msg.params.sessionId !== targetTab?.sessionId ? msg.params.sessionId : undefined,
|
||||
}
|
||||
// When multiple Playwright clients connect to the same tab, each calls Runtime.enable.
|
||||
// If Runtime is already enabled, the enable call succeeds but Chrome doesn't re-send
|
||||
// Runtime.executionContextCreated events - those were already sent to the first client.
|
||||
@@ -866,12 +873,12 @@ async function handleCommand(msg: ExtensionCommandMessage): Promise<any> {
|
||||
// re-enable, ensuring the new client receives them. The relay server waits for the
|
||||
// executionContextCreated events before returning. See cdp-timing.md for details.
|
||||
try {
|
||||
await chrome.debugger.sendCommand(debuggee, 'Runtime.disable')
|
||||
await chrome.debugger.sendCommand(runtimeSession, 'Runtime.disable')
|
||||
await sleep(50)
|
||||
} catch (e) {
|
||||
logger.debug('Error disabling Runtime (ignoring):', e)
|
||||
}
|
||||
return await chrome.debugger.sendCommand(debuggee, 'Runtime.enable', msg.params.params)
|
||||
return await chrome.debugger.sendCommand(runtimeSession, 'Runtime.enable', msg.params.params)
|
||||
}
|
||||
|
||||
case 'Target.createTarget': {
|
||||
|
||||
Reference in New Issue
Block a user