MozillaZine

Extension not working on TB 60

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

Post Posted January 23rd, 2019, 12:39 am

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: 3105
Joined: February 3rd, 2009, 6:29 pm

Post Posted January 23rd, 2019, 7:28 am

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/attachment.cgi?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/Browser_Console#Browser_Console_command_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/Add-ons/DOM_Inspector

ManOfOrange
 
Posts: 2
Joined: January 23rd, 2019, 12:31 am

Post Posted January 25th, 2019, 2:02 am

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!

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest