Commit 9f908d79 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.

Before launching an external application, broadcast an
"external-app-requested" observer service notification to allow
other modules, including extensions, a chance to cancel the launch.
parent 197d9cad
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1232,6 +1232,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