Extension not working on TB 60

Talk about add-ons and extension development.
Post Reply
ManOfOrange
Posts: 5
Joined: January 23rd, 2019, 12:31 am

Extension not working on TB 60

Post by ManOfOrange »

Hello all!

I have a Thunderbird extension, that successfully work on version 52.9.1, but on 60.4.0 I have two errors:
1) on line:

Code: Select all

if (versionChecker.compare(Application.version, "4.0.11") >= 0)
I have error "ReferenceError: Application is not defined"

I found here https://wiki.mozilla.org/Thunderbird/Add-ons_Guide_57 that
steelIApplication (removed due to removal of extIApplication) -- replacement: Services, AppConstants
, but can't understand, how get version from AppConstants or Services.

2) on line:

Code: Select all

var xmlDoc = Components.classes["@mozilla.org/xul/xul-document;1"].createInstance (Components.interfaces.nsIDOMXULDocument);
I have error "TypeError: Components.classes['@mozilla.org/xul/xul-document;1'] is undefined". I can't figure out, how works with xml now.

Can anybody help me?
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Extension not working on TB 60

Post by morat »

Try these:

Code: Select all

if (versionChecker.compare(AppConstants.MOZ_APP_VERSION, "4.0.11") >= 0)

Code: Select all

if (versionChecker.compare(Services.appinfo.version, "4.0.11") >= 0)
I don't follow why you are using the nsIDOMXULDocument interface.

Here is how to find a XUL document in Thunderbird 60.

Code: Select all

alert(ChromeUtils.getClassName(document)); // "XULDocument"
Do some cleanup on nsIDOMXULDocument
http://bugzilla.mozilla.org/show_bug.cgi?id=1434399
http://bug1434399.bmoattachments.org/at ... id=8946998
ManOfOrange wrote:can't understand, how get version from AppConstants or Services
If you don't know how to inspect objects, then I assume you aren't a developer.

You can inspect objects using the error console command line.

i.e. Tools > Developer Tools > Error Console

Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line

The following extension works well in Thunderbird 60.

DOM Inspector Plus
http://addons.thunderbird.net/thunderbird/addon/254571
http://developer.mozilla.org/docs/Tools ... _Inspector
ManOfOrange
Posts: 5
Joined: January 23rd, 2019, 12:31 am

Re: Extension not working on TB 60

Post by ManOfOrange »

morat, thank you!

Both problems were solved with your code. Now it's working fine.
morat wrote:I don't follow why you are using the nsIDOMXULDocument interface.
I don't follow too: this code was written five years ago by a man who had already quit.
morat wrote:If you don't know how to inspect objects, then I assume you aren't a developer.
I'm developer, but I'm very far from browser-developing, javascript and Thunderbird. So, thanks a lot for helpful links and tools!
Post Reply