Bug 1280357 - Update browser.history.onVisited to not call PlacesUtils.promisePlaceInfo, r=kmag
authorBob Silverberg <bsilverberg@mozilla.com>
Tue, 19 Jul 2016 17:01:08 -0400
changeset 390601 17409ee90c864e7e982a43e2026e6814a0797e4d
parent 390600 fff0c4030b81ceb8b98d4db74807b746f403770c
child 390602 cab3629ad5fd8f7d6c960bdf966b14cfb06e7eb3
child 390610 1a4217310f5cebbfd1c80dee7a970f67f7e4d192
child 390624 0be81bdc2e08b658f91dc05443ab15ced91025f2
child 390721 740d119d34968b06d9a02664f33d8170866fd45c
push id23706
push users.kaspari@gmail.com
push dateThu, 21 Jul 2016 13:37:48 +0000
reviewerskmag
bugs1280357
milestone50.0a1
Bug 1280357 - Update browser.history.onVisited to not call PlacesUtils.promisePlaceInfo, r=kmag MozReview-Commit-ID: 3j4JdWI6APu
browser/components/extensions/ext-history.js
browser/components/extensions/test/browser/browser_ext_history.js
--- a/browser/components/extensions/ext-history.js
+++ b/browser/components/extensions/ext-history.js
@@ -94,27 +94,25 @@ var _observer;
 
 function getObserver() {
   if (!_observer) {
     _observer = {
       onDeleteURI: function(uri, guid, reason) {
         this.emit("visitRemoved", {allHistory: false, urls: [uri.spec]});
       },
       onVisit: function(uri, visitId, time, sessionId, referringId, transitionType, guid, hidden, visitCount, typed) {
-        PlacesUtils.promisePlaceInfo(guid).then(placeInfo => {
-          let data = {
-            id: guid,
-            url: uri.spec,
-            title: placeInfo.title,
-            lastVisitTime: time / 1000,  // time from Places is microseconds,
-            visitCount,
-            typedCount: typed,
-          };
-          this.emit("visited", data);
-        });
+        let data = {
+          id: guid,
+          url: uri.spec,
+          title: "",
+          lastVisitTime: time / 1000,  // time from Places is microseconds,
+          visitCount,
+          typedCount: typed,
+        };
+        this.emit("visited", data);
       },
       onBeginUpdateBatch: function() {},
       onEndUpdateBatch: function() {},
       onTitleChanged: function() {},
       onClearHistory: function() {
         this.emit("visitRemoved", {allHistory: true});
       },
       onPageChanged: function() {},
--- a/browser/components/extensions/test/browser/browser_ext_history.js
+++ b/browser/components/extensions/test/browser/browser_ext_history.js
@@ -454,17 +454,19 @@ add_task(function* test_on_visited() {
   yield PlacesUtils.history.insertMany(PAGE_INFOS);
 
   let onVisitedData = yield extension.awaitMessage("on-visited-data");
 
   function checkOnVisitedData(index, expected) {
     let onVisited = onVisitedData[index];
     ok(PlacesUtils.isValidGuid(onVisited.id), "onVisited received a valid id");
     is(onVisited.url, expected.url, "onVisited received the expected url");
-    is(onVisited.title, expected.title, "onVisited received the expected title");
+    // Title will be blank until bug 1287928 lands
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=1287928
+    is(onVisited.title, "", "onVisited received a blank title");
     is(onVisited.lastVisitTime, expected.time, "onVisited received the expected time");
     is(onVisited.visitCount, expected.visitCount, "onVisited received the expected visitCount");
   }
 
   let expected = {
     url: PAGE_INFOS[0].url,
     title: PAGE_INFOS[0].title,
     time: PAGE_INFOS[0].visits[0].date.getTime(),