Open Bug 2076693 Opened 2 months ago Updated 9 days ago

History traversal started from an iframe uses a speculation-rules prefetch made by the parent document

Categories

(Core :: DOM: Networking, defect, P2)

defect

Tracking

()

ASSIGNED

People

(Reporter: smayya, Assigned: helmut)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 external file)

speculation-rules/prefetch/prefetch-traverse-reload.sub.html fails with the patches for bug 2070841:

History's Document is used for traversal navigations: assert_equals: prefetch from different Document should not be used expected (undefined) undefined but got (string) "prefetch"

The top-level document prefetches the previous URL, then calls history.go(-1) from a child iframe's history. Per the traversal algorithm in the HTML spec, the source document is the one that owns History, here the iframe's document, so the parent's prefetch records shouldn't be considered. We activate the parent's prefetch anyway. DocumentLoadListener::TryActivateFromPrefetch looks up records on the browsing context's current window rather than on the document that started the traversal.

https://wpt.fyi/results/speculation-rules/prefetch?label=master&label=experimental&aligned&q=prefetch-traverse-reload.sub.html

Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
See Also: → 2077601

When nsHistory::DeltaTraverse runs on an iframe's History object the
traversal retargets to the top-level traversable, but the resulting
navigation still belongs to the iframe's Document. Thread that Document's
inner window id through ChildSHistory, HistoryGo and nsSHistory::
InitiateLoad so the loadState carries it as TriggeringWindowId, and
forward it on the content side from nsDocShell::LoadURI's session-history
branch into LoadHistoryEntry.

In DocumentLoadListener::TryActivateFromPrefetch, drop the prefetch
record when the initiator's inner window id does not match the current
Document, matching "traverse the history by a delta" using the History's
Document as the source.

Assignee: nobody → helmut
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: