Closed Bug 1625593 Opened 4 years ago Closed 4 years ago

Implement activeTab extension permission functionality on GeckoView

Categories

(GeckoView :: Extensions, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: robwu, Assigned: agi, Mentored)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [geckoview:m82][geckoview:m85][geckoview:m87])

Attachments

(2 files, 2 obsolete files)

Attached file activeTabPageAction.zip (deleted) —

The unit test for the activeTab permission on mobile was removed in bug 1530402, and now we don't have any test coverage for this important functionality any more. It's not just the lack of test coverage, when I run a manual test, it is broken.

STR:

  1. Download the attached extension, unpack the attached extension to a directory.
  2. Start an Android emulator or attach a real Android device, with Fenix installed.
  3. Run adb devices to find the device ID (alternatively: run the command at the next step without the --android-device=... flag to let web-ext find and show ID)
  4. Use web-ext run -t firefox-android --firefox-apk=org.mozilla.fenix --android-device=[ID from step 3 here]
    (if you haven't done so, install web-ext first)
  5. Visit example.com
  6. Click on the triple-dot menu and click on the "pageac titl" menu item.

Expected:

Actual:

  • Nothing happens.
  • When I open about:debugging on desktop Firefox, click enable devices, attach to Firefox Preview, and click on the "Inspect" button at the "activeTab + pageAction" extension, then I can view the console for the extension, with the following error:

Going to executeScript in 10006 undefined
Failed to executeScript: Missing host permission for the tab

The error indicates that the activeTab permission was not activated when the pageAction button was clicked.

References:

Agi, did you deliberately remove this feature? Do you intend to restore this anytime soon?

Philipp, where does this stand on the list of priorities of APIs for GeckoView?
(note: the lack of activeTab permission support prevents extensions from using minimal permissions, which is opposing the goals of manifest v3)

Flags: needinfo?(philipp)
Flags: needinfo?(agi)

Not intentional. We can look into it but unless one of the addons that we want to support needs this, it's not going to be high priority. We don't allow arbitrary addons yet anyway.

Flags: needinfo?(agi)
Summary: Restore activeTab extension permission functionality on GeckoView → Implement activeTab extension permission functionality on GeckoView

Looks like all we need to do is call this method on mobile too (or move that line to toolkit if possible) https://searchfox.org/mozilla-central/rev/4ccefc3181f9d237ef4ca8bd17b4e7c101ddf7b5/browser/components/extensions/parent/ext-browserAction.js#226

OK so steps to do in this bug:

Mentor: agi
Component: Android → Extensions
Product: WebExtensions → GeckoView
Type: defect → enhancement
Whiteboard: [geckoview:m81]

oops mixed up milestones

Whiteboard: [geckoview:m81] → [geckoview:m82]

Probably the reason why my extension is broken on the new Firefox Android Nightly:
https://addons.mozilla.org/nl/firefox/addon/sitesearch/

When I change the permission from activeTab to tabs it starts working, but I'm not not inclined to request for additional permissions just because of bugs.

BTW stumbled on this bug several months ago, but never took the effort to track it down: IMHO testing for the new Android version isn't that attractive when there is NO way to install/test signed but unlisted extensions.

Should be higher on the priority list IMHO.

This is already high on the priority list (P2 is just below top priority), but we have a lot to work on. This is one of the bugs that should be fixed before add-ons become generally available on release.

web-ext can be used to temporarily install an add-on for development (more info at https://extensionworkshop.com/documentation/develop/developing-extensions-for-firefox-for-android/ ). Contributors who want to try to work on a patch to resolve this bug can use this tool to manually test add-ons while working on a patch.

We have recently added support for installing any add-on on Nightly. But unlisted add-ons are not supported yet, as you might already have discovered.

Assignee: nobody → agi
Status: NEW → ASSIGNED

oops. I wrote a patch a long time ago and forgot to submit it 😅 sorry about that.

Glad a patch is coming :)

Sure I used web-ext (nice tool) to find the bug, but I'm afraid I stick to the old Android version for daily use until my (precious) extensions do work, although I'm quite sure I will like the new version once that is the case.

Attached file Bug 1625593 - Add GeckoResult.map. (obsolete) (deleted) —

This method allows callers to synchronously map a GeckoResult value to another
value.

Attached file Bug 1625593 - Use GeckoResult in EventDispatcher. (obsolete) (deleted) —

This patch adds queryString, queryBoolean, queryVoid and queryBundle to
EventDispatcher in place of dispatch(type, message, callback).

These query* methods returns a GeckoResult which can be manipulated using
GeckoResult.map.

Priority: P2 → P1
Whiteboard: [geckoview:m82] → [geckoview:m82][geckoview:m84]
Whiteboard: [geckoview:m82][geckoview:m84] → [geckoview:m82][geckoview:m85]

Comment on attachment 9187560 [details]
Bug 1625593 - Add GeckoResult.map.

Revision D96950 was moved to bug 1682668. Setting attachment 9187560 [details] to obsolete.

Attachment #9187560 - Attachment is obsolete: true
Keywords: leave-open

Comment on attachment 9187561 [details]
Bug 1625593 - Use GeckoResult in EventDispatcher.

Revision D96951 was moved to bug 1685614. Setting attachment 9187561 [details] to obsolete.

Attachment #9187561 - Attachment is obsolete: true
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/100bc29bbb72
Move activeTab functionality to toolkit. r=robwu,esawin

Backed out changeset 100bc29bbb72 (bug 1625593) for Browser-chrome failures in gfx/layers/apz/test/mochitest/browser_test_scrollbar_in_extension_popup_window.js. CLOSED TREE

Log:
https://treeherder.mozilla.org/logviewer?job_id=328256773&repo=autoland&lineNumber=2821

Push that shows failures:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=4572c1ba670a3ddb159cf37ba9684fb6055f260e

Backout:
https://hg.mozilla.org/integration/autoland/rev/2b57de6eddafb29c4ef30fc2a3ec66c0b5a2b185

Flags: needinfo?(agi)
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f25813fc068d
Move activeTab functionality to toolkit. r=robwu,esawin
Whiteboard: [geckoview:m82][geckoview:m85] → [geckoview:m82][geckoview:m85][geckoview:m87]

That was a doozy. Thanks!

Flags: needinfo?(philipp)
Flags: needinfo?(agi)
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Keywords: leave-open
Type: enhancement → defect
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: