Skip to content

Fix history when there's an URL change without a corresponding loadStarted signal

Stefano Crocco requested to merge work/stefanocrocco/fix-history into master

This happens, for example, when the page uses the history API to trigger a navigation. See https://bugreports.qt.io/browse/QTBUG-115589.

BUG: 467850

To work around the issue, WebEnginePart::slotUrlChanged will call WebEnginePage::slotLoadStarted, if needed, ensuring that history recording is triggered. To determine whether this is needed, WebEnginePart records the URL for which WebEnginePage::acceptNavigationRequest was last called (for main frames only). Since this URL is the same (except for fragments) as that passed to WebEnginePart::slotUrlChanged, it means that the WebEnginePage::loadStarted has already been called for that URL, so WebEnginePart::slotUrlChanged doesn't need to WebEnginePage::slotLoadStarted. If the two URLs are different, instead, it means that WebEnginePage::loadStarted hasn't been called for that URL and WebEnginePart::slotUrlChanged needs to do it.

Merge request reports