Closed Bug 1860130 Opened 1 year ago Closed 1 year ago

Fix issue with entering readerview mode on pages where the document can't be retrieved using XMLHttpRequest

Categories

(Fenix :: WebExtensions, defect, P1)

All
Android
defect

Tracking

(firefox119 wontfix, firefox120 verified, firefox121 verified)

VERIFIED FIXED
121 Branch
Tracking Status
firefox119 --- wontfix
firefox120 --- verified
firefox121 --- verified

People

(Reporter: rpl, Assigned: rpl)

References

Details

(Whiteboard: [addons-jira])

Attachments

(3 files)

Steps to reproduce

  1. open https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/ in a new Fenix tab
  2. click the readerview icon

Expected behavior

The content of the tree-style-tab document to be rendered in readerview mode

Actual behavior

The tab gets reloaded automatically on Nightly, while on Beta and Release the tab stays empty, in both cases the tab doesn't enter the readerview mode.

Device information

Reproduced on Fenix 120 on the emulator (and 119 and 118 on a real android device, Pixel 6a with Android 13).

Any additional information?

While investigating this issue I determined that the "tab reload" part of the actual behavior is triggered by readerview.js itself from here when it fails to retrive a doc for the page we want to render in readerview mode.

The issue can be triggered consistently on the addons.mozilla.org detail page because retrieving the page using XMLHttpRequest seems to be failing (because it is hitting a CORS related error Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.) error), and in that case we will be trying to retrieve the doc through the getSerializedDoc runtime message, which was also not providing a cached doc.

After looking more closely to why the doc wasn't returned by getSerializedDoc, I applied some more fixes to the readerview background script to make it to correctly provide the reply to the getSerializedDoc message, and with just that change applied locally I was able to enter and exit readerview mode on the tree-style-tab AMO detail page as expected.

Whiteboard: [addons-jira]
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Blocks: 1860740
See Also: → 1860490
Severity: -- → S3
Priority: -- → P1

Authored by https://github.com/rpl
https://github.com/mozilla-mobile/firefox-android/commit/366590642b7b823a42717b7c45963f9638df4423
[main] Bug 1860130 - Fix getSerializedDoc message reply in readerview-background.js

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch

Luca, do you want to uplift your fix to Beta 120 for the addons GA release in 120? Or can your fix ride the trains with 121?

Flags: needinfo?(lgreco)

Yes, we want to uplift this.

Duplicate of this bug: 1860490

Verified as fixed on Nightly 120.0a1 from 01/11 with Assus Zenfone 9 ( Android 13) and Sony Xperia (Android 6.0.1).

Flags: qe-verify+

:boek looks like Luca is on pto, since you are the reviewer... do you mind requesting an uplift for this for fx120?

Flags: needinfo?(jboek)

(In reply to Adina Petridean from comment #6)

Verified as fixed on Nightly 120.0a1 from 09/29 with Assus Zenfone 9 ( Android 13) and Sony Xperia (Android 6.0.1).

I am guessing this is 121.0a1 and not 120?

Flags: needinfo?(lgreco)

Comment on attachment 9361677 [details] [review]
[mozilla-mobile/firefox-android] Bug 1860130 - Fix getSerializedDoc message reply in readerview-background.js (backport #4170) (#4336)

Beta/Release Uplift Approval Request

  • User impact if declined: Reader mode will be broken for pages that cannot load within the readermode scripts.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: 1. open https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/ in a new Fenix tab
  1. click the readerview icon
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Patch has landed and been tested in Nightly
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(jboek)
Attachment #9361677 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Comment on attachment 9361677 [details] [review] [mozilla-mobile/firefox-android] Bug 1860130 - Fix getSerializedDoc message reply in readerview-background.js (backport #4170) (#4336) Approved for Mobile 120.0b6
Attachment #9361677 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified as fixed on Firefox Beta 120.0b6 from 06/11 with Huawei MediaPad M2 (Android 5.1.1) and Motorola G9 plus (Android 11).

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: