Bug 1321377 - When called from the content process, ClassifyLocalWithTables should return failure instead of causing an IPC error r=Ehsan,francois
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 30 Nov 2016 10:57:48 -0800
changeset 324864 8355901806763d6fc91abdf2a89a5f563f5966ac
parent 324863 d643dc8256bf96e54aae56943d8e62f45f36f053
child 324865 9ed7aed4f033d79645dda143896bd26325e95094
push id84525
push userphilringnalda@gmail.com
push dateThu, 01 Dec 2016 03:22:09 +0000
treeherdermozilla-inbound@b1d875f4c673 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, francois
bugs1321377
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1321377 - When called from the content process, ClassifyLocalWithTables should return failure instead of causing an IPC error r=Ehsan,francois MozReview-Commit-ID: B1RemxGRSKB
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4806,26 +4806,23 @@ ContentParent::DeallocPURLClassifierPare
 
   RefPtr<URLClassifierParent> actor =
     dont_AddRef(static_cast<URLClassifierParent*>(aActor));
   return true;
 }
 
 mozilla::ipc::IPCResult
 ContentParent::RecvClassifyLocal(const URIParams& aURI, const nsCString& aTables,
-                                 nsTArray<nsCString>* aResults)
+                                 nsresult *aRv, nsTArray<nsCString>* aResults)
 {
   MOZ_ASSERT(aResults);
   nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
   if (!uri) {
     return IPC_FAIL_NO_REASON(this);
   }
   nsCOMPtr<nsIURIClassifier> uriClassifier =
     do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID);
   if (!uriClassifier) {
     return IPC_FAIL_NO_REASON(this);
   }
-  nsresult rv = uriClassifier->ClassifyLocalWithTables(uri, aTables, *aResults);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return IPC_FAIL(this, "ClassifyLocalWithTables error");
-  }
+  *aRv = uriClassifier->ClassifyLocalWithTables(uri, aTables, *aResults);
   return IPC_OK();
 }
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -555,16 +555,17 @@ public:
                                 const bool& aUseTrackingProtection,
                                 bool* aSuccess) override;
   virtual bool
   DeallocPURLClassifierParent(PURLClassifierParent* aActor) override;
 
   virtual mozilla::ipc::IPCResult
   RecvClassifyLocal(const URIParams& aURI,
                     const nsCString& aTables,
+                    nsresult* aRv,
                     nsTArray<nsCString>* aResults) override;
 
   // Use the PHangMonitor channel to ask the child to repaint a tab.
   void ForceTabPaint(TabParent* aTabParent, uint64_t aLayerObserverEpoch);
 
 protected:
   void OnChannelConnected(int32_t pid) override;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -799,17 +799,17 @@ parent:
 
     async PPresentation();
 
     async PFlyWebPublishedServer(nsString name, FlyWebPublishOptions params);
 
     sync PURLClassifier(Principal principal, bool useTrackingProtection)
         returns (bool success);
     sync ClassifyLocal(URIParams uri, nsCString tables)
-        returns (nsCString[] results);
+        returns (nsresult rv, nsCString[] results);
 
     // Services remoting
 
     async StartVisitedQuery(URIParams uri);
     async VisitURI(URIParams uri, OptionalURIParams referrer, uint32_t flags);
     async SetURITitle(URIParams uri, nsString title);
 
     async LoadURIExternal(URIParams uri, PBrowser windowContext);
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1512,40 +1512,42 @@ nsUrlClassifierDBService::ClassifyLocalW
                                                   const nsACString& aTables,
                                                   nsTArray<nsCString>& aTableResults)
 {
   MOZ_ASSERT(NS_IsMainThread(), "ClassifyLocalWithTables must be on main thread");
   if (gShuttingDownThread) {
     return NS_ERROR_ABORT;
   }
 
+  nsresult rv;
   if (XRE_IsContentProcess()) {
     using namespace mozilla::dom;
     using namespace mozilla::ipc;
     URIParams uri;
     SerializeURI(aURI, uri);
     nsAutoCString tables(aTables);
     bool result = ContentChild::GetSingleton()->SendClassifyLocal(uri, tables,
+                                                                  &rv,
                                                                   &aTableResults);
     if (result) {
-      return NS_OK;
+      return rv;
     }
     return NS_ERROR_FAILURE;
   }
 
   PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
 
   nsCOMPtr<nsIURI> uri = NS_GetInnermostURI(aURI);
   NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
 
   nsAutoCString key;
   // Canonicalize the url
   nsCOMPtr<nsIUrlClassifierUtils> utilsService =
     do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
-  nsresult rv = utilsService->GetKeyForURI(uri, key);
+  rv = utilsService->GetKeyForURI(uri, key);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoPtr<LookupResultArray> results(new LookupResultArray());
   if (!results) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   // In unittests, we may not have been initalized, so don't crash.