Bug 1301056 - Fix auto-closing of windows when they divert to an external app. draft
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 08 Mar 2017 08:24:08 -0800
changeset 495345 99457e464c9c843ab85eb582e4fe6fdb4f5b0fcb
parent 494872 58753259bfeb3b818eac7870871b0aae1f8de64a
child 548338 eb517406adc8d92c84bd7cf7cc4df68bb7c829c1
push id48289
push userbmo:mrbkap@mozilla.com
push dateWed, 08 Mar 2017 16:30:01 +0000
bugs1301056
milestone55.0a1
Bug 1301056 - Fix auto-closing of windows when they divert to an external app. It appears that we always meant to call nsExternalHelperAppService::OnStartRequest even before we diverted (there's a check for XRE_IsChildProcess in there) but forgot to. With this patch, we call nsExternalHelperAppService::MaybeCloseWindow in the child and restore the old behavior. MozReview-Commit-ID: JedU3E0Eu26
uriloader/exthandler/ExternalHelperAppChild.cpp
--- a/uriloader/exthandler/ExternalHelperAppChild.cpp
+++ b/uriloader/exthandler/ExternalHelperAppChild.cpp
@@ -55,24 +55,24 @@ ExternalHelperAppChild::OnDataAvailable(
 
 //////////////////////////////////////////////////////////////////////////////
 // nsIRequestObserver
 //////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 ExternalHelperAppChild::OnStartRequest(nsIRequest *request, nsISupports *ctx)
 {
+  nsresult rv = mHandler->OnStartRequest(request, ctx);
+  NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
+
   nsCOMPtr<nsIDivertableChannel> divertable = do_QueryInterface(request);
   if (divertable) {
     return DivertToParent(divertable, request);
   }
 
-  nsresult rv = mHandler->OnStartRequest(request, ctx);
-  NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
-
   nsCString entityID;
   nsCOMPtr<nsIResumableChannel> resumable(do_QueryInterface(request));
   if (resumable) {
     resumable->GetEntityID(entityID);
   }
   SendOnStartRequest(entityID);
   return NS_OK;
 }