www.facebook.com - Unable to watch the video/reel, goes to the previous page when trying to close the open app/login pop-up
Categories
(Core :: DOM: Navigation, defect, P1)
Tracking
()
People
(Reporter: ctanase, Assigned: ltenenbaum)
References
()
Details
(Keywords: webcompat:platform-bug, webcompat:site-report, Whiteboard: [autowebcompat:processed][webcompat:sightline][webcompat:japan][webcompat:core][autowebcompat:repro-success], [wptsync upstream])
User Story
autowebcompat-repro-status:success autowebcompat-repro-chrome-mask-fixed:false autowebcompat-repro-channels:nightly,stable,esr autowebcompat-diagnosis-status:success platform:android impact:workflow-broken configuration:general affects:all branch:release diagnosis-team:dom user-impact-score:1200
Attachments
(5 files, 1 external file, 1 obsolete file)
Environment:
Operating system: Android 17
Firefox version: Firefox Mobile 160.0/162
Steps to reproduce:
- Go to https://www.facebook.com/reel/2369509573817841/#
- Dismiss the cookie policy.
- Slide the down open app/login pop-up.
- Observe the behavior.
Expected Behavior:
App/login pop-up disappears and video can be watched.
Actual Behavior:
Goes back to the previous page.
Notes:
- Reproduces regardless of the status of ETP
- Reproduces in firefox-nightly, and firefox-release
- Does not reproduce in chrome
Created from https://github.com/webcompat/web-bugs/issues/240189
| Reporter | ||
Updated•14 days ago
|
Updated•14 days ago
|
Comment 1•14 days ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Updated•14 days ago
|
Updated•14 days ago
|
Comment 2•14 days ago
|
||
On Facebook's mobile reel page, closing the "Get the full experience" open app/login sheet (which works as a history-back step) takes Firefox off the reel and back to the previous page. In Chrome the site adds an extra history entry for the sheet, so the same step just closes the sheet and the reel stays open. In Firefox that entry is never added.
Updated•14 days ago
|
Comment 3•14 days ago
|
||
Root cause analysis generated by autowebcompat bot:
This is a Gecko engine difference, not UA sniffing. Both browsers get the same HTML and scripts, because the repro sends the same Firefox Android UA to both.
The reel page has an inline "rebound" script. In a DOMContentLoaded listener it runs window.location.href = "fb://fullscreen_video/<id>?..." to try to open the native app. The page is still loading at that point. Shortly after, the WebBloks navigation code opens the "Get the full experience" sheet. It calls history.replaceState(...) and then history.pushState({...screenId:"modal:WEBBLOKS_INFRA_SCREEN_2"}, "", "#") to create a history entry for the sheet. Dismissing the sheet runs history.back(), which should only pop that entry.
In Firefox, while the fb:// external-protocol navigation is pending on a document that hasn't finished loading, history.pushState() behaves like replaceState(). No session history entry is added, history.length stays the same, and the navigate event reports navigationType: "replace". So history.back() goes back to the previous page (example.com) instead of closing the sheet. Chrome adds the entry as a push, and history.back() stays on the reel.
Per HTML, pushState always runs the shared history push/replace state steps with historyHandling "push". The "not completely loaded → replace" conversion applies only to the fb:// navigation itself. It should not carry over to a later same-document pushState. Gecko appears to apply the pending load's replace load type to the pushState.
Evidence:
Real site: I logged History.prototype.pushState. Both browsers call pushState(state, "", "#") from the same place (b2E1lVDqHdc.js n.$19), on the same History object, with no exception. In Chrome, history.length goes 3→4 and the navigate event is push. In Firefox, history.length stays 2→2 and the navigate event is replace. Firefox's beforeunload fires at DOMContentLoaded, which matches the inline location.href = e.reboundURI (fb://fullscreen_video/...) running just before the push.
Timing probe on the reel in Firefox: pushStates I added at 0 ms and ≥2000 ms all added entries. Pushes at about 528 ms and the site's own push at about 621 ms, both just after DCL and the fb:// navigation, did not.
Repro script: Chrome 3/3 working (historyLength: 4 before back, stays on the reel). Firefox 0/3 (historyLength: 2, back lands on https://example.com/).
Reduced testcase: a DOMContentLoaded handler sets location.href = "fb://...", then calls pushState in a microtask. Firefox: length 14→14, navigationType replace, FAIL. Chrome: length 6→7, navigationType push, PASS. Control with ?nofb in Firefox: 15→16, push, PASS.
If you'd like to provide feedback on diagnosis, please use the 👍 or 👎 reaction.
Comment 4•14 days ago
|
||
Updated•14 days ago
|
Comment 5•13 days ago
|
||
Hi Leo, can you take a look at this? I wonder if it's a regression (it's not clear from the bug report).
| Assignee | ||
Comment 6•13 days ago
|
||
I can't reproduce the bug itself, but based on the autowebcompat test case, it's not a recent regression. It seems that we convert pushState to replace when there's a pending document request here: https://searchfox.org/firefox-main/rev/f612f4a72980aeb8d7a868d53534ad698b2ee602/docshell/base/nsDocShell.cpp#11264. Here's an even simpler case showing the same behavior (outputs 2 on Firefox, 3 on WebKit/Chromium). The check was originally added for bug 757376 but even without it the issue there doesn't seem to reproduce anymore, so maybe we can remove it…
| Assignee | ||
Comment 7•13 days ago
•
|
||
(oops here's a better test case that actually works on bmoattachments…)
| Assignee | ||
Comment 8•12 days ago
|
||
Create a patch to fix this bug based on the analysis and test case given by the AutoWebCompat bot above
Updated•12 days ago
|
Comment 9•12 days ago
|
||
FWIW we special-case other non-data-returning navigations already, so hopefully it's a matter of checking that the doc channel will return data in that replace check.
| Assignee | ||
Comment 10•12 days ago
|
||
Interesting… that would at least fix the webcompat bug, but really we shouldn't ever turn pushState into a replace if I understand the spec correctly. For example this test case still reproduces the problem with an ordinary data-returning navigation.
| Assignee | ||
Comment 11•11 days ago
|
||
Updated•11 days ago
|
Updated•7 days ago
|
Comment 13•6 days ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/65670 for changes under testing/web-platform/tests
Comment 15•6 days ago
|
||
| bugherder | ||
Comment 16•6 days ago
|
||
The patch landed in nightly and beta is affected.
:ltenenbaum, please make an uplift decision for beta:
- For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set
status-firefox162towontfixif the fix can wait for the next release.
Uplift requests can be submitted from Lando: D344426.
See Requesting an Uplift for documentation on how to request an uplift.
For more information, please visit BugBot documentation.
Upstream PR merged by moz-wptsync-bot
| Assignee | ||
Updated•5 days ago
|
Updated•5 days ago
|
Comment 18•1 day ago
|
||
Did you want to nominate this for the Fx163 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination
Possible wording:
Fixed Facebook reels going back to the previous page when the prompt to open the Facebook app was dismissed.
| Assignee | ||
Comment 19•16 hours ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Annoying issue with major site
[Affects Firefox for Android]: Only affects Android
[Suggested wording]: Fixed Facebook reels going back to the previous page when the prompt to open the Facebook app was dismissed.
[Links (documentation, blog post, etc)]:
Description
•