Commit d179d8a4 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 19273: Avoid JavaScript patching of the external app helper dialog.

When handling an external URI or downloading a file, invoke Torbutton's
external app blocker component (which will present a download warning
dialog unless the user has checked the "Automatically download files
from now on" box).

For e10s compatibility, avoid using a modal dialog and instead use
a callback interface (nsIHelperAppWarningLauncher) to allow Torbutton
to indicate the user's desire to cancel or continue each request.

Other bugs fixed:
 Bug 21766: Crash with e10s enabled while trying to download a file
 Bug 21886: Download is stalled in non-e10s mode
 Bug 22471: Downloading files via the PDF viewer download button is broken
 Bug 22472: Fix FTP downloads when external helper app dialog is shown
 Bug 22610: Avoid crashes when canceling external helper app downloads
 Bug 22618: Downloading pdf file via file:/// is stalling
parent e3b993bd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1233,6 +1233,13 @@ 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)
{
+1 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ 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;
+6 −0
Original line number Diff line number Diff line
@@ -81,6 +81,12 @@ 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)
{
+8 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ interface nsIHttpHeaderVisitor;
 * the inspection of the resulting HTTP response status and headers when they
 * become available.
 */
[builtinclass, scriptable, uuid(c5a4a073-4539-49c7-a3f2-cec3f0619c6c)]
[builtinclass, scriptable, uuid(e0d8071b-5389-48c2-92c7-6708c968044d)]
interface nsIHttpChannel : nsIChannel
{
    /**************************************************************************
@@ -469,4 +469,11 @@ 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();
};
+11 −0
Original line number Diff line number Diff line
@@ -739,6 +739,17 @@ 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)
{
Loading