MozillaZine

why does this throw a exception

User Help for Mozilla Thunderbird
nickhere
 
Posts: 40
Joined: September 29th, 2009, 1:57 pm

Post Posted December 19th, 2018, 12:18 pm

Code: Select all
function checkSubFolders2(aFolder) {
  if (!aFolder.hasSubFolders) {
    return;
  }
  var enumerator = aFolder.subFolders;
  while (enumerator.hasMoreElements()) {
    var folder = enumerator.getNext().
      QueryInterface(Components.interfaces.nsIMsgFolder);
    if (!(folder instanceof Components.interfaces.nsIMsgNewsFolder)) {
      folders.push(folder);
    }
    checkSubFolders2(folder);
  }
}

var folders = [];
var acctMgr = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
var accounts = acctMgr.accounts;
var account = accounts.queryElementAt(0, Components.interfaces.nsIMsgAccount);
checkSubFolders2(account.incomingServer.rootFolder);
console.log(folders.length);

for (var i = 0; i < folders.length; i++) {
    var enumerator = folders[i].messages;
   }
}


/*
Exception: [Exception... "Component returned failure code: 0x80550005 [nsIMsgFolder.messages]"  nsresult: "0x80550005 (<unknown>)"  location: "JS frame :: Scratchpad/1 :: <TOP_LEVEL> :: line 24"  data: no]
*/

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

Post Posted December 19th, 2018, 12:39 pm

usually with a large number of folders

DanRaisch
Moderator

User avatar
 
Posts: 121337
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Post Posted December 20th, 2018, 6:09 am

Moving to Thunderbird Suupport.

Return to Thunderbird Support


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests