Closed Bug 1777296 Opened 2 years ago Closed 2 years ago

"Inspect" background script doesn't work for "Firefox for Android" addons

Categories

(DevTools :: about:debugging, defect, P1)

Firefox 104
defect

Tracking

(firefox-esr91 unaffected, firefox-esr102 verified, firefox102 wontfix, firefox103 verified, firefox104 verified)

VERIFIED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- verified
firefox102 --- wontfix
firefox103 --- verified
firefox104 --- verified

People

(Reporter: juraj.masiar, Assigned: jdescottes)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [geckoview?])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0

Steps to reproduce:

  1. start Android Studio emulator
  2. make sure Firefox Nightly is installed
  3. open any extension source folder (the extension should have a background script) and load it using:
web-ext run --target=firefox-android --android-device=emulator-5554 --firefox-apk=org.mozilla.fenix
  1. open desktop Firefox Nightly and connect to the extension from the about:debugging page
  2. click the "Inspect" button for the background script of the addon

Actual results:

New tab is opened but it's blank - see the screenshot

Expected results:

Inspecting extension tabs works, also normal pages can be inspected, but not the background script of the addon.

Component: Console → about:debugging
Flags: needinfo?(jdescottes)

Probably a regression from Bug 1753048.

It seems that the principal can be missing for some windows on Android at https://searchfox.org/mozilla-central/rev/f816e52d85cdaf0be7c9e1d2297f833e9ef53e2e/devtools/server/actors/watcher/browsing-context-helpers.jsm#53

At least I see the error popping up in the logs.

Assignee: nobody → jdescottes
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(jdescottes)

Confirmed regressed by 1753048.
On Android it seems we get a parent process window global with no documentPrincipal and no documentURI, which is unexpected.

Regressed by: 1753048
Severity: -- → S2
Priority: -- → P1
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/49aef30f49c8
[devtools] Bail out of getAddonIdForWindowGlobal for geckoview windowglobals missing principal r=ochameau

(In reply to Julian Descottes [:jdescottes] from comment #2)

On Android it seems we get a parent process window global with no documentPrincipal and no documentURI, which is unexpected.

Irene will investigate whether this is expected on Android.

Flags: needinfo?(bugzeeeeee)
Whiteboard: [geckoview?]
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch

Comment on attachment 9284396 [details]
Bug 1777296 - [devtools] Bail out of getAddonIdForWindowGlobal for geckoview windowglobals missing principal

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Without this patch, developers cannot debug webextensions on Android. There is no workaround. Webextension developers will have to support and test on ESR102 until the next ESR, so we should really fix this.
  • User impact if declined: Unable to debug webextensions on Android
  • Fix Landed on Version: 104
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The patch is only adding a null check in one of our JS modules

Beta/Release Uplift Approval Request

  • User impact if declined: Unable to debug webextensions on Android
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The patch is only adding a null check in one of our JS modules
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9284396 - Flags: approval-mozilla-esr102?
Attachment #9284396 - Flags: approval-mozilla-beta?

Comment on attachment 9284396 [details]
Bug 1777296 - [devtools] Bail out of getAddonIdForWindowGlobal for geckoview windowglobals missing principal

Approved for 103.0b7, thanks.

Attachment #9284396 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+

Thanks for fixing it!
It works now with Nightly 104.0a1 (2022-07-10).

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]

(In reply to juraj.masiar from comment #10)

Thanks for fixing it!
It works now with Nightly 104.0a1 (2022-07-10).

Thanks for testing!

Comment on attachment 9284396 [details]
Bug 1777296 - [devtools] Bail out of getAddonIdForWindowGlobal for geckoview windowglobals missing principal

Approved for ESR102.1, thanks.

Attachment #9284396 - Flags: approval-mozilla-esr102? → approval-mozilla-esr102+

I've reproduced this issue using an affected Nightly build from 2022-06-29, with STR from comment 0.

The issue is verified as fixed on the latest fixed builds: Nightly 104.0a4, Beta 103.0b8 and ESR 102.1.

Flags: needinfo?(bugzeeeeee)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: