Bug 1407164 - Fix strict warnings in Bookmarks.jsm relating to undefined property source - don't delete item properties too soon. r?mak
MozReview-Commit-ID: AJJRSHYqPch
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -473,24 +473,24 @@ var Bookmarks = Object.freeze({
parentId = itemIdMap.get(item.parentGuid);
}
notify(observers, "onItemAdded", [ itemId, parentId, item.index,
item.type, uri, item.title,
PlacesUtils.toPRTime(item.dateAdded), item.guid,
item.parentGuid, item.source ],
{ isTagging: false });
- // Remove non-enumerable properties.
- delete item.source;
-
// Note, annotations for livemark data are deleted from insertInfo
// within appendInsertionInfoForInfoArray, so we won't be duplicating
// the insertions here.
await handleBookmarkItemSpecialData(itemId, item);
+ // Remove non-enumerable properties.
+ delete item.source;
+
insertInfos[i] = Object.assign({}, item);
}
return insertInfos;
})();
},
/**
* Updates a bookmark-item.
@@ -1543,17 +1543,17 @@ async function handleBookmarkItemSpecial
source: item.source
});
} catch (ex) {
Cu.reportError(`Failed to insert keywords: ${ex}`);
}
}
if ("tags" in item) {
try {
- PlacesUtils.tagging.tagURI(NetUtil.newURI(item.url), item.tags, item._source);
+ PlacesUtils.tagging.tagURI(NetUtil.newURI(item.url), item.tags, item.source);
} catch (ex) {
// Invalid tag child, skip it.
Cu.reportError(`Unable to set tags "${item.tags.join(", ")}" for ${item.url}: ${ex}`);
}
}
if ("charset" in item && item.charset) {
await PlacesUtils.setCharsetForURI(NetUtil.newURI(item.url), item.charset);
}