Closed Bug 1909698 Opened 1 year ago Closed 1 year ago

Browser navigation (back/forward) loses the text fragment directive

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

VERIFIED FIXED
132 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox128 --- unaffected
firefox129 --- unaffected
firefox130 --- disabled
firefox131 --- verified
firefox132 --- verified

People

(Reporter: phorea, Assigned: farre)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Found in

  • Nightly 130.0a1

Affected versions

  • Nightly 130.0a1

Tested platforms

  • Ubuntu 22;
  • macOS 14;
  • Windows 10;

Affected platforms

  • Ubuntu 22;
  • macOS 14;
  • Windows 10;

Preconditions

  • Have dom.text_fragments.enabled to TRUE

Steps to reproduce

  1. Launch Fx and navigate to https://en.wikipedia.org/wiki/Nuclear_power#:~:text=nuclear
  2. Click the back button and then the forward button.

Expected result

  • The correct text fragment link is displayed in the address bar.

Actual result

  • Text fragment link is NOT fully displayed, but the highlight still exists.

Regression range

  • Not a regression.

I'd add that reloading the page after the last step (i.e. returning to the page that originally had the fragment in the URL) magically returns the fragment back for me (today's Nightly with pref), what somewhat explains the highlight.

Note: I have observed that other browsers claiming text fragment (draft) support apply the highlight only on direct navigation in a "fresh" tab (what feels odd): Edge for example keeps the fragment in the URL when doing back+forward or (force)reload, but despite URL fragment is kept displayed in the URL bar, no highlight is produced when returned or reloaded. Only opening new tab with the same URL makes new highlight. (Not sure if it is spec'd/drafted to be this way, but such UX it also suboptimal, IMO.)

The problem that we're seeing seems to be that when we're coming out of bfcache, we set the current uri of the docshell to the uri of the document. In case of text directives this will be stripped from the document. Tentatively it looks like setting it from session history solves the problem.

Assignee: nobody → afarre
Status: NEW → ASSIGNED
Pushed by afarre@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/05fceb07f800 Use URI from session history when coming out from bfcache. r=peterv
Flags: needinfo?(afarre)
Pushed by afarre@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4d1d5eca5c33 Use URI from session history when coming out from bfcache. r=peterv
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

Comment on attachment 9424668 [details]
Bug 1909698 - Use URI from session history when coming out from bfcache. r=peterv!

Beta/Release Uplift Approval Request

  • User impact if declined: Confusing experience for users of the scroll to text fragment feature
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: STRs in bug description
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Small and restricted to urls containing text directives
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(afarre)
Attachment #9424668 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Regressions: 1919546
QA Whiteboard: [qa-triaged]

Comment on attachment 9424668 [details]
Bug 1909698 - Use URI from session history when coming out from bfcache. r=peterv!

Approved for 131.0b9

Attachment #9424668 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+
Flags: needinfo?(afarre)
Attachment #9424668 - Flags: approval-mozilla-beta+ → approval-mozilla-beta?
Depends on: 1919704

Reproducible on a 2024-07-24 Nightly build on Windows 10.
Verified as fixed on Firefox Nightly 132.0a1 on Windows 10, Ubuntu 22, macOS 14.
The correct text fragment link is displayed in the address bar after navigating back/forward.

Comment on attachment 9424668 [details]
Bug 1909698 - Use URI from session history when coming out from bfcache. r=peterv!

The test failing is the test included in this patch. I have a fix in 1919704 so we need to uplift that as well to not fail on beta.

Flags: needinfo?(afarre)

I requested beta uplift for bug 1919704 just to be extra visible.

Attachment #9424668 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Issue is verified as fixed on Firefox 131.0b9 on Windows 10, Ubuntu 22, macOS 14.

Removing the qa-verify+ flag as the fix was verified in Comment 14 and Comment 18.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: