w3c / w3c/webdriver

New Window and HTML's "is created by web content flag", all implementations differ from spec

Open
#1,972 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

HTML now defines when a top-level traversable is script-closable, ie whether window.close() works, based on a "is created by web content" flag (whatwg/html#11208, merged in April 2025). A window is script-closable if the flag is set or its session history contains only one entry.

The New Window command is currently specified as creating the new top-level browsing context by running the window open steps. The window open steps set "is created by web content" on the new window. The direct reading of the text suggests that driver-created windows carry the flag and remain script-closable forever, the same behavior as a window.open() popup.

No current implementation does that. I probed Chrome 151 (chromedriver), Firefox 154 (geckodriver) and Safari 26.6.2 (safaridriver). With all three, a window created with New Window and then navigated so its session history is greater than 1 ignores window.close(). All three behave as if the flag is unset. Windows created with window.open(), including noopener, stay closable in all three at any history depth (More info in this comment).

Proposal: Codify the current implemented behavior. Specify that New Window creates the top-level browsing context as if the user had opened a new window, with the "is created by web content" flag unset.

Context: I am working on making the session-history arm of HTML's script-closable checks testable in WPT. The plan is to add test_driver.create_window() backed by New Window.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the New Window command and its reference to the window open steps, then compare the HTML script-closable rules described in the issue with the current WebDriver behavior. Review the planned WPT coverage using test_driver.create_window() and the session-history cases. Done means the specification clearly defines the flag state for New Window and the relevant behavior is testable in WPT.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation, web-dev
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.