Bug 1314179 - Ensure `PlacesSyncUtils.bookmarks.remove` passes the correct source to observers. r=markh
MozReview-Commit-ID: 8uuwh1DTlo2
--- a/browser/components/places/tests/unit/head_bookmarks.js
+++ b/browser/components/places/tests/unit/head_bookmarks.js
@@ -73,16 +73,20 @@ var createCorruptDB = Task.async(functio
* exception generated.
*
* @return {Promise}
* Resolved when done.
*/
function rebuildSmartBookmarks() {
let consoleListener = {
observe(aMsg) {
+ if (aMsg.message.startsWith("[JavaScript Warning:")) {
+ // TODO (Bug 1300416): Ignore spurious strict warnings.
+ return;
+ }
do_throw("Got console message: " + aMsg.message);
},
QueryInterface: XPCOMUtils.generateQI([ Ci.nsIConsoleListener ]),
};
Services.console.reset();
Services.console.registerListener(consoleListener);
do_register_cleanup(() => {
try {
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -422,31 +422,32 @@ var Bookmarks = Object.freeze({
return Task.spawn(function* () {
let item = yield fetchBookmark(removeInfo);
if (!item)
throw new Error("No bookmarks found for the provided GUID.");
item = yield removeBookmark(item, options);
// Notify onItemRemoved to listeners.
+ let { source = Bookmarks.SOURCES.DEFAULT } = options;
let observers = PlacesUtils.bookmarks.getObservers();
let uri = item.hasOwnProperty("url") ? PlacesUtils.toURI(item.url) : null;
notify(observers, "onItemRemoved", [ item._id, item._parentId, item.index,
item.type, uri, item.guid,
item.parentGuid,
- removeInfo.source ]);
+ source ]);
let isUntagging = item._grandParentId == PlacesUtils.tagsFolderId;
if (isUntagging) {
for (let entry of (yield fetchBookmarksByURL(item))) {
notify(observers, "onItemChanged", [ entry._id, "tags", false, "",
PlacesUtils.toPRTime(entry.lastModified),
entry.type, entry._parentId,
entry.guid, entry.parentGuid,
- "", removeInfo.source ]);
+ "", source ]);
}
}
// Remove non-enumerable properties.
return Object.assign({}, item);
});
},