зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1511062: Remove onItemMoved from nsINavBookmarkObserver. r=mak
Depends on D102574 Differential Revision: https://phabricator.services.mozilla.com/D102575
This commit is contained in:
Родитель
459dae23fa
Коммит
3ddb5240c2
|
@ -181,25 +181,6 @@ let observer = new (class extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemMoved(
|
|
||||||
id,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
itemType,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid,
|
|
||||||
source
|
|
||||||
) {
|
|
||||||
let info = {
|
|
||||||
parentId: newParentGuid,
|
|
||||||
index: newIndex,
|
|
||||||
oldParentId: oldParentGuid,
|
|
||||||
oldIndex,
|
|
||||||
};
|
|
||||||
this.emit("moved", { guid, info });
|
|
||||||
}
|
|
||||||
|
|
||||||
onItemChanged(
|
onItemChanged(
|
||||||
id,
|
id,
|
||||||
prop,
|
prop,
|
||||||
|
|
|
@ -50,9 +50,7 @@ class BookmarksObserver extends Observer {
|
||||||
this.skipTags = true;
|
this.skipTags = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty functions to make xpconnect happy
|
// Empty functions to make xpconnect happy.
|
||||||
onItemMoved() {}
|
|
||||||
|
|
||||||
// Disabled due to performance cost, see Issue 3203 /
|
// Disabled due to performance cost, see Issue 3203 /
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1392267.
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1392267.
|
||||||
onItemChanged() {}
|
onItemChanged() {}
|
||||||
|
|
|
@ -1092,7 +1092,6 @@ describe("PlacesFeed", () => {
|
||||||
});
|
});
|
||||||
describe("Other empty methods (to keep code coverage happy)", () => {
|
describe("Other empty methods (to keep code coverage happy)", () => {
|
||||||
it("should have a various empty functions for xpconnect happiness", () => {
|
it("should have a various empty functions for xpconnect happiness", () => {
|
||||||
observer.onItemMoved();
|
|
||||||
observer.onItemChanged();
|
observer.onItemChanged();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1312,38 +1312,6 @@ var gEditItemOverlay = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved(
|
|
||||||
id,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
type,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid
|
|
||||||
) {
|
|
||||||
if (!this._paneInfo.isItem || this._paneInfo.itemId != id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._paneInfo.parentGuid = newParentGuid;
|
|
||||||
|
|
||||||
if (
|
|
||||||
!this._paneInfo.visibleRows.has("folderRow") ||
|
|
||||||
newParentGuid == this._folderMenuList.selectedItem.folderGuid
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just setting selectItem _does not_ trigger oncommand, so we don't
|
|
||||||
// recurse.
|
|
||||||
PlacesUtils.bookmarks.fetch(newParentGuid).then(bm => {
|
|
||||||
this._folderMenuList.selectedItem = this._getFolderMenuItem(
|
|
||||||
newParentGuid,
|
|
||||||
bm.title
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(gEditItemOverlay, "_folderTree", () => {
|
XPCOMUtils.defineLazyGetter(gEditItemOverlay, "_folderTree", () => {
|
||||||
|
|
|
@ -6,7 +6,6 @@ add_task(async function() {
|
||||||
function promiseOnItemChanged() {
|
function promiseOnItemChanged() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
PlacesUtils.bookmarks.addObserver({
|
PlacesUtils.bookmarks.addObserver({
|
||||||
onItemMoved() {},
|
|
||||||
onItemChanged(id, property, isAnno, value) {
|
onItemChanged(id, property, isAnno, value) {
|
||||||
PlacesUtils.bookmarks.removeObserver(this);
|
PlacesUtils.bookmarks.removeObserver(this);
|
||||||
resolve({ property, value });
|
resolve({ property, value });
|
||||||
|
|
|
@ -190,23 +190,6 @@ var bookmarksObserver = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved(
|
|
||||||
itemId,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
itemType,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid
|
|
||||||
) {
|
|
||||||
this._notifications.push([
|
|
||||||
"assertItemMoved",
|
|
||||||
newParentGuid,
|
|
||||||
guid,
|
|
||||||
newIndex,
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
|
|
||||||
onItemChanged(
|
onItemChanged(
|
||||||
itemId,
|
itemId,
|
||||||
property,
|
property,
|
||||||
|
|
|
@ -933,24 +933,6 @@ BookmarksTracker.prototype = {
|
||||||
);
|
);
|
||||||
this._upScore();
|
this._upScore();
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved: function BMT_onItemMoved(
|
|
||||||
itemId,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
itemType,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid,
|
|
||||||
source
|
|
||||||
) {
|
|
||||||
if (IGNORED_SOURCES.includes(source)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._log.trace("onItemMoved: " + itemId);
|
|
||||||
this._upScore();
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -444,24 +444,6 @@ TaggingService.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved: function TS_onItemMoved(
|
|
||||||
aItemId,
|
|
||||||
aOldIndex,
|
|
||||||
aNewIndex,
|
|
||||||
aItemType,
|
|
||||||
aGuid,
|
|
||||||
aOldParentGuid,
|
|
||||||
aNewParentGuid
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
this._tagFolders[aItemId] &&
|
|
||||||
PlacesUtils.bookmarks.tagsGuid == aOldParentGuid &&
|
|
||||||
PlacesUtils.bookmarks.tagsGuid != aNewParentGuid
|
|
||||||
) {
|
|
||||||
delete this._tagFolders[aItemId];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
|
|
||||||
classID: Components.ID("{bbc23860-2553-479d-8b78-94d9038334f7}"),
|
classID: Components.ID("{bbc23860-2553-479d-8b78-94d9038334f7}"),
|
||||||
|
|
|
@ -83,39 +83,6 @@ interface nsINavBookmarkObserver : nsISupports
|
||||||
in ACString aParentGuid,
|
in ACString aParentGuid,
|
||||||
in AUTF8String aOldValue,
|
in AUTF8String aOldValue,
|
||||||
in unsigned short aSource);
|
in unsigned short aSource);
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies that an item has been moved.
|
|
||||||
*
|
|
||||||
* @param aItemId
|
|
||||||
* The id of the item that was moved.
|
|
||||||
* @param aOldIndex
|
|
||||||
* The old index inside the old parent.
|
|
||||||
* @param aNewIndex
|
|
||||||
* The index inside the new parent.
|
|
||||||
* @param aItemType
|
|
||||||
* The type of the item to be removed (see TYPE_* constants below).
|
|
||||||
* @param aGuid
|
|
||||||
* The unique ID associated with the item.
|
|
||||||
* @param aOldParentGuid
|
|
||||||
* The unique ID associated with the old item's parent.
|
|
||||||
* @param aNewParentGuid
|
|
||||||
* The unique ID associated with the new item's parent.
|
|
||||||
* @param aSource
|
|
||||||
* A change source constant from nsINavBookmarksService::SOURCE_*,
|
|
||||||
* passed to the method that notifies the observer.
|
|
||||||
* @param aURI
|
|
||||||
* The URI for this bookmark.
|
|
||||||
*/
|
|
||||||
void onItemMoved(in long long aItemId,
|
|
||||||
in long aOldIndex,
|
|
||||||
in long aNewIndex,
|
|
||||||
in unsigned short aItemType,
|
|
||||||
in ACString aGuid,
|
|
||||||
in ACString aOldParentGuid,
|
|
||||||
in ACString aNewParentGuid,
|
|
||||||
in unsigned short aSource,
|
|
||||||
in AUTF8String aURI);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3950,36 +3950,6 @@ nsNavHistoryResult::OnItemChanged(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Need to notify both the source and the destination folders (if they are
|
|
||||||
* different).
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsNavHistoryResult::OnItemMoved(int64_t aItemId, int32_t aOldIndex,
|
|
||||||
int32_t aNewIndex, uint16_t aItemType,
|
|
||||||
const nsACString& aGUID,
|
|
||||||
const nsACString& aOldParentGUID,
|
|
||||||
const nsACString& aNewParentGUID,
|
|
||||||
uint16_t aSource, const nsACString& aURI) {
|
|
||||||
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(
|
|
||||||
aOldParentGUID,
|
|
||||||
OnItemMoved(aItemId, aOldIndex, aNewIndex, aItemType, aGUID,
|
|
||||||
aOldParentGUID, aNewParentGUID, aSource, aURI));
|
|
||||||
if (!aNewParentGUID.Equals(aOldParentGUID)) {
|
|
||||||
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(
|
|
||||||
aNewParentGUID,
|
|
||||||
OnItemMoved(aItemId, aOldIndex, aNewIndex, aItemType, aGUID,
|
|
||||||
aOldParentGUID, aNewParentGUID, aSource, aURI));
|
|
||||||
}
|
|
||||||
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
|
|
||||||
OnItemMoved(aItemId, aOldIndex, aNewIndex, aItemType, aGUID,
|
|
||||||
aOldParentGUID, aNewParentGUID, aSource, aURI));
|
|
||||||
ENUMERATE_HISTORY_OBSERVERS(OnItemMoved(aItemId, aOldIndex, aNewIndex,
|
|
||||||
aItemType, aGUID, aOldParentGUID,
|
|
||||||
aNewParentGUID, aSource, aURI));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsNavHistoryResult::OnVisit(nsIURI* aURI, int64_t aVisitId,
|
nsresult nsNavHistoryResult::OnVisit(nsIURI* aURI, int64_t aVisitId,
|
||||||
PRTime aTime, uint32_t aTransitionType,
|
PRTime aTime, uint32_t aTransitionType,
|
||||||
const nsACString& aGUID, bool aHidden,
|
const nsACString& aGUID, bool aHidden,
|
||||||
|
|
|
@ -688,6 +688,11 @@ class nsNavHistoryQueryResultNode final
|
||||||
uint16_t aItemType, nsIURI* aURI,
|
uint16_t aItemType, nsIURI* aURI,
|
||||||
const nsACString& aGUID, const nsACString& aParentGUID,
|
const nsACString& aGUID, const nsACString& aParentGUID,
|
||||||
uint16_t aSource);
|
uint16_t aSource);
|
||||||
|
nsresult OnItemMoved(int64_t aFolder, int32_t aOldIndex, int32_t aNewIndex,
|
||||||
|
uint16_t aItemType, const nsACString& aGUID,
|
||||||
|
const nsACString& aOldParentGUID,
|
||||||
|
const nsACString& aNewParentGUID, uint16_t aSource,
|
||||||
|
const nsACString& aURI);
|
||||||
|
|
||||||
// The internal version has an output aAdded parameter, it is incremented by
|
// The internal version has an output aAdded parameter, it is incremented by
|
||||||
// query nodes when the visited uri belongs to them. If no such query exists,
|
// query nodes when the visited uri belongs to them. If no such query exists,
|
||||||
|
@ -786,6 +791,11 @@ class nsNavHistoryFolderResultNode final
|
||||||
uint16_t aItemType, nsIURI* aURI,
|
uint16_t aItemType, nsIURI* aURI,
|
||||||
const nsACString& aGUID, const nsACString& aParentGUID,
|
const nsACString& aGUID, const nsACString& aParentGUID,
|
||||||
uint16_t aSource);
|
uint16_t aSource);
|
||||||
|
nsresult OnItemMoved(int64_t aFolder, int32_t aOldIndex, int32_t aNewIndex,
|
||||||
|
uint16_t aItemType, const nsACString& aGUID,
|
||||||
|
const nsACString& aOldParentGUID,
|
||||||
|
const nsACString& aNewParentGUID, uint16_t aSource,
|
||||||
|
const nsACString& aURI);
|
||||||
nsresult OnItemVisited(nsIURI* aURI, int64_t aVisitId, PRTime aTime);
|
nsresult OnItemVisited(nsIURI* aURI, int64_t aVisitId, PRTime aTime);
|
||||||
virtual void OnRemoving() override;
|
virtual void OnRemoving() override;
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,6 @@ var gBookmarksObserver = {
|
||||||
onItemChanged() {
|
onItemChanged() {
|
||||||
return this.validate("onItemChanged", arguments);
|
return this.validate("onItemChanged", arguments);
|
||||||
},
|
},
|
||||||
onItemMoved() {
|
|
||||||
return this.validate("onItemMoved", arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
||||||
|
@ -106,9 +103,6 @@ var gBookmarkSkipObserver = {
|
||||||
onItemChanged() {
|
onItemChanged() {
|
||||||
return this.validate("onItemChanged", arguments);
|
return this.validate("onItemChanged", arguments);
|
||||||
},
|
},
|
||||||
onItemMoved() {
|
|
||||||
return this.validate("onItemMoved", arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
||||||
|
|
|
@ -25,7 +25,6 @@ function promiseOnItemChanged() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
PlacesUtils.bookmarks.addObserver({
|
PlacesUtils.bookmarks.addObserver({
|
||||||
onItemRemoved() {},
|
onItemRemoved() {},
|
||||||
onItemMoved() {},
|
|
||||||
|
|
||||||
onItemChanged() {
|
onItemChanged() {
|
||||||
PlacesUtils.bookmarks.removeObserver(this);
|
PlacesUtils.bookmarks.removeObserver(this);
|
||||||
|
|
|
@ -722,7 +722,6 @@ function NavBookmarkObserver() {}
|
||||||
NavBookmarkObserver.prototype = {
|
NavBookmarkObserver.prototype = {
|
||||||
onItemRemoved() {},
|
onItemRemoved() {},
|
||||||
onItemChanged() {},
|
onItemChanged() {},
|
||||||
onItemMoved() {},
|
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ var bookmarksObserver = {
|
||||||
this._itemChangedValue = value;
|
this._itemChangedValue = value;
|
||||||
this._itemChangedOldValue = oldValue;
|
this._itemChangedOldValue = oldValue;
|
||||||
},
|
},
|
||||||
onItemMoved() {},
|
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -393,32 +393,6 @@ BookmarkObserver.prototype = {
|
||||||
}
|
}
|
||||||
this.notifications.push({ name: "onItemChanged", params });
|
this.notifications.push({ name: "onItemChanged", params });
|
||||||
},
|
},
|
||||||
onItemMoved(
|
|
||||||
itemId,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
type,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid,
|
|
||||||
source,
|
|
||||||
urlHref
|
|
||||||
) {
|
|
||||||
this.notifications.push({
|
|
||||||
name: "onItemMoved",
|
|
||||||
params: {
|
|
||||||
itemId,
|
|
||||||
oldIndex,
|
|
||||||
newIndex,
|
|
||||||
type,
|
|
||||||
guid,
|
|
||||||
oldParentGuid,
|
|
||||||
newParentGuid,
|
|
||||||
source,
|
|
||||||
urlHref,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
QueryInterface: ChromeUtils.generateQI(["nsINavBookmarkObserver"]),
|
||||||
|
|
||||||
|
|
|
@ -100,24 +100,6 @@ var observer = {
|
||||||
};
|
};
|
||||||
changesForGuid.set(aProperty, change);
|
changesForGuid.set(aProperty, change);
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved(
|
|
||||||
aItemId,
|
|
||||||
aOldIndex,
|
|
||||||
aNewIndex,
|
|
||||||
aItemType,
|
|
||||||
aGuid,
|
|
||||||
aOldParentGuid,
|
|
||||||
aNewParentGuid
|
|
||||||
) {
|
|
||||||
this.itemsMoved.set(aGuid, {
|
|
||||||
oldParentGuid: aOldParentGuid,
|
|
||||||
oldIndex: aOldIndex,
|
|
||||||
newParentGuid: aNewParentGuid,
|
|
||||||
newIndex: aNewIndex,
|
|
||||||
itemType: aItemType,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ add_task(async function run_test() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemMoved() {},
|
|
||||||
};
|
};
|
||||||
PlacesUtils.bookmarks.addObserver(bookmarksObserver);
|
PlacesUtils.bookmarks.addObserver(bookmarksObserver);
|
||||||
bookmarksObserver.handlePlacesEvents = bookmarksObserver.handlePlacesEvents.bind(
|
bookmarksObserver.handlePlacesEvents = bookmarksObserver.handlePlacesEvents.bind(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче