From 60ce8c31864439c78a09e3d1fdb1f5f7aa93a240 Mon Sep 17 00:00:00 2001 From: Kathy Brade Date: Tue, 18 Jul 2017 16:22:32 -0400 Subject: [PATCH] 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 +-- .../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 30388765d6a08..f54bdb70fea90 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 3a1a8ba525b05..c8184a601b9e5 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 8b362cb24233e..8c048a6b5a7e5 100644 --- a/netwerk/protocol/http/NullHttpChannel.cpp +++ b/netwerk/protocol/http/NullHttpChannel.cpp @@ -81,12 +81,6 @@ NullHttpChannel::SetTopLevelContentWindowId(uint64_t aWindowId) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -NullHttpChannel::IsPendingUnforced(bool *_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP NullHttpChannel::GetTransferSize(uint64_t *aTransferSize) { diff --git a/netwerk/protocol/http/nsIHttpChannel.idl b/netwerk/protocol/http/nsIHttpChannel.idl index 0de0676ad156e..75ec2c73989ab 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 9f9b89438fbab..9ed71c4ef001c 100644 --- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp +++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp @@ -739,17 +739,6 @@ nsViewSourceChannel::SetTopLevelContentWindowId(uint64_t aWindowId) mHttpChannel->SetTopLevelContentWindowId(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) { diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 7d2dad321b6c1..1c0dd8ee66f73 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; @@ -439,22 +437,6 @@ static nsresult GetDownloadDirectory(nsIFile **_directory, return NS_OK; } -static nsresult shouldCancel(bool *aShouldCancel) -{ - NS_ENSURE_ARG_POINTER(aShouldCancel); - - nsCOMPtr cancelObj = - do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID); - cancelObj->SetData(false); - nsCOMPtr 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 @@ -1132,14 +1114,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 handler; rv = GetProtocolHandlerInfo(scheme, getter_AddRefs(handler)); NS_ENSURE_SUCCESS(rv, rv); @@ -1764,37 +1738,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 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; -- GitLab