Content scripts in message composition editor
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(Not tracked)
People
(Reporter: darktrojan, Assigned: darktrojan)
References
Details
Attachments
(2 files, 1 obsolete file)
15.32 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
20.90 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•5 years ago
|
||
This is the first part, making insertCSS
, removeCSS
and executeScript
work. Philipp I'm r?ing you for this because you understand the internals I'm tapping in to better, and I want to know if I'm doing anything stupid before going further.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
Part two adds a new composeScripts
API which is similar to the contentScripts
API except that it works with the compose window and requires the compose
permission. Also it doesn't have most of the options of that API because they're irrelevant.
There is a part three to this bug, which is to register scripts straight from the extension manifest, but I am not hopeful that it will ever happen because an extension context is needed, and it isn't available when reading the manifest.
Comment 5•5 years ago
|
||
Comment 6•5 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/9e23d0584abc
part 1 - Support insertCSS/removeCSS/executeScript in compose windows. r=mkmelin
https://hg.mozilla.org/comm-central/rev/263dae2cae3f
part 2 - Allow registration of content scripts in the compose window. r=mkmelin
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
I tested this API and found a few issues. I am not sure if I should file separate bugs or if these can be fixed in a followup:
- The
messenger.*
namespace/variable is undefined. - There is no way to view the Console for the compose scripts, which makes them extremely difficult to debug. If you select the compose window from the "Developer Toolbox", the Console is blank.
- The compose scripts API only works for the message body, not the subject. I am working on an emoji picker/autocorrect extension and need to be able to insert emojis into the subject.
- There is no way to send messages to the compose scripts, for example when the user updates the options, as Thunderbird does not have an equivalent API to Firefox's
browser.tabs.sendMessage()
. - Not directly related to this bug, but option pages are also busted in Thunderbird 77, which makes extensions difficult to test in general. No issues in Thunderbird 68 or in Firefox. I get these errors in the Console:
NS_ERROR_FILE_NOT_FOUND: Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIStyleSheetService.preloadSheet] ExtensionCommon.jsm:2587
TypeError: prin.URI is null
ConduitsParent.jsm:123:58
Error: Unknown sender or wrong actor for recvCreateProxyContext ConduitsParent.jsm:321:13
TypeError: prin.URI is null
ConduitsParent.jsm:123:58
Error: Unknown sender or wrong actor for recvAPICall ConduitsParent.jsm:321:13
Error: Unknown sender or wrong actor for recvAPICall 2 ConduitsParent.jsm:321:13
Error: Unknown sender or wrong actor for recvAddListener 2 ConduitsParent.jsm:321:13
Error: Unknown sender or wrong actor for recvAPICall 22 ConduitsParent.jsm:321:13
Assignee | ||
Comment 9•5 years ago
|
||
Yes, you should file separate bugs. This one is closed.
The compose scripts API only works for the message body, not the subject. I am working on an emoji picker/autocorrect extension and need to be able to insert emojis into the subject.
Not for this, there are other methods for changing the subject
There is no way to view the Console for the compose scripts, which makes them extremely difficult to debug. If you select the compose window from the "Developer Toolbox", the Console is blank.
AFAIK, there's no way to do this with content scripts in Firefox either. This is because they don't have a document of their own, they're working on a content document. You can find this document using the full Developer Toolbox, but still debugging is not easy.
Comment 10•5 years ago
|
||
OK.
AFAIK, there's no way to do this with content scripts in Firefox either. This is because they don't have a document of their own, they're working on a content document. You can find this document using the full Developer Toolbox, but still debugging is not easy.
In Firefox, if you do console.log()
from a content script, the output is shown in the Console for the tab. Yes, in Thunderbird you can find the compose window document from the "Developer Toolbox", but the Console is blank.
Description
•