MozillaZine

this use to work in thunderbird scratchpad

Talk about add-ons and extension development.
nickhere
 
Posts: 26
Joined: September 29th, 2009, 1:57 pm

Post Posted July 25th, 2018, 7:30 pm

Code: Select all
// main code get all the accounts
var acctMgr = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
var accounts = acctMgr.accounts;
for (var i = 0; i < accounts.length; i++) {
  var account = accounts.queryElementAt(i, Components.interfaces.nsIMsgAccount);
  var accountName = account.incomingServer.rootFolder; // server name
  Application.console.log(accountName.prettiestName);
  //checkSubFolders(accountname);
}

Now after tbird upgrade it doesn't.

morat
 
Posts: 2899
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 26th, 2018, 1:38 am

What version are you using?

AFAIK, scratchpad never worked in Thunderbird with any code in the content or browser environment.

For example...

Code: Select all
2 + 2;

TypeError in content environment: this.gBrowser is null
TypeError in browser environment: aSubject is not a non-null object

Your code snippet works for me in the error console.

Thunderbird 52.9.1
Windows 7 SP1 32-bit

nickhere
 
Posts: 26
Joined: September 29th, 2009, 1:57 pm

Post Posted July 26th, 2018, 9:04 am

I figure it out it was the application.console.log had to change to console.log
The new problem is why contains dont work

Code: Select all
var acctMgr = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
var accounts = acctMgr.accounts;
for (var i = 0; i < accounts.length; i++) {
  var account = accounts.queryElementAt(i, Components.interfaces.nsIMsgAccount);
  var accountName = account.incomingServer.rootFolder; // server name
  if (accountName.prettiestName.contains("@")){
  console.log(accountName.prettiestName);
    checkSubFolders(accountname);
}
}


thunderbird 52.91
windows 10 64 pro.
the machine was fresh install and a fresh tbird then i copy my old profile from the app profile data

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest