rem: if (window.arguments[4] == "newBookmark") { 
add: if (window.arguments.length > 4 && window.arguments[4] == "newBookmark") { 
context: function onOK(){  if (!document.getElementById("folderbox").hasAttribute("hidden")) {    var bookmarkView = document.getElementById("bookmarks-view");    var currentIndex = bookmarkView.currentIndex;    if (currentIndex != -1)      gCreateInFolder = bookmarkView.treeBuilder.getResourceAtIndex(currentIndex).Value;  }  // In Select Folder Mode, do nothing but tell our caller what  // folder was selected.   if (window.arguments[4] == "selectFolder")    window.arguments[5].selectedFolder = gCreateInFolder;  else {    // Otherwise add a bookmark to the selected folder.     const kBMDS = kRDF.GetDataSource("rdf:bookmarks");    const kBMSContractID = "@mozilla.org/browser/bookmarks-service;1";    const kBMSIID = Components.interfaces.nsIBookmarksService;    const kBMS = Components.classes[kBMSContractID].getService(kBMSIID);    var rFolder = kRDF.GetResource(gCreateInFolder, true);    const kRDFCContractID = "@mozilla.org/rdf/container;1";    const kRDFIID = Components.interfaces.nsIRDFContainer;    const kRDFC = Components.classes[kRDFCContractID].getService(kRDFIID);    try {      kRDFC.Init(kBMDS, rFolder);    }    catch (e) {      // No "NC:NewBookmarkFolder" exists, just append to the root.      rFolder = kRDF.GetResource("NC:BookmarksRoot", true);      kRDFC.Init(kBMDS, rFolder);    }    // if no URL was provided and we're not filing as a group, do nothing    if (!gFld_URL.value && !addingGroup())      return;    var url;    if (addingGroup()) {      const group = kBMS.createGroup(gFld_Name.value, rFolder);      const groups = window.arguments[5];      for (var i = 0; i < groups.length; ++i) {        url = getNormalizedURL(groups[i].url);        kBMS.createBookmarkWithDetails(groups[i].name, url,                                       groups[i].charset, group, -1);      }    } else {      url = getNormalizedURL(gFld_URL.value);      var newBookmark = kBMS.createBookmarkWithDetails(gFld_Name.value, url, gBookmarkCharset, rFolder, -1);      if (window.arguments[4] == "newBookmark") {        window.arguments[5].newBookmark = newBookmark;      }    }  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/cfef21fe45a8f8c88065e3c145d32ec3a65aeb4a/addBookmark.js/buggy/xpfe/components/bookmarks/resources/addBookmark.js