зеркало из https://github.com/mozilla/gecko-dev.git
Best fix for 87864, prevent duplicate bookmarks from being processed when loading a bookmarks file.
This code was originally removed from 6.1 because performance issues with IndexOf, which have recently been addressed. r=pchen, sr=waterson
This commit is contained in:
Родитель
ccf920d8ed
Коммит
41f3c95e4b
|
@ -1217,10 +1217,18 @@ BookmarkParser::ParseBookmarkInfo(BookmarkField *fields, PRBool isBookmarkFlag,
|
|||
}
|
||||
}
|
||||
|
||||
// The last thing we do is add the bookmark to the container.
|
||||
// This ensures the minimal amount of reflow.
|
||||
rv = aContainer->AppendElement(bookmark);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add bookmark to container");
|
||||
// prevent duplicates
|
||||
PRInt32 aIndex;
|
||||
nsCOMPtr<nsIRDFResource> containerRes;
|
||||
aContainer->GetResource(getter_AddRefs(containerRes));
|
||||
if (containerRes && NS_SUCCEEDED(gRDFC->IndexOf(mDataSource, containerRes, bookmark, &aIndex)) &&
|
||||
(aIndex < 0))
|
||||
{
|
||||
// The last thing we do is add the bookmark to the container.
|
||||
// This ensures the minimal amount of reflow.
|
||||
rv = aContainer->AppendElement(bookmark);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add bookmark to container");
|
||||
}
|
||||
}
|
||||
|
||||
// free up any allocated data in field table AFTER processing
|
||||
|
|
Загрузка…
Ссылка в новой задаче