just doing a simple enumeration bomb out

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

just doing a simple enumeration bomb out

Post by nickhere »

just doing a simple enumeration bomb out with target not found

Code: Select all

function checkSubFolders(aFolder) {
  if (!aFolder.hasSubFolders) {
    return;
  }
  console.log(aFolder.prettyName);
  var enumerator = aFolder.subFolders;
  while (enumerator.hasMoreElements()) {
    var folder = enumerator.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
    console.log(folder.prettyName);
    folder.updateFolder;
    //gFolderTreeView.selectFolder(folder);
    checkSubFolders(folder);
    }
  }
function writeFile(nsiFile, data, overwrite) {
  //overwrite is true false, if false then it appends
  //nsiFile must be nsiFile
  if (overwrite) {
    var openFlags = FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
  } else {
    var openFlags = FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_APPEND;
  } //data is data you want to write to file
  //if file doesnt exist it is created

  var ostream = FileUtils.openFileOutputStream(nsiFile, openFlags);
  data = data + '\r\n';
  ostream.write(data, data.length);
  ostream.close();
}
var foldercreatelist = [];
var acctMgr = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
var accounts = acctMgr.accounts;
var file = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsIFile);
file.initWithPath('d:\\msgFilterRules.dat');
writeFile(file, 'version="9"', true);
writeFile(file, 'logging="no"', false);
var account = accounts.queryElementAt(0, Components.interfaces.nsIMsgAccount);
checkSubFolders(account.incomingServer.rootFolder);
works fine
but if uncomment the //gFolderTreeView.selectFolder(folder);

that when you get target not found
NS_ERROR_FILE_TARGET_DOES_NOT_EXIST: Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIMsgFolder.updateFolder]
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: just doing a simple enumeration bomb out

Post by tanstaafl »

Moved from Thunderbird Bugs to Thunderbird Support as you are not discussing a confirmed bug filed in bugzilla. It would help to mention what version of Thunderbird this occurs with.
nickhere
Posts: 40
Joined: September 29th, 2009, 1:57 pm

Re: just doing a simple enumeration bomb out

Post by nickhere »

I just started using Bugzilla been finding a lot of simple things causing exception this is not in it
Post Reply