microsoft / microsoft/vscode

Integrated browser: window.open opens a detached window that cannot communicate with its opener

Open
#336,231 0 comments 0 reactions 2 assignees Claimed by @kycutler View on GitHub
browser-integration bug
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

When an agent tests a website in the integrated browser and the page calls `window.open()`, the new page opens as a detached browser window. Communication between the two pages via `window.opener` / `window.postMessage()` does not appear to work as it would between normal browser windows.

One example is testing an HTML slide deck whose speaker-notes view opens in a separate window and exchanges messages with the original presentation window.

### Steps to reproduce

1. Open a website in the integrated browser that calls `window.open()` for a companion view.
2. Have the opener and opened page communicate using `window.postMessage()`.
3. Observe that a detached browser window opens, but opener-to-child communication does not work as expected.

### Expected behavior

Windows opened from the integrated browser preserve the normal opener relationship and support `postMessage()` communication. If that cannot be supported, the browser tooling should tell the agent when `window.open()` creates a detached window and explain the limitation so the agent can account for it while testing.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.