rem: if (addingGroup()) { rSource = BMDS.createFolder(gFld_Name.value); const groups  = window.arguments[5]; for (var i = 0; i < groups.length; ++i) { url = getNormalizedURL(groups[i].url); BMDS.createBookmarkInContainer(groups[i].name, url, null, null, groups[i].charset, null, rSource, -1); } } else { url = getNormalizedURL(gFld_URL.value); rSource = BMDS.createBookmark(gFld_Name.value, url, null, null, gBookmarkCharset, false, ""); if (window.arguments.length > 4 && window.arguments[4] == "newBookmark") { window.arguments[5].newBookmark = rSource; } } 
add:  url = getNormalizedURL(gFld_URL.value); rSource = BMDS.createBookmark(gFld_Name.value, url, null, null, gBookmarkCharset, false, ""); if (window.arguments.length > 4 && window.arguments[4] == "newBookmark") { window.arguments[5].newBookmark = rSource; } 
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.length > 4 && window.arguments[4] == "selectFolder")    window.arguments[5].target = BookmarksUtils.getTargetFromFolder(bookmarkView.treeBuilder.getResourceAtIndex(currentIndex));  else {    // Otherwise add a bookmark to the selected folder.     var rFolder = RDF.GetResource(gCreateInFolder);    try {      RDFC.Init(BMDS, rFolder);    }    catch (e) {      // No "NC:NewBookmarkFolder" exists, just append to the root.      rFolder = RDF.GetResource("NC:BookmarksRoot");      RDFC.Init(BMDS, rFolder);    }    // if no URL was provided and we're not filing as a group, do nothing    if (!gFld_URL.value && !addingGroup())      return;    var url, rSource;    if (addingGroup()) {      rSource = BMDS.createFolder(gFld_Name.value);      const groups  = window.arguments[5];      for (var i = 0; i < groups.length; ++i) {        url = getNormalizedURL(groups[i].url);        BMDS.createBookmarkInContainer(groups[i].name, url, null, null,                                       groups[i].charset, null, rSource, -1);      }    } else {      url = getNormalizedURL(gFld_URL.value);      rSource = BMDS.createBookmark(gFld_Name.value, url, null, null, gBookmarkCharset, false, "");      if (window.arguments.length > 4 && window.arguments[4] == "newBookmark") {        window.arguments[5].newBookmark = rSource;      }    }    var selection = BookmarksUtils.getSelectionFromResource(rSource);    var target    = BookmarksUtils.getTargetFromFolder(rFolder);    BookmarksUtils.insertAndCheckSelection("newbookmark", selection, target);  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6a705e392ef8db53e83ad8a9b514fb9909c3ccc8/addBookmark.js/buggy/browser/components/bookmarks/content/addBookmark.js