why does this throw a exception

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

why does this throw a exception

Post by nickhere »

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

Re: why does this throw a exception

Post by nickhere »

usually with a large number of folders
User avatar
DanRaisch
Moderator
Posts: 127187
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: why does this throw a exception

Post by DanRaisch »

Moving to Thunderbird Suupport.
Post Reply