Firefox throws from history APIS (e.g. pushState, replaceState) if it's been called rapidly enough to trigger the rate-limit
Categories
(Core :: DOM: Navigation, defect)
Tracking
()
People
(Reporter: dholbert, Assigned: farre)
References
(Regressed 1 open bug)
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:648
Attachments
(5 files, 1 obsolete file)
|
765 bytes,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr140+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr115+
|
Details | Review |
STR:
- Load attached testcase.
- (optional) Check web console.
EXPECTED RESULTS:
500 calls to pushState.
No exception thrown.
ACTUAL RESULTS:
200 calls to pushState.
Exception is thrown (which is why we stop at 200).
This is tracked in https://github.com/livewire/livewire/discussions/7746 . One comment there suggests flagging Firefox as unsupported as a result.
In bug 1993517 comment 6, we've got a bug where a Swedish banking site seems to be blocking Firefox-on-Windows due to this behavior:
// windows firefox produce recursive navigation error
// Too many calls to location or history APIs in a short period of time
// https://github.com/livewire/livewire/discussions/7746
if (isWindows && isFirefox) {
return <BankIDViewFirefoxError />;
}
(Windows is relevant there because the bank seems to optionally use a native Windows app, which they communicate with from the browser somehow; not sure if via a local web server or something else.)
Not sure whether it'd be prudent for us to change behavior here, but I wanted to file this since it's at least a behavioral difference with Chromium that's causing enough web-developer-trouble that Firefox is blocked in at least that one case.
| Reporter | ||
Comment 1•9 months ago
|
||
| Reporter | ||
Comment 2•9 months ago
•
|
||
Safari-on-macOS behaves like Firefox here, with an even stricter threshold - they throw after 100 calls to the history API, in my testcase. (And https://github.com/livewire/livewire/discussions/7746 does mention Safari as being affected, too.)
Chrome seems to be the only engine (among the major 3) to have no limit here to never throw exceptions here.
[Edited to clarify -- it's not that Chrome has no limit, but rather that they just make these history APIs silently-do-nothing when they've reached their limit.]
Comment 3•9 months ago
•
|
||
Gecko and webkit follow the spec
https://html.spec.whatwg.org/#shared-history-push/replace-state-steps:~:text=Optionally%2C%20throw,succession%2E%29
| Reporter | ||
Comment 4•9 months ago
•
|
||
Thanks. Looks like Chrome is willing to match the WebKit/Gecko spec-compliant behavior, per that whatwg issue, though they haven't had any recent activity on their bug ( https://issues.chromium.org/issues/40554715 ). Maybe this is a good reason to nudge them to adapt - that will hopefully push sites to handle this better rather than blocking specific browsers as is potentially the case in bug 1993517.
I was wondering how/why sites would even be running up against this - https://github.com/livewire/livewire/discussions/7746#discussioncomment-10389123 describes one scenario:
- "a ParentComponent that loads X amount of ChildComponents" (where X = 100)
- "all of the ChildComponents [store] state in the url search"
- So presumably each ChildComponent uses the history API once or twice to store some data in the
location.searchobject (the string after the?in the URL); and since there are 100 child-components, that means there are at least 100 such calls; and if these happen in rapid succession and surpass the browser's threshold, then one of the history API invocations will throw (if the browser is Safari or Firefox). - ...and If I'm understanding https://github.com/whatwg/html/issues/11108 correctly, current Chromium will currently just treat the throttled invocations as no-ops and some of the ChildComponent state will be silently lost instead of stored in the URL.
Updated•9 months ago
|
Updated•9 months ago
|
Comment 5•9 months ago
|
||
I commented in the Chromium issue.
Updated•9 months ago
|
Comment 6•9 months ago
|
||
We could increase the limit to, say, 1000. Pages can still hit the limit, but it's less likely. The limit was intended to not be reached by accident, but it seems from this issue it has been reached by accident.
Comment 7•9 months ago
|
||
But it does tell the site has a bug. Someone is misusing the API.
We could still use 1000, sure.
Updated•8 months ago
|
Updated•6 months ago
|
| Assignee | ||
Updated•6 months ago
|
| Assignee | ||
Comment 8•6 months ago
|
||
Comment 10•6 months ago
|
||
| Assignee | ||
Updated•6 months ago
|
Comment 12•6 months ago
|
||
Comment 13•6 months ago
|
||
Comment 14•6 months ago
|
||
Backed out for causing failures at history_replacestate_too_many_calls.optional.html.
Backout link: https://hg.mozilla.org/integration/autoland/rev/43e9ea3e063e
Failure log: https://treeherder.mozilla.org/logviewer?job_id=545911146&repo=autoland&task=JyYvq2yUSWyzntvVjiNotg.0&lineNumber=1823
Comment 15•6 months ago
|
||
Comment 17•6 months ago
|
||
Comment 18•6 months ago
|
||
Backed out for causing wpt failures on replaceState-inside-back-handler-infinite.optional.html
Backout link
Push with failures
Failure log(s)
| Assignee | ||
Updated•6 months ago
|
Comment 20•6 months ago
|
||
Comment 22•6 months ago
|
||
| bugherder | ||
Comment 24•5 months ago
|
||
:farre, could you consider adding a beta uplift request on this if it's low risk?
It seems to fix a few web compact issues
| Assignee | ||
Comment 25•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D280599
Updated•5 months ago
|
Comment 26•5 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Less web compatibility
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: It's a preference change, allowing for more calls to pushState and replaceState during a set period of time.
- String changes made/needed: None
- Is Android affected?: yes
| Assignee | ||
Comment 27•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D280599
Updated•5 months ago
|
| Assignee | ||
Comment 28•5 months ago
|
||
Thanks for the remainder.
I went ahead and requested release, and the esr:s as well. It's small enough to warrant inclusion on all of them. Sounds good?
Comment 29•5 months ago
|
||
firefox-release Uplift Approval Request
- User impact if declined: Less web compatibility
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: It's a preference change, allowing for more calls to pushState and replaceState during a set period of time.
- String changes made/needed: None
- Is Android affected?: yes
Updated•5 months ago
|
Updated•5 months ago
|
Comment 30•5 months ago
|
||
| uplift | ||
Comment 31•5 months ago
|
||
:farre, it looks like you wanted to created uplift requests for ESR115/ESR140, but they failed due to conflicts.
See details here https://lando.moz.tools/D281585/
Comment 32•5 months ago
|
||
I also don't think this is an appropriate item to backport to ESR115 as it reaches EOL (assuming it's even affected in the first place?)
| Assignee | ||
Comment 33•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D280599
Updated•5 months ago
|
Comment 34•5 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: Less web compatibility
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: It's a preference change, allowing for more calls to pushState and replaceState during a set period of time.
- String changes made/needed: None
- Is Android affected?: yes
| Assignee | ||
Comment 35•5 months ago
|
||
(In reply to Donal Meehan [:dmeehan] from comment #31)
:farre, it looks like you wanted to created uplift requests for ESR115/ESR140, but they failed due to conflicts.
See details here https://lando.moz.tools/D281585/
Thanks, fixed and followed resolution steps. As Ryan says, we should not consider this for 115.
| Assignee | ||
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Comment 36•5 months ago
|
||
| uplift | ||
Updated•5 months ago
|
| Assignee | ||
Comment 37•4 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D280599
Updated•4 months ago
|
Comment 38•4 months ago
|
||
firefox-esr115 Uplift Approval Request
- User impact if declined/Reason for urgency: Less web compatibility
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: It's a preference change, allowing for more calls to pushState and replaceState during a set period of time.
- String changes made/needed?: None
- Is Android affected?: yes
Updated•4 months ago
|
Updated•4 months ago
|
Comment 39•4 months ago
|
||
| uplift | ||
Updated•3 months ago
|
Description
•