зеркало из https://github.com/mozilla/gecko-dev.git
Bug 589025 - Support content-disposition attribute in e10s external app handling, r=dwitte, blocking-fennec2.0b1=blassey
Bug 589025 - Support content-disposition attribute in e10s external app handling, r=dwitte, blocking-fennec2.0b1=blassey
This commit is contained in:
Родитель
cbd5e1317d
Коммит
b1bd94e39a
|
@ -121,7 +121,9 @@ parent:
|
||||||
|
|
||||||
__delete__();
|
__delete__();
|
||||||
|
|
||||||
PExternalHelperApp(URI uri, nsCString aMimeContentType, bool aForceSave, PRInt64 aContentLength);
|
PExternalHelperApp(URI uri, nsCString aMimeContentType,
|
||||||
|
nsCString aContentDisposition, bool aForceSave,
|
||||||
|
PRInt64 aContentLength);
|
||||||
|
|
||||||
child:
|
child:
|
||||||
CreateWidget(MagicWindowHandle parentWidget);
|
CreateWidget(MagicWindowHandle parentWidget);
|
||||||
|
|
|
@ -1241,6 +1241,7 @@ TabChildGlobal::GetPrincipal()
|
||||||
PExternalHelperAppChild*
|
PExternalHelperAppChild*
|
||||||
TabChild::AllocPExternalHelperApp(const IPC::URI& uri,
|
TabChild::AllocPExternalHelperApp(const IPC::URI& uri,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const bool& aForceSave,
|
const bool& aForceSave,
|
||||||
const PRInt64& aContentLength)
|
const PRInt64& aContentLength)
|
||||||
{
|
{
|
||||||
|
|
|
@ -227,6 +227,7 @@ public:
|
||||||
virtual PExternalHelperAppChild *AllocPExternalHelperApp(
|
virtual PExternalHelperAppChild *AllocPExternalHelperApp(
|
||||||
const IPC::URI& uri,
|
const IPC::URI& uri,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const bool& aForceSave,
|
const bool& aForceSave,
|
||||||
const PRInt64& aContentLength);
|
const PRInt64& aContentLength);
|
||||||
virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
|
virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
|
||||||
|
|
|
@ -815,12 +815,13 @@ TabParent::GetFrameLoader() const
|
||||||
PExternalHelperAppParent*
|
PExternalHelperAppParent*
|
||||||
TabParent::AllocPExternalHelperApp(const IPC::URI& uri,
|
TabParent::AllocPExternalHelperApp(const IPC::URI& uri,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const bool& aForceSave,
|
const bool& aForceSave,
|
||||||
const PRInt64& aContentLength)
|
const PRInt64& aContentLength)
|
||||||
{
|
{
|
||||||
ExternalHelperAppParent *parent = new ExternalHelperAppParent(uri, aContentLength);
|
ExternalHelperAppParent *parent = new ExternalHelperAppParent(uri, aContentLength);
|
||||||
parent->AddRef();
|
parent->AddRef();
|
||||||
parent->Init(this, aMimeContentType, aForceSave);
|
parent->Init(this, aMimeContentType, aContentDisposition, aForceSave);
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
virtual PExternalHelperAppParent* AllocPExternalHelperApp(
|
virtual PExternalHelperAppParent* AllocPExternalHelperApp(
|
||||||
const IPC::URI& uri,
|
const IPC::URI& uri,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const bool& aForceSave,
|
const bool& aForceSave,
|
||||||
const PRInt64& aContentLength);
|
const PRInt64& aContentLength);
|
||||||
virtual bool DeallocPExternalHelperApp(PExternalHelperAppParent* aService);
|
virtual bool DeallocPExternalHelperApp(PExternalHelperAppParent* aService);
|
||||||
|
|
|
@ -50,10 +50,11 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED3(ExternalHelperAppParent,
|
NS_IMPL_ISUPPORTS_INHERITED4(ExternalHelperAppParent,
|
||||||
nsHashPropertyBag,
|
nsHashPropertyBag,
|
||||||
nsIRequest,
|
nsIRequest,
|
||||||
nsIChannel,
|
nsIChannel,
|
||||||
|
nsIMultiPartChannel,
|
||||||
nsIResumableChannel)
|
nsIResumableChannel)
|
||||||
|
|
||||||
ExternalHelperAppParent::ExternalHelperAppParent(
|
ExternalHelperAppParent::ExternalHelperAppParent(
|
||||||
|
@ -70,6 +71,7 @@ ExternalHelperAppParent::ExternalHelperAppParent(
|
||||||
void
|
void
|
||||||
ExternalHelperAppParent::Init(TabParent *parent,
|
ExternalHelperAppParent::Init(TabParent *parent,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const PRBool& aForceSave)
|
const PRBool& aForceSave)
|
||||||
{
|
{
|
||||||
nsHashPropertyBag::Init();
|
nsHashPropertyBag::Init();
|
||||||
|
@ -84,6 +86,7 @@ ExternalHelperAppParent::Init(TabParent *parent,
|
||||||
NS_ASSERTION(helperAppService, "No Helper App Service!");
|
NS_ASSERTION(helperAppService, "No Helper App Service!");
|
||||||
|
|
||||||
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, mContentLength);
|
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, mContentLength);
|
||||||
|
SetContentDisposition(aContentDisposition);
|
||||||
helperAppService->DoContent(aMimeContentType, this, ir,
|
helperAppService->DoContent(aMimeContentType, this, ir,
|
||||||
aForceSave, getter_AddRefs(mListener));
|
aForceSave, getter_AddRefs(mListener));
|
||||||
}
|
}
|
||||||
|
@ -331,5 +334,41 @@ ExternalHelperAppParent::GetEntityID(nsACString& aEntityID)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// nsIMultiPartChannel implementation
|
||||||
|
//
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ExternalHelperAppParent::GetBaseChannel(nsIChannel* *aChannel)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ExternalHelperAppParent::GetContentDisposition(nsACString& aContentDisposition)
|
||||||
|
{
|
||||||
|
aContentDisposition = mContentDisposition;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ExternalHelperAppParent::SetContentDisposition(const nsACString& aDisposition)
|
||||||
|
{
|
||||||
|
mContentDisposition = aDisposition;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ExternalHelperAppParent::GetPartID(PRUint32* aPartID)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ExternalHelperAppParent::GetIsLastPart(PRBool* aIsLastPart)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include "mozilla/dom/PExternalHelperAppParent.h"
|
#include "mozilla/dom/PExternalHelperAppParent.h"
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
#include "nsICancelable.h"
|
#include "nsIMultiPartChannel.h"
|
||||||
#include "nsIResumableChannel.h"
|
#include "nsIResumableChannel.h"
|
||||||
#include "nsHashPropertyBag.h"
|
#include "nsHashPropertyBag.h"
|
||||||
|
|
||||||
|
@ -54,12 +54,14 @@ class TabParent;
|
||||||
class ExternalHelperAppParent : public PExternalHelperAppParent
|
class ExternalHelperAppParent : public PExternalHelperAppParent
|
||||||
, public nsHashPropertyBag
|
, public nsHashPropertyBag
|
||||||
, public nsIChannel
|
, public nsIChannel
|
||||||
|
, public nsIMultiPartChannel
|
||||||
, public nsIResumableChannel
|
, public nsIResumableChannel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIREQUEST
|
NS_DECL_NSIREQUEST
|
||||||
NS_DECL_NSICHANNEL
|
NS_DECL_NSICHANNEL
|
||||||
|
NS_DECL_NSIMULTIPARTCHANNEL
|
||||||
NS_DECL_NSIRESUMABLECHANNEL
|
NS_DECL_NSIRESUMABLECHANNEL
|
||||||
|
|
||||||
bool RecvOnStartRequest(const nsCString& entityID);
|
bool RecvOnStartRequest(const nsCString& entityID);
|
||||||
|
@ -69,6 +71,7 @@ public:
|
||||||
ExternalHelperAppParent(const IPC::URI& uri, const PRInt64& contentLength);
|
ExternalHelperAppParent(const IPC::URI& uri, const PRInt64& contentLength);
|
||||||
void Init(TabParent *parent,
|
void Init(TabParent *parent,
|
||||||
const nsCString& aMimeContentType,
|
const nsCString& aMimeContentType,
|
||||||
|
const nsCString& aContentDisposition,
|
||||||
const PRBool& aForceSave);
|
const PRBool& aForceSave);
|
||||||
virtual ~ExternalHelperAppParent();
|
virtual ~ExternalHelperAppParent();
|
||||||
|
|
||||||
|
@ -79,6 +82,7 @@ private:
|
||||||
nsLoadFlags mLoadFlags;
|
nsLoadFlags mLoadFlags;
|
||||||
nsresult mStatus;
|
nsresult mStatus;
|
||||||
PRInt64 mContentLength;
|
PRInt64 mContentLength;
|
||||||
|
nsCString mContentDisposition;
|
||||||
nsCString mEntityID;
|
nsCString mEntityID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -699,6 +699,10 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||||
if (!tabchild)
|
if (!tabchild)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCString disp;
|
||||||
|
if (channel)
|
||||||
|
ExtractDisposition(channel, disp);
|
||||||
|
|
||||||
// Now we build a protocol for forwarding our data to the parent. The
|
// Now we build a protocol for forwarding our data to the parent. The
|
||||||
// protocol will act as a listener on the child-side and create a "real"
|
// protocol will act as a listener on the child-side and create a "real"
|
||||||
// helperAppService listener on the parent-side, via another call to
|
// helperAppService listener on the parent-side, via another call to
|
||||||
|
@ -709,6 +713,7 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||||
mozilla::dom::PExternalHelperAppChild *pc;
|
mozilla::dom::PExternalHelperAppChild *pc;
|
||||||
pc = child->SendPExternalHelperAppConstructor(IPC::URI(uri),
|
pc = child->SendPExternalHelperAppConstructor(IPC::URI(uri),
|
||||||
nsCString(aMimeContentType),
|
nsCString(aMimeContentType),
|
||||||
|
disp,
|
||||||
aForceSave, contentLength);
|
aForceSave, contentLength);
|
||||||
ExternalHelperAppChild *childListener = static_cast<ExternalHelperAppChild *>(pc);
|
ExternalHelperAppChild *childListener = static_cast<ExternalHelperAppChild *>(pc);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче