mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 19:38:13 +00:00
bug=36212
a=waterson,av r=av,waterson Here is what I believe to be the correct fix. This post correspondes to the fix, second iteration attachments. M modules/plugin/nglsrc/nsIPluginInstanceOwner.h M modules/plugin/nglsrc/nsPluginHostImpl.cpp M modules/plugin/nglsrc/nsPluginInstancePeer.cpp M modules/plugin/nglsrc/nsPluginViewer.cpp M layout/html/base/src/nsObjectFrame.cpp This checkin modifies nsIPluginInstanceOwner::GetURL to have a length parameter for the post data.
This commit is contained in:
parent
f62888744c
commit
6929c922f5
@ -46,6 +46,7 @@
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIEventListener.h"
|
||||
#include "nsIStringStream.h" // for NS_NewCharInputStream
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
@ -87,7 +88,8 @@ public:
|
||||
|
||||
NS_IMETHOD CreateWidget(void);
|
||||
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData);
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen);
|
||||
|
||||
NS_IMETHOD ShowStatus(const char *aStatusMsg);
|
||||
|
||||
@ -1661,7 +1663,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetInstance(nsIPluginInstance *&aInstance)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarget, void *aPostData)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarget, void *aPostData, PRUint32 aPostDataLen)
|
||||
{
|
||||
nsISupports *container;
|
||||
nsILinkHandler *lh;
|
||||
@ -1698,7 +1700,19 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
|
||||
if (NS_OK == rv) {
|
||||
nsIContent* content = nsnull;
|
||||
mOwner->GetContent(&content);
|
||||
rv = lh->OnLinkClick(content, eLinkVerb_Replace, fullurl.GetUnicode(), unitarget.GetUnicode(), nsnull);
|
||||
nsCOMPtr<nsISupports> result = nsnull;
|
||||
nsCOMPtr<nsIInputStream> postDataStream = nsnull;
|
||||
if (aPostData) {
|
||||
NS_NewByteInputStream(getter_AddRefs(result),
|
||||
(const char *) aPostData, aPostDataLen);
|
||||
if (result) {
|
||||
postDataStream = do_QueryInterface(result, &rv);
|
||||
}
|
||||
}
|
||||
rv = lh->OnLinkClick(content, eLinkVerb_Replace,
|
||||
fullurl.GetUnicode(),
|
||||
unitarget.GetUnicode(),
|
||||
postDataStream ? postDataStream : nsnull);
|
||||
NS_IF_RELEASE(content);
|
||||
}
|
||||
NS_RELEASE(lh);
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIEventListener.h"
|
||||
#include "nsIStringStream.h" // for NS_NewCharInputStream
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
@ -87,7 +88,8 @@ public:
|
||||
|
||||
NS_IMETHOD CreateWidget(void);
|
||||
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData);
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen);
|
||||
|
||||
NS_IMETHOD ShowStatus(const char *aStatusMsg);
|
||||
|
||||
@ -1661,7 +1663,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetInstance(nsIPluginInstance *&aInstance)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarget, void *aPostData)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarget, void *aPostData, PRUint32 aPostDataLen)
|
||||
{
|
||||
nsISupports *container;
|
||||
nsILinkHandler *lh;
|
||||
@ -1698,7 +1700,19 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
|
||||
if (NS_OK == rv) {
|
||||
nsIContent* content = nsnull;
|
||||
mOwner->GetContent(&content);
|
||||
rv = lh->OnLinkClick(content, eLinkVerb_Replace, fullurl.GetUnicode(), unitarget.GetUnicode(), nsnull);
|
||||
nsCOMPtr<nsISupports> result = nsnull;
|
||||
nsCOMPtr<nsIInputStream> postDataStream = nsnull;
|
||||
if (aPostData) {
|
||||
NS_NewByteInputStream(getter_AddRefs(result),
|
||||
(const char *) aPostData, aPostDataLen);
|
||||
if (result) {
|
||||
postDataStream = do_QueryInterface(result, &rv);
|
||||
}
|
||||
}
|
||||
rv = lh->OnLinkClick(content, eLinkVerb_Replace,
|
||||
fullurl.GetUnicode(),
|
||||
unitarget.GetUnicode(),
|
||||
postDataStream ? postDataStream : nsnull);
|
||||
NS_IF_RELEASE(content);
|
||||
}
|
||||
NS_RELEASE(lh);
|
||||
|
@ -81,7 +81,8 @@ public:
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData) = 0;
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen) = 0;
|
||||
|
||||
/**
|
||||
* Show a status message in the host environment.
|
||||
|
@ -1484,7 +1484,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, nsnull);
|
||||
rv = owner->GetURL(url, target, nsnull, 0);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
@ -1516,19 +1516,17 @@ NS_IMETHODIMP nsPluginHostImpl::PostURL(nsISupports* pluginInst,
|
||||
nsAutoString string; string.AssignWithConversion(url);
|
||||
nsIPluginInstance *instance;
|
||||
nsresult rv;
|
||||
|
||||
|
||||
// we can only send a stream back to the plugin (as specified
|
||||
// by a null target) if we also have a nsIPluginStreamListener
|
||||
// to talk to also
|
||||
if(target == nsnull && streamListener == nsnull)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
|
||||
rv = pluginInst->QueryInterface(kIPluginInstanceIID, (void **)&instance);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (nsnull != target)
|
||||
{
|
||||
nsPluginInstancePeerImpl *peer;
|
||||
|
||||
rv = instance->GetPeer(NS_REINTERPRET_CAST(nsIPluginInstancePeer **, &peer));
|
||||
@ -1540,20 +1538,23 @@ NS_IMETHODIMP nsPluginHostImpl::PostURL(nsISupports* pluginInst,
|
||||
rv = peer->GetOwner(*getter_AddRefs(owner));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if ((0 == PL_strcmp(target, "newwindow")) ||
|
||||
(0 == PL_strcmp(target, "_new")))
|
||||
target = "_blank";
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, (void*)postData);
|
||||
}
|
||||
|
||||
{
|
||||
if (!target) {
|
||||
target = "_self";
|
||||
}
|
||||
else {
|
||||
if ((0 == PL_strcmp(target, "newwindow")) ||
|
||||
(0 == PL_strcmp(target, "_new")))
|
||||
target = "_blank";
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
}
|
||||
rv = owner->GetURL(url, target, (void*)postData, postDataLen);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (streamListener != nsnull)
|
||||
rv = NewPluginURLStream(string, instance, streamListener);
|
||||
|
||||
|
@ -270,7 +270,7 @@ nsPluginStreamToFile::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteC
|
||||
PRUint32 actualCount;
|
||||
mFileThing->Write(aBuf, aCount, &actualCount);
|
||||
mFileThing->Close();
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull);
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -320,7 +320,7 @@ nsPluginStreamToFile::SetObserver(nsIOutputStreamObserver * aObserver)
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::Close(void)
|
||||
{
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull);
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ public:
|
||||
|
||||
NS_IMETHOD CreateWidget(void);
|
||||
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData);
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen);
|
||||
|
||||
NS_IMETHOD ShowStatus(const char *aStatusMsg);
|
||||
|
||||
@ -815,7 +816,7 @@ NS_IMETHODIMP pluginInstanceOwner :: CreateWidget(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarget, void *aPostData)
|
||||
NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarget, void *aPostData, PRUint32 aPostDataLen)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -81,7 +81,8 @@ public:
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData) = 0;
|
||||
GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen) = 0;
|
||||
|
||||
/**
|
||||
* Show a status message in the host environment.
|
||||
|
@ -1484,7 +1484,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetURL(nsISupports* pluginInst,
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, nsnull);
|
||||
rv = owner->GetURL(url, target, nsnull, 0);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
@ -1516,19 +1516,17 @@ NS_IMETHODIMP nsPluginHostImpl::PostURL(nsISupports* pluginInst,
|
||||
nsAutoString string; string.AssignWithConversion(url);
|
||||
nsIPluginInstance *instance;
|
||||
nsresult rv;
|
||||
|
||||
|
||||
// we can only send a stream back to the plugin (as specified
|
||||
// by a null target) if we also have a nsIPluginStreamListener
|
||||
// to talk to also
|
||||
if(target == nsnull && streamListener == nsnull)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
|
||||
rv = pluginInst->QueryInterface(kIPluginInstanceIID, (void **)&instance);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (nsnull != target)
|
||||
{
|
||||
nsPluginInstancePeerImpl *peer;
|
||||
|
||||
rv = instance->GetPeer(NS_REINTERPRET_CAST(nsIPluginInstancePeer **, &peer));
|
||||
@ -1540,20 +1538,23 @@ NS_IMETHODIMP nsPluginHostImpl::PostURL(nsISupports* pluginInst,
|
||||
rv = peer->GetOwner(*getter_AddRefs(owner));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if ((0 == PL_strcmp(target, "newwindow")) ||
|
||||
(0 == PL_strcmp(target, "_new")))
|
||||
target = "_blank";
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
|
||||
rv = owner->GetURL(url, target, (void*)postData);
|
||||
}
|
||||
|
||||
{
|
||||
if (!target) {
|
||||
target = "_self";
|
||||
}
|
||||
else {
|
||||
if ((0 == PL_strcmp(target, "newwindow")) ||
|
||||
(0 == PL_strcmp(target, "_new")))
|
||||
target = "_blank";
|
||||
else if (0 == PL_strcmp(target, "_current"))
|
||||
target = "_self";
|
||||
}
|
||||
rv = owner->GetURL(url, target, (void*)postData, postDataLen);
|
||||
}
|
||||
|
||||
NS_RELEASE(peer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (streamListener != nsnull)
|
||||
rv = NewPluginURLStream(string, instance, streamListener);
|
||||
|
||||
|
@ -270,7 +270,7 @@ nsPluginStreamToFile::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteC
|
||||
PRUint32 actualCount;
|
||||
mFileThing->Write(aBuf, aCount, &actualCount);
|
||||
mFileThing->Close();
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull);
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -320,7 +320,7 @@ nsPluginStreamToFile::SetObserver(nsIOutputStreamObserver * aObserver)
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamToFile::Close(void)
|
||||
{
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull);
|
||||
mOwner->GetURL(mFileURL.GetAsString(), mTarget, nsnull, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ public:
|
||||
|
||||
NS_IMETHOD CreateWidget(void);
|
||||
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData);
|
||||
NS_IMETHOD GetURL(const char *aURL, const char *aTarget, void *aPostData,
|
||||
PRUint32 aPostDataLen);
|
||||
|
||||
NS_IMETHOD ShowStatus(const char *aStatusMsg);
|
||||
|
||||
@ -815,7 +816,7 @@ NS_IMETHODIMP pluginInstanceOwner :: CreateWidget(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarget, void *aPostData)
|
||||
NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarget, void *aPostData, PRUint32 aPostDataLen)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user