Backed out changeset f073181a927d (bug 1189195) for browser_privatebrowsing_geoprompt.js leaks CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 05 Nov 2015 18:06:21 -0800
changeset 293113 c61d84e232a5c1754cd6eab4f789e65bef155808
parent 293112 8a440af6cb512a36ad2fab747150d2433404fadf
child 293114 41b8e8a6bd69c3038da6547e220e640ad966f159
push id8824
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:18:56 +0000
treeherdermozilla-aurora@e2031358e2a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1189195
milestone45.0a1
backs outf073181a927d63ae7abac86e47cc3872ccac7275
Backed out changeset f073181a927d (bug 1189195) for browser_privatebrowsing_geoprompt.js leaks CLOSED TREE
dom/base/nsContentPermissionHelper.cpp
dom/base/nsContentPermissionHelper.h
dom/ipc/ContentParent.cpp
dom/ipc/PContentPermissionRequest.ipdl
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -122,17 +122,16 @@ class ContentPermissionRequestParent : p
   nsCOMPtr<nsIPrincipal> mPrincipal;
   nsCOMPtr<Element> mElement;
   RefPtr<nsContentPermissionRequestProxy> mProxy;
   nsTArray<PermissionRequest> mRequests;
 
  private:
   virtual bool Recvprompt();
   virtual bool RecvNotifyVisibility(const bool& aIsVisible);
-  virtual bool RecvDestroy();
   virtual void ActorDestroy(ActorDestroyReason why);
 };
 
 ContentPermissionRequestParent::ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
                                                                Element* aElement,
                                                                const IPC::Principal& aPrincipal)
 {
   MOZ_COUNT_CTOR(ContentPermissionRequestParent);
@@ -163,23 +162,16 @@ ContentPermissionRequestParent::RecvNoti
 {
   if (!mProxy) {
     return false;
   }
   mProxy->NotifyVisibility(aIsVisible);
   return true;
 }
 
-bool
-ContentPermissionRequestParent::RecvDestroy()
-{
-  Unused << PContentPermissionRequestParent::Send__delete__(this);
-  return true;
-}
-
 void
 ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
 {
   if (mProxy) {
     mProxy->OnParentDestroyed();
   }
 }
 
@@ -612,17 +604,17 @@ nsContentPermissionRequestProxy::Cancel(
   // Don't send out the delete message when the managing protocol (PBrowser) is
   // being destroyed and PContentPermissionRequest will soon be.
   if (mParent->IsBeingDestroyed()) {
     return NS_ERROR_FAILURE;
   }
 
   nsTArray<PermissionChoice> emptyChoices;
 
-  Unused << mParent->SendNotifyResult(false, emptyChoices);
+  Unused << ContentPermissionRequestParent::Send__delete__(mParent, false, emptyChoices);
   mParent = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
 {
   if (mParent == nullptr) {
@@ -681,17 +673,17 @@ nsContentPermissionRequestProxy::Allow(J
         choices.AppendElement(PermissionChoice(type, choice));
       }
     }
   } else {
     MOZ_ASSERT(false, "SelectedChoices should be undefined or an JS object");
     return NS_ERROR_FAILURE;
   }
 
-  Unused << mParent->SendNotifyResult(true, choices);
+  Unused << ContentPermissionRequestParent::Send__delete__(mParent, true, choices);
   mParent = nullptr;
   return NS_OK;
 }
 
 void
 nsContentPermissionRequestProxy::NotifyVisibility(const bool& aIsVisible)
 {
   MOZ_ASSERT(mRequester);
@@ -735,20 +727,19 @@ void
 RemotePermissionRequest::DoAllow(JS::HandleValue aChoices)
 {
   NS_ASSERTION(mRequest, "We need a request");
   mRequest->Allow(aChoices);
 }
 
 // PContentPermissionRequestChild
 bool
-RemotePermissionRequest::RecvNotifyResult(const bool& aAllow,
-                                          InfallibleTArray<PermissionChoice>&& aChoices)
+RemotePermissionRequest::Recv__delete__(const bool& aAllow,
+                                        InfallibleTArray<PermissionChoice>&& aChoices)
 {
-  Unused << this->SendDestroy();
   mListener->RemoveListener();
   mListener = nullptr;
 
   if (aAllow && mWindow->IsCurrentInnerWindow()) {
     // Use 'undefined' if no choice is provided.
     if (aChoices.IsEmpty()) {
       DoAllow(JS::UndefinedHandleValue);
       return true;
--- a/dom/base/nsContentPermissionHelper.h
+++ b/dom/base/nsContentPermissionHelper.h
@@ -183,18 +183,18 @@ class RemotePermissionRequest final : pu
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTENTPERMISSIONREQUESTCALLBACK
 
   RemotePermissionRequest(nsIContentPermissionRequest* aRequest,
                           nsPIDOMWindow* aWindow);
 
   // It will be called when prompt dismissed.
-  virtual bool RecvNotifyResult(const bool &aAllow,
-                                InfallibleTArray<PermissionChoice>&& aChoices) override;
+  virtual bool Recv__delete__(const bool &aAllow,
+                              InfallibleTArray<PermissionChoice>&& aChoices) override;
 
   virtual bool RecvGetVisibility() override;
 
   void IPDLAddRef()
   {
     mIPCOpen = true;
     AddRef();
   }
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2241,17 +2241,19 @@ ContentParent::NotifyTabDestroyed(const 
     }
 
     nsTArray<PContentPermissionRequestParent*> parentArray =
         nsContentPermissionUtils::GetContentPermissionRequestParentById(aTabId);
 
     // Need to close undeleted ContentPermissionRequestParents before tab is closed.
     for (auto& permissionRequestParent : parentArray) {
         nsTArray<PermissionChoice> emptyChoices;
-        Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent);
+        Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent,
+                                                                  false,
+                                                                  emptyChoices);
     }
 
     // There can be more than one PBrowser for a given app process
     // because of popup windows.  When the last one closes, shut
     // us down.
     ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
     nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(this->ChildID());
     if (tabIds.Length() == 1) {
--- a/dom/ipc/PContentPermissionRequest.ipdl
+++ b/dom/ipc/PContentPermissionRequest.ipdl
@@ -10,19 +10,17 @@ namespace dom {
 
 protocol PContentPermissionRequest
 {
   manager PContent;
 
 parent:
   prompt();
   NotifyVisibility(bool visibility);
-  Destroy();
 
 child:
   GetVisibility();
-  NotifyResult(bool allow, PermissionChoice[] choices);
-  __delete__();
+  __delete__(bool allow, PermissionChoice[] choices);
 };
 
 
 } // namespace dom
 } // namespace mozilla