Bug 1483043 - Only call SerializeURI if running in e10s r=mak
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 30 Aug 2018 14:49:33 +0000
changeset 482439 92c10215a3f6ab857556d37ebcab53a09d65a91c
parent 482420 91dc93fd924586ad3db866bb5ea0db0260c8209d
child 482440 ea662eb5edee485f324f85aa43699fcbb1b7b445
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersmak
bugs1483043
milestone63.0a1
Bug 1483043 - Only call SerializeURI if running in e10s r=mak Some nsIURI types do not implement nsIIPCSerializableURI, and this is causing a crash in SerializeURI when running in thunderbird. This shouldn't happen, since thunderbird is not running under e10s, so even attempting to serialize the URIs is pointless. Differential Revision: https://phabricator.services.mozilla.com/D3402
toolkit/components/places/History.cpp
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -23,16 +23,17 @@
 #include "mozilla/storage.h"
 #include "mozilla/dom/Link.h"
 #include "nsDocShellCID.h"
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
 #include "nsIFileURL.h"
 #include "nsIXPConnect.h"
+#include "nsIXULRuntime.h"
 #include "mozilla/Unused.h"
 #include "nsContentUtils.h" // for nsAutoScriptBlocker
 #include "nsJSUtils.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "nsPrintfCString.h"
 #include "nsTHashtable.h"
 #include "jsapi.h"
 #include "mozilla/dom/ContentProcessMessageManager.h"
@@ -485,21 +486,23 @@ public:
       mCallback->IsVisited(mURI, mIsVisited);
       return NS_OK;
     }
 
     if (mIsVisited) {
       History* history = History::GetService();
       NS_ENSURE_STATE(history);
       history->NotifyVisited(mURI);
-      AutoTArray<URIParams, 1> uris;
-      URIParams uri;
-      SerializeURI(mURI, uri);
-      uris.AppendElement(std::move(uri));
-      history->NotifyVisitedParent(uris);
+      if (BrowserTabsRemoteAutostart()) {
+        AutoTArray<URIParams, 1> uris;
+        URIParams uri;
+        SerializeURI(mURI, uri);
+        uris.AppendElement(std::move(uri));
+        history->NotifyVisitedParent(uris);
+      }
     }
 
     nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
     if (observerService) {
       nsAutoString status;
       if (mIsVisited) {
         status.AssignLiteral(URI_VISITED);
@@ -652,30 +655,34 @@ public:
 
     PRTime now = PR_Now();
     if (mPlaces.Length() > 0) {
       InfallibleTArray<URIParams> serializableUris(mPlaces.Length());
       for (uint32_t i = 0; i < mPlaces.Length(); ++i) {
         nsresult rv = NotifyVisit(navHistory, obsService, now, uris[i], mPlaces[i]);
         NS_ENSURE_SUCCESS(rv, rv);
 
-        URIParams serializedUri;
-        SerializeURI(uris[i], serializedUri);
-        serializableUris.AppendElement(std::move(serializedUri));
+        if (BrowserTabsRemoteAutostart()) {
+          URIParams serializedUri;
+          SerializeURI(uris[i], serializedUri);
+          serializableUris.AppendElement(std::move(serializedUri));
+        }
       }
       mHistory->NotifyVisitedParent(serializableUris);
     } else {
       AutoTArray<URIParams, 1> serializableUris;
       nsresult rv = NotifyVisit(navHistory, obsService, now, uris[0], mPlace);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      URIParams serializedUri;
-      SerializeURI(uris[0], serializedUri);
-      serializableUris.AppendElement(std::move(serializedUri));
-      mHistory->NotifyVisitedParent(serializableUris);
+      if (BrowserTabsRemoteAutostart()) {
+        URIParams serializedUri;
+        SerializeURI(uris[0], serializedUri);
+        serializableUris.AppendElement(std::move(serializedUri));
+        mHistory->NotifyVisitedParent(serializableUris);
+      }
     }
 
     return NS_OK;
   }
 private:
   nsTArray<VisitData> mPlaces;
   VisitData mPlace;
   RefPtr<History> mHistory;