Bug 1450516 - Do not show last sync date if is not present. r=markh
authorEdouard Oger <eoger@fastmail.com>
Tue, 03 Apr 2018 14:08:57 -0400
changeset 777145 19508ed3af00749d7dbdd3664643a5985066de99
parent 777144 6ca7168ee904ef0d80442ed3002c49c4d555207e
child 777146 c259dc509f8be5f10d457a7113d3cb6a13e687b9
push id105088
push userjdescottes@mozilla.com
push dateWed, 04 Apr 2018 10:12:11 +0000
reviewersmarkh
bugs1450516
milestone61.0a1
Bug 1450516 - Do not show last sync date if is not present. r=markh MozReview-Commit-ID: GiZYeFzXujB
services/sync/modules/UIState.jsm
--- a/services/sync/modules/UIState.jsm
+++ b/services/sync/modules/UIState.jsm
@@ -192,21 +192,18 @@ const UIStateInternal = {
     } catch (e) {
       // Not fetching the profile is sad but the FxA logs will already have noise.
       return null;
     }
   },
 
   _setLastSyncTime(state) {
     if (state.status == UIState.STATUS_SIGNED_IN) {
-      try {
-        state.lastSync = new Date(Services.prefs.getCharPref("services.sync.lastSync", null));
-      } catch (_) {
-        state.lastSync = null;
-      }
+      const lastSync = Services.prefs.getCharPref("services.sync.lastSync", null);
+      state.lastSync = lastSync ? new Date(lastSync) : null;
     }
   },
 
   async _loginFailed() {
     // First ask FxA if it thinks the user needs re-authentication. In practice,
     // this check is probably canonical (ie, we probably don't really need
     // the check below at all as we drop local session info on the first sign
     // of a problem) - but we keep it for now to keep the risk down.