
This is handled by ClassifyNavigation, which determines which RendererDidNavigate helper methods are used when a navigation commits. These types may lead to different outcomes for whether a new NavigationEntry is created, whether an existing one is updated vs replaced, and what events are exposed to observers. Much of the complexity in NavigationController comes from the bookkeeping needed to track the various types of navigations as they commit (e.g., same-document vs cross-document, main frame vs subframe, with or without replacement, etc). NavigationController uses these ISNs and DSNs when deciding which frames need to be navigated during a session history navigation, using a recursive frame tree walk in FindFramesToNavigate. Cross-document navigations create a new ISN and DSN.

Same-document navigations create a new session history item without changing the document, and thus have a new ISN but the same DSN. Identifying Same- and Cross-Document NavigationsĮach FrameNavigationEntry contains both an item sequence number (ISN) and a document sequence number (DSN).

If the user goes back and then commits a new navigation, this essentially forks the joint session history.

Identifying Same- and Cross-Document Navigations.
