rem: } 
add: } cos.close(); 
context: function CCKWriteProperties(destdir){  var file = destdir.clone();  file.append("cck.properties");    try {    file.remove(false);                           } catch (ex) {}  var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]                      .createInstance(Components.interfaces.nsIFileOutputStream);  fos.init(file, -1, -1, false);    var ioService=Components.classes["@mozilla.org/network/io-service;1"]                          .getService(Components.interfaces.nsIIOService);  var scriptableStream=Components.classes["@mozilla.org/scriptableinputstream;1"]                                 .getService(Components.interfaces.nsIScriptableInputStream);      var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/cck.properties.in",null,null);  var input=channel.open();  scriptableStream.init(input);  var str=scriptableStream.read(input.available());  scriptableStream.close();  input.close();  str = str.replace(/%OrganizationName%/g, document.getElementById("OrganizationName").value);  str = str.replace(/%browser.throbber.url%/g, document.getElementById("AnimatedLogoURL").value);  str = str.replace(/%cckhelp.url%/g, document.getElementById("HelpMenuCommandURL").value);  str = str.replace(/%browser.startup.homepage%/g, document.getElementById("HomePageURL").value);  str = str.replace(/%PopupAllowedSites%/g, document.getElementById("PopupAllowedSites").value);  str = str.replace(/%InstallAllowedSites%/g, document.getElementById("InstallAllowedSites").value);  fos.write(str, str.length);   /* Add toolbar/bookmark stuff at end */  str = document.getElementById('ToolbarFolder1').value;  if (str && str.length) {    str = "ToolbarFolder1=" + str + "\n";    fos.write(str, str.length);    for (var i=1; i <= 5; i++) {      str = document.getElementById("ToolbarFolder1.BookmarkTitle" + i).value;      if (str && str.length) {        str = "ToolbarFolder1.BookmarkTitle" + i + "=" + str + "\n";        fos.write(str, str.length);      }      str = document.getElementById("ToolbarFolder1.BookmarkURL" + i).value;      if (str && str.length) {        str = "ToolbarFolder1.BookmarkURL" + i + "=" + str + "\n";        fos.write(str, str.length);      }    }  }    for (var i=1; i <= 5; i++) {    str = document.getElementById("ToolbarBookmarkTitle" + i).value;    if (str && str.length) {      str = "ToolbarBookmarkTitle" + i + "=" + str + "\n";      fos.write(str, str.length);    }    str = document.getElementById("ToolbarBookmarkURL" + i).value;    if (str && str.length) {      str = "ToolbarBookmarkURL" + i + "=" + str + "\n";      fos.write(str, str.length);    }  }  str = document.getElementById('BookmarkFolder1').value;  if (str && str.length) {    str = "BookmarkFolder1=" + str + "\n";    fos.write(str, str.length);    for (var i=1; i <= 5; i++) {      str = document.getElementById("BookmarkFolder1.BookmarkTitle" + i).value;      if (str && str.length) {        str = "BookmarkFolder1.BookmarkTitle" + i + "=" + str + "\n";        fos.write(str, str.length);      }      str = document.getElementById("BookmarkFolder1.BookmarkURL" + i).value;      if (str && str.length) {        str = "BookmarkFolder1.BookmarkURL" + i + "=" + str + "\n";        fos.write(str, str.length);      }    }  }    for (var i=1; i <= 5; i++) {    str = document.getElementById("BookmarkTitle" + i).value;    if (str && str.length) {      str = "BookmarkTitle" + i + "=" + str + "\n";      fos.write(str, str.length);    }    str = document.getElementById("BookmarkURL" + i).value;    if (str && str.length) {      str = "BookmarkURL" + i + "=" + str + "\n";      fos.write(str, str.length);    }  }    // Registry Keys  listbox = document.getElementById("regList");  for (var i=0; i < listbox.getRowCount(); i++) {    listitem = listbox.getItemAtIndex(i);    str = "RegName" + (i+1) + "=" + listitem.label + "\n";    fos.write(str, str.length);    str = "RootKey" + (i+1) + "=" + listitem.rootkey + "\n";    fos.write(str, str.length);    str = "Key" + (i+1) + "=" + listitem.key + "\n";    str = str.replace(/\\/g, "\\\\");    fos.write(str, str.length);    str = "Name" + (i+1) + "=" + listitem.name + "\n";    fos.write(str, str.length);    str = "NameValue" + (i+1) + "=" + listitem.namevalue + "\n";    fos.write(str, str.length);    str = "Type" + (i+1) + "=" + listitem.type + "\n";    fos.write(str, str.length);  }    for (var i = 1; i <= 5; ++i) {    var certpath = document.getElementById("CertPath"+i).value;    if (certpath && (certpath.length > 0)) {      var file = Components.classes["@mozilla.org/file/local;1"]                           .createInstance(Components.interfaces.nsILocalFile);      file.initWithPath(certpath);      var line = "Cert"+ i + "=" + file.leafName + "\n";      fos.write(line, line.length);    }  }    fos.close();}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/073feb31a87d826a9d7c3504a1a6a9708c9f7465/cckwizard.js/buggy/extensions/cck/browser/resources/content/cckwizard/cckwizard.js