menus API: OnClickData object of onShown event does not always include text selection (update docs)
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr78 unaffected, thunderbird87? affected)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
thunderbird87 | ? | affected |
People
(Reporter: TbSync, Assigned: TbSync)
Details
(Whiteboard: [fixed by bug 1670825])
Attachments
(2 obsolete files)
It should be possible to get the selected text from the OnClickData object in a menus.onShown event.
I was able to achieve this for a web page loaded in a Thunderbird tab by using the "<all_urls>" permission. The "activeTab" and the "tab" permission did not help.
For a message displayed in the 3-pane-view or in a tab, this did not work at all. I used "tabs", "activeTab" and "<all_urls>" permission.
Comment 1•5 years ago
|
||
I replicated this and by checking the source code I noticed there is only supposedly two ways in which the menu API exposes the selected text of a message:
- By having "activeTab" permissions (the issue here is that the function which check those permissions isn't implemented yet)
- By having permissions to the internal message URL (which is like "mailbox:///..." -- but the mailbox scheme isn't considered valid that's way it wasn't working even with the "<all_urls>" permission)
Comment 2•5 years ago
|
||
This issue affects the following "info" properties of the onShown event:
- targetElementId
- linkText
- linkUrl
- srcUrl
- pageUrl
- frameUrl
- selectionText
Assignee | ||
Comment 3•5 years ago
|
||
I poked around a bit. The activeTab
permission does have an effect.
-
First of all the
onClicked
event returns all these information without (!) any special permission (menus
of course is needed). -
The
onShown
event returns these these information, if theactiveTab
permission is given AND if anonClicked
event has been triggered at least once in that tab. After that, I getlinkText
,linkUrl
,pageUrl
andselectionText
. I have never seentargetElementId
,srcUrl
orframeUrl
This is the behavior I observe with TB 78.4.3.
@Joaquín Serna : Can you confirm this?
Is there a reason, why the two events behave differently?
What would the desired behavior be?
Comment 4•5 years ago
|
||
This bug is probably already covered by bug 1670825, which has just been added to 78.5. The messagesRead
permission does what the URL permission does for web pages.
As for why the events behave differently, this also happens in Firefox with web pages. I don't understand why and in the end decided it wasn't really that big of a problem.
I'm not 100% sure that all of the properties work exactly as they do in Firefox, but the vast majority of them should.
Assignee | ||
Comment 5•5 years ago
|
||
Confirmed, this is fixed in TB78.5 build 3.
The activeTab permission is no longer needed. To get the selected text during onShown, the messagesRead permission is needed. Not so for onClicked. If that is the same behavior as in Firefox, we should stick with the same behavior.
Updated•5 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
I need to update the doc to make clear what gives host permission to the message display tab.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 7•4 years ago
|
||
Assignee | ||
Comment 8•4 years ago
|
||
Comment on attachment 9204384 [details] [diff] [review]
bug1664423_add_host_permission_info_to_menus_api.patch
Just a description update. Geoff is packed.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 9•4 years ago
|
||
Assignee | ||
Comment 10•4 years ago
|
||
Comment on attachment 9204413 [details] [diff] [review]
bug1664423_add_host_permission_info_to_menus_api_v2.patch
Just a description update. Geoff is packed.
Assignee | ||
Comment 11•4 years ago
•
|
||
Comment on attachment 9204413 [details] [diff] [review]
bug1664423_add_host_permission_info_to_menus_api_v2.patch
I change tactics here for the future. I find wrong documentation very often which are mostly just one line bugs but having them in queue (and sometimes in parallel) makes working with the code difficult. I will just keep a general documentation changeset locally and report all found issues in a single bug maybe once per month.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Description
•