WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
226496
Extra history item added for alternate page when redirected/replaced URL fails to load
https://bugs.webkit.org/show_bug.cgi?id=226496
Summary
Extra history item added for alternate page when redirected/replaced URL fail...
Claudio Saavedra
Reported
2021-06-01 05:37:03 PDT
An alternate HTML loaded from an load error handler will not add a history item to the back-forward navigation history, as its load is meant to replace the failed URL content. Similarly, when a page is loaded via a window.location.replace(), no history item should be added to the back-forward navigation history, as the replaced URL is meant to replace the original URL. Both of these features work as expected, but when combined, an extra item is added when it shouldn't. To reproduce this, simply open any page, say
https://webkit.org
. Then from the web inspector, check the history length with
> window.history.length
Then call
> window.location.replace('
https://somerandombrokenurithat.wont.load
')
After an alternate HTML page loads, check again the history length, and you'll see that it has increased in one page. Going back loads again the page that was originally loaded, when it shouldn't (because of the window.location.replace() call). The culprit of the issue seems to be in the value of two WebKit::LoadParameters that are used to define how the load should behave, namely LoadParameters.shouldTreatAsContinuingLoad and LoadParameters.lockBackForwardList. When loading content via window.location.replace(), these are both set to true, which cause WebCore::FrameLoader::load(FrameLoadRequest&) to set its load type as FrameLoadType::RedirectWithLockedBackForwardList and later to not add an extra history item. However, when an alternate HTML is loaded, these two parameters are left to their default value, false. Hence the load gets a type of FrameLoadType::Standard. My first guess is that what we really want is that loads for alternate content inherit the value of those two parameters from the load that failed, so that loads that are not meant to modify the back-forward navigation don't accidentally cause new items to be added if the load fails. However so far I have not been able to find a good way to get the load properties for previous loads.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-06-08 05:37:17 PDT
<
rdar://problem/79002784
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug