history.pushState() and replaceState() updated the navigation entry
but did not update page.url or reinitialize window.location. This
caused location.pathname to return the old value after pushState,
breaking SPA routing detection in automation scripts.
Both methods now set page.url and re-init the Location object after
updating the navigation history.
Fixes#2081
Ref #2043