зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a71332c75a18 for the leak orange
This commit is contained in:
Родитель
ab65f6f68f
Коммит
b47868c8cb
|
@ -488,25 +488,18 @@ function placesRemoveItemTransaction(aItemId) {
|
|||
this._removeTxn = PlacesUtils.bookmarks
|
||||
.getRemoveFolderTransaction(this._id);
|
||||
}
|
||||
else if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
|
||||
this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._id);
|
||||
this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._id);
|
||||
}
|
||||
|
||||
if (this._itemType != Ci.nsINavBookmarksService.TYPE_SEPARATOR)
|
||||
this._title = PlacesUtils.bookmarks.getItemTitle(this._id);
|
||||
|
||||
this._oldContainer = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
|
||||
this._annotations = PlacesUtils.getAnnotationsForItem(this._id);
|
||||
this._dateAdded = PlacesUtils.bookmarks.getItemDateAdded(this._id);
|
||||
this._lastModified = PlacesUtils.bookmarks.getItemLastModified(this._id);
|
||||
}
|
||||
|
||||
placesRemoveItemTransaction.prototype = {
|
||||
__proto__: placesBaseTransaction.prototype,
|
||||
|
||||
doTransaction: function PRIT_doTransaction() {
|
||||
this._oldContainer = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
|
||||
this._oldIndex = PlacesUtils.bookmarks.getItemIndex(this._id);
|
||||
this._title = PlacesUtils.bookmarks.getItemTitle(this._id);
|
||||
this._annotations = PlacesUtils.getAnnotationsForItem(this._id);
|
||||
this._dateAdded = PlacesUtils.bookmarks.getItemDateAdded(this._id);
|
||||
this._lastModified = PlacesUtils.bookmarks.getItemLastModified(this._id);
|
||||
|
||||
if (this._itemType == Ci.nsINavBookmarksService.TYPE_FOLDER) {
|
||||
this._saveFolderContents();
|
||||
|
@ -519,6 +512,8 @@ placesRemoveItemTransaction.prototype = {
|
|||
this._removeTxn.doTransaction();
|
||||
}
|
||||
else {
|
||||
if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK)
|
||||
this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._id);
|
||||
PlacesUtils.bookmarks.removeItem(this._id);
|
||||
if (this._uri) {
|
||||
// if this was the last bookmark (excluding tag-items and livemark
|
||||
|
@ -540,8 +535,6 @@ placesRemoveItemTransaction.prototype = {
|
|||
this._title);
|
||||
if (this._tags && this._tags.length > 0)
|
||||
PlacesUtils.tagging.tagURI(this._uri, this._tags);
|
||||
if (this._keyword)
|
||||
PlacesUtils.bookmarks.setKeywordForBookmark(this._id, this._keyword);
|
||||
}
|
||||
else if (this._itemType == Ci.nsINavBookmarksService.TYPE_FOLDER) {
|
||||
this._removeTxn.undoTransaction();
|
||||
|
|
|
@ -291,24 +291,20 @@ function run_test() {
|
|||
do_check_eq(observer._itemAddedParent, root);
|
||||
do_check_eq(observer._itemAddedIndex, 3);
|
||||
|
||||
// Test removing an item with a keyword
|
||||
bmsvc.setKeywordForBookmark(bkmk2Id, "test_keyword");
|
||||
// Test removing an item
|
||||
var txn5 = ptSvc.removeItem(bkmk2Id);
|
||||
txn5.doTransaction();
|
||||
do_check_eq(observer._itemRemovedId, bkmk2Id);
|
||||
do_check_eq(observer._itemRemovedFolder, root);
|
||||
do_check_eq(observer._itemRemovedIndex, 2);
|
||||
do_check_eq(bmsvc.getKeywordForBookmark(bkmk2Id), null);
|
||||
txn5.undoTransaction();
|
||||
var newbkmk2Id = observer._itemAddedId;
|
||||
do_check_eq(observer._itemAddedParent, root);
|
||||
do_check_eq(observer._itemAddedIndex, 2);
|
||||
do_check_eq(bmsvc.getKeywordForBookmark(newbkmk2Id), "test_keyword");
|
||||
txn5.redoTransaction();
|
||||
do_check_eq(observer._itemRemovedId, newbkmk2Id);
|
||||
do_check_eq(observer._itemRemovedFolder, root);
|
||||
do_check_eq(observer._itemRemovedIndex, 2);
|
||||
do_check_eq(bmsvc.getKeywordForBookmark(newbkmk2Id), null);
|
||||
txn5.undoTransaction();
|
||||
do_check_eq(observer._itemAddedParent, root);
|
||||
do_check_eq(observer._itemAddedIndex, 2);
|
||||
|
|
Загрузка…
Ссылка в новой задаче