87864 - attempt at preventing bookmarks file growth due to duplicate bookmarks (?)

by preventing duplicate bookmark creation during copy operations.
r=jag, sr=waterson
This commit is contained in:
ben%netscape.com 2001-10-15 08:38:44 +00:00
Родитель a9fef1fac5
Коммит 0346ac2b60
2 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -329,6 +329,14 @@ var bookmarksDNDObserver = {
RDFC.Init(kBMDS, rContainer);
// If this item already exists in this container, don't paste, as
// this will result in the creation of multiple copies in the datasource
// but will not result in an update of the UI. (In Short: we don't
// handle multiple bookmarks well)
var ix = RDFC.IndexOf(rSource);
if (ix != -1)
continue;
var bmType = this.getTarget(bookmarksTree.database, sourceID[i], RDF_NS + "type");
if (!bmType)
kBMDS.Assert(rSource, rType, rBookmark, true);

Просмотреть файл

@ -523,7 +523,15 @@ BookmarksUIElement.prototype = {
if (rType && rType.Value == NC_NS + "Folder")
rCurrent = BookmarksUtils.cloneFolder(rCurrent, krParent, krSource);
// If this item already exists in this container, don't paste, as
// this will result in the creation of multiple copies in the datasource
// but will not result in an update of the UI. (In Short: we don't
// handle multiple bookmarks well)
ksRDFC.Init(kBMDS, krParent);
ix = ksRDFC.IndexOf(rCurrent);
if (ix != -1)
continue;
ix = ksRDFC.IndexOf(krSource);
if (ix != -1)
ksRDFC.InsertElementAt(rCurrent, ix+1, true);
@ -822,12 +830,6 @@ var BookmarksUtils = {
{ property: NC_NS + "URL", literal: krAnonymous.Value}];
this.doBookmarksCommand(aRelativeItem, NC_NS_CMD + "newfolder", args);
// Tidy up.
const krURL = this.RDF.GetResource(NC_NS + "URL");
const krCurrURL = krBMDS.GetTarget(krAnonymous, krURL, true);
const krEmpty = this.RDF.GetLiteral("");
krBMDS.Change(krAnonymous, krURL, krCurrURL, krEmpty);
return krAnonymous;
},