Bug 1407164 - Fix strict warnings in Bookmarks.jsm relating to undefined property source - don't delete item properties too soon. r=mak
authorMark Banner <standard8@mozilla.com>
Tue, 10 Oct 2017 09:13:19 +0100
changeset 385309 d77fd67f3722aeb14c7545fedbbd867b24c6493c
parent 385308 cd62fb50fe61504937ff3d37db3852bae0d73d0c
child 385310 529092fc92477be7accc8b604ea9c8812dafa969
push id32652
push userarchaeopteryx@coole-files.de
push dateTue, 10 Oct 2017 21:49:31 +0000
treeherdermozilla-central@f1ecd5c26948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1407164
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
toolkit/components/places/Bookmarks.jsm
--- 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);
   }