[tor-commits] [tor-browser/tor-browser-52.2.0esr-7.5-1] Revert "Bug 19273: Avoid JavaScript patching of the external app helper dialog."

gk at torproject.org gk at torproject.org
Fri Aug 4 06:08:40 UTC 2017


commit 47df7aa33aa1ea4a72ac029169725609f2f518aa
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Jul 18 16:22:32 2017 -0400

    Revert "Bug 19273: Avoid JavaScript patching of the external app helper dialog."
    
    This reverts commit 648d842b127e6ca6457d43e45244c65ee1773aa3.
---
 netwerk/protocol/http/HttpBaseChannel.cpp          |  7 ---
 netwerk/protocol/http/HttpBaseChannel.h            |  1 -
 netwerk/protocol/http/NullHttpChannel.cpp          |  6 ---
 netwerk/protocol/http/nsIHttpChannel.idl           |  9 +---
 .../protocol/viewsource/nsViewSourceChannel.cpp    | 11 -----
 .../exthandler/nsExternalHelperAppService.cpp      | 57 ----------------------
 6 files changed, 1 insertion(+), 90 deletions(-)

diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
index 5ea6a002a40f..e0f7edec05f9 100644
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1233,13 +1233,6 @@ NS_IMETHODIMP HttpBaseChannel::SetTopLevelContentWindowId(uint64_t aWindowId)
   return NS_OK;
 }
 
-NS_IMETHODIMP HttpBaseChannel::IsPendingUnforced(bool *aIsPendingUnforced)
-{
-  NS_ENSURE_ARG_POINTER(aIsPendingUnforced);
-  *aIsPendingUnforced = mIsPending;
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 HttpBaseChannel::GetTransferSize(uint64_t *aTransferSize)
 {
diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h
index 3a1a8ba525b0..c8184a601b9e 100644
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -190,7 +190,6 @@ public:
   NS_IMETHOD SetChannelId(const nsACString& aChannelId) override;
   NS_IMETHOD GetTopLevelContentWindowId(uint64_t *aContentWindowId) override;
   NS_IMETHOD SetTopLevelContentWindowId(uint64_t aContentWindowId) override;
-  NS_IMETHOD IsPendingUnforced(bool *aIsPendingUnforced) override;
 
   // nsIHttpChannelInternal
   NS_IMETHOD GetDocumentURI(nsIURI **aDocumentURI) override;
diff --git a/netwerk/protocol/http/NullHttpChannel.cpp b/netwerk/protocol/http/NullHttpChannel.cpp
index 8b362cb24233..8c048a6b5a7e 100644
--- a/netwerk/protocol/http/NullHttpChannel.cpp
+++ b/netwerk/protocol/http/NullHttpChannel.cpp
@@ -82,12 +82,6 @@ NullHttpChannel::SetTopLevelContentWindowId(uint64_t aWindowId)
 }
 
 NS_IMETHODIMP
-NullHttpChannel::IsPendingUnforced(bool *_retval)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 NullHttpChannel::GetTransferSize(uint64_t *aTransferSize)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
diff --git a/netwerk/protocol/http/nsIHttpChannel.idl b/netwerk/protocol/http/nsIHttpChannel.idl
index 0de0676ad156..75ec2c73989a 100644
--- a/netwerk/protocol/http/nsIHttpChannel.idl
+++ b/netwerk/protocol/http/nsIHttpChannel.idl
@@ -14,7 +14,7 @@ interface nsIHttpHeaderVisitor;
  * the inspection of the resulting HTTP response status and headers when they
  * become available.
  */
-[builtinclass, scriptable, uuid(e0d8071b-5389-48c2-92c7-6708c968044d)]
+[builtinclass, scriptable, uuid(c5a4a073-4539-49c7-a3f2-cec3f0619c6c)]
 interface nsIHttpChannel : nsIChannel
 {
     /**************************************************************************
@@ -469,11 +469,4 @@ interface nsIHttpChannel : nsIChannel
      * this channels is being load in.
      */
     attribute uint64_t topLevelContentWindowId;
-
-    /**
-     * Returns true if a request is pending due to "natural" causes and
-     * not just because ForcePending() has been called. See isPending()
-     * in nsIRequest.idl for more details about pending requests.
-     */
-    boolean isPendingUnforced();
 };
diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
index 9f9b89438fba..9ed71c4ef001 100644
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -740,17 +740,6 @@ nsViewSourceChannel::SetTopLevelContentWindowId(uint64_t aWindowId)
 }
 
 NS_IMETHODIMP
-nsViewSourceChannel::IsPendingUnforced(bool *result)
-{
-  if (mHttpChannel) {
-    return mHttpChannel->IsPendingUnforced(result);
-  }
-
-  NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
-  return mChannel->IsPending(result);
-}
-
-NS_IMETHODIMP
 nsViewSourceChannel::GetRequestMethod(nsACString & aRequestMethod)
 {
     return !mHttpChannel ? NS_ERROR_NULL_POINTER :
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index 4a7fd7f92f15..51a7ee0f6ab6 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -41,7 +41,6 @@
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "nsIMutableArray.h"
-#include "nsISupportsPrimitives.h" // for nsISupportsPRBool
 
 // used to access our datastore of user-configured helper applications
 #include "nsIHandlerService.h"
@@ -106,7 +105,6 @@
 
 #include "mozilla/Preferences.h"
 #include "mozilla/ipc/URIUtils.h"
-#include "mozilla/Unused.h"
 
 using namespace mozilla;
 using namespace mozilla::ipc;
@@ -436,22 +434,6 @@ static nsresult GetDownloadDirectory(nsIFile **_directory,
   return NS_OK;
 }
 
-static nsresult shouldCancel(bool *aShouldCancel)
-{
-  NS_ENSURE_ARG_POINTER(aShouldCancel);
-
-  nsCOMPtr<nsISupportsPRBool> cancelObj =
-                            do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID);
-  cancelObj->SetData(false);
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (!obs)
-    return NS_ERROR_FAILURE;
-
-  obs->NotifyObservers(cancelObj, "external-app-requested", nullptr);
-  cancelObj->GetData(aShouldCancel);
-  return NS_OK;
-}
-
 /**
  * Structure for storing extension->type mappings.
  * @see defaultMimeEntries
@@ -1028,14 +1010,6 @@ nsExternalHelperAppService::LoadURI(nsIURI *aURI,
     return NS_OK; // explicitly denied
   }
 
-  // Give other modules, including extensions, a chance to cancel.
-  bool doCancel = false;
-  rv = shouldCancel(&doCancel);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (doCancel) {
-    return NS_OK;
-  }
-
   nsCOMPtr<nsIHandlerInfo> handler;
   rv = GetProtocolHandlerInfo(scheme, getter_AddRefs(handler));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1669,37 +1643,6 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
     return NS_OK;
   }
 
-  // Give other modules, including extensions, a chance to cancel.
-  // To avoid a problem where OnDataAvailable fires but is not handled
-  // correctly while a modal dialog displayed by Torbutton is open, we
-  // suspend and then we either cancel or resume active requests.
-  // See bugs 21766 and 21886.
-  bool isPending = false;
-  nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(request);
-  if (httpChan) {
-    rv = httpChan->IsPendingUnforced(&isPending);
-  } else {
-    rv = request->IsPending(&isPending);
-  }
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (isPending) {
-    Unused << request->Suspend(); // Best effort: ignore failures.
-  }
-
-  bool doCancel = false;
-  rv = shouldCancel(&doCancel);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (doCancel) {
-    mCanceled = true;
-    request->Cancel(NS_BINDING_ABORTED);
-    return NS_OK;
-  }
-
-  if (isPending) {
-    Unused << request->Resume();  // Best effort: ignore failures.
-  }
-
   rv = SetUpTempFile(aChannel);
   if (NS_FAILED(rv)) {
     nsresult transferError = rv;





More information about the tor-commits mailing list