Skip to content

Define targetSnapshotParams in the javascript: steps - #12572

Closed
zcorpan wants to merge 1 commit into
mainfrom
zcorpan/javascript-url-targetSnapshotParams
Closed

zcorpan wants to merge 1 commit into
mainfrom
zcorpan/javascript-url-targetSnapshotParams

Conversation

@zcorpan

@zcorpan zcorpan commented Jun 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #12563.

(No PR template since this is a spec bug fix.)

cc @AtkinsSJ


/browsing-the-web.html ( diff )

@zcorpan zcorpan added the topic: javascript: URLs Navigating to and evaluating javascript: URLs label Jun 16, 2026
@shannonbooth

shannonbooth commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

I tried looking into implementing this with a corresponding test,
saw #12303 seems to be superset of these changes. I have written a WPT for this here: web-platform-tests/wpt#63223 since it did not seem covered

I did also notice trying to implement that step 2 of the https://html.spec.whatwg.org/multipage/dom.html#internal-ancestor-origin-objects-list-creation-steps takes parentDoc from document's container document, which is null until document is active, and for example with "create a new browsing context and document" that document is not active by that stage (so ends up being null unintentionally). I think this could be fixed by passing parentDoc as a parameter

Claude summary of that:

Step 2 of the internal ancestor origin objects list creation steps sets parentDoc to document's container document. That goes through document's node navigable, which is null until document becomes some navigable's active document.

Both callers run before that happens:

create a new browsing context and document, step 17
initialize the document object, step 11

So parentDoc is always null, and every document's location.ancestorOrigins is empty. That contradicts browsers and WPT, for example location-ancestor-origins-new-object.html. This came from #12071.

Suggested fix: pass parentDoc in from the callers. That would be the embedder's node document for the initial about:blank, and navigationParams's navigable's container document otherwise. Step 6's unused container (#12566) has the same problem, so it can't serve as the fix.

@zcorpan

zcorpan commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Comment by Claude:

Closing in favor of #12303, which makes the same fix (now rebased and marked as fixing #12563). Thanks @shannonbooth for the test; it's linked from there. The parentDoc issue you raised will get its own issue.

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

Labels

topic: javascript: URLs Navigating to and evaluating javascript: URLs

Development

Successfully merging this pull request may close these issues.

"Evaluate a javascript url" refers to non-existent targetSnapshotParams.

2 participants