Bug 1354007 - Wrap PlacesUtils.asyncHistory.updatePlaces into try/catch. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Mon, 10 Apr 2017 22:29:54 +0200
changeset 24456 d5050ddfdc5c
parent 24455 e75d6aba1066
child 24457 14adadd2aca7
push id2055
push usermozilla@jorgk.com
push dateWed, 12 Apr 2017 15:22:52 +0000
treeherdercomm-aurora@d3970dc6cd9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, jorgk
bugs1354007
Bug 1354007 - Wrap PlacesUtils.asyncHistory.updatePlaces into try/catch. r=aceman a=jorgk
mail/base/content/contentAreaClick.js
--- a/mail/base/content/contentAreaClick.js
+++ b/mail/base/content/contentAreaClick.js
@@ -171,23 +171,28 @@ function contentAreaClick(aEvent)
  * @param url  A url string or an nsIURI containing the url to open.
  */
 function openLinkExternally(url)
 {
   let uri = url;
   if (!(uri instanceof Components.interfaces.nsIURI))
     uri = Services.io.newURI(url);
 
-  PlacesUtils.asyncHistory.updatePlaces({
-    uri: uri,
-    visits:  [{
-      visitDate: Date.now() * 1000,
-      transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
-    }]
-  });
+  // This can fail if there is a problem with the places database.
+  try {
+    PlacesUtils.asyncHistory.updatePlaces({
+      uri: uri,
+      visits:  [{
+        visitDate: Date.now() * 1000,
+        transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+      }]
+    });
+  } catch (ex) {
+    Components.utils.reportError(ex);
+  }
 
   Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
             .getService(Components.interfaces.nsIExternalProtocolService)
             .loadUrl(uri);
 }
 
 /**
  * Compatibility to Firefox, used for example by devtools to open links. Defer