Closed Bug 1843866 Opened 11 months ago Closed 2 months ago

Add tab parameter to commands.onCommand

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(firefox126 fixed)

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: robwu, Assigned: willdurand, Mentored)

References

Details

(Keywords: compat, dev-doc-complete, good-first-bug, Whiteboard: [addons-jira])

Attachments

(1 file)

The commands.onCommand event does currently not receive a "tab" parameter. Consequently, extensions cannot apply a triggered shortcut to the context of interest, unless they call the tabs.query() API.

We should include a tab parameter.
Chrome has done that before, at https://bugs.chromium.org/p/chromium/issues/detail?id=179375#c10

This should be relatively easy to implement; Patches are welcome (see https://wiki.mozilla.org/WebExtensions/Contribution_Onramp to get started).

To implement this:

Keywords: good-first-bug
Mentor: rob

The tab argument of commands.onCommand listeners is implemented for Thunderbird extensions, see the bug #1787203.

Thanks for linking bug 1787203.

Once this bug is resolved, Thunderbird should switch back to the commands.json from m-c.

See Also: → 1787203

Once this bug is resolved, Thunderbird should switch back to the commands.json from m-c.

Mozilla's commands.json is in /browser, not in /toolkit :-(

(In reply to John Bieling (:TbSync) from comment #4)

Once this bug is resolved, Thunderbird should switch back to the commands.json from m-c.

Mozilla's commands.json is in /browser, not in /toolkit :-(

Despite that, Thunderbird was able to link the browser implementation before, as seen at:
https://hg.mozilla.org/comm-central/rev/d6d577277257#l1.12

Interestingly, the underlying implementation of the commands API is in toolkit: ExtensionShortcuts.sys.mjs.

Severity: -- → N/A
Keywords: compat
Priority: -- → P3
Whiteboard: [addons-jira]
Assignee: nobody → wdurand
Status: NEW → ASSIGNED
Pushed by wdurand@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c6255dc12497
Add tab parameter to commands.onCommand. r=robwu
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Keywords: dev-doc-needed

@erosman there is no need to add issues to GitGub, a dev-doc-needed works better as I regularly look out for that flag.

@willdurand could you suggest an example to include in the documentation?

Documentation updates are ready for review in:

https://github.com/mdn/content/issues/33008 remains open regarding addition of example

Depends on: 1899939
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: