Bug 1354007 - Wrap PlacesUtils.asyncHistory.updatePlaces into try/catch. r=aceman CLOSED TREE DONTBUILD
authorJorg K <jorgk@jorgk.com>
Mon, 10 Apr 2017 22:29:54 +0200
changeset 28028 cd308c03dde86f876a7ccf1c5c6da40ed3b9feff
parent 28027 ab8e368c669cac5f3e880270e5784b045cc50b20
child 28029 c553f7084ca92a5a93b66c5d0a82b78e385d356b
push id1966
push userclokep@gmail.com
push dateMon, 12 Jun 2017 16:57:35 +0000
treeherdercomm-beta@32d9b8d10da1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1354007
Bug 1354007 - Wrap PlacesUtils.asyncHistory.updatePlaces into try/catch. r=aceman CLOSED TREE DONTBUILD
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