зеркало из https://github.com/mozilla/gecko-dev.git
Fix for sending the correct URL from GetURLNotify/PostURLNotify to URLNotify and fixing a crash with Flash 6 when URLNotify is called before NewStream. Bug 131626 r=av sr=beard
This commit is contained in:
Родитель
d5348d8c99
Коммит
567a00a9a8
|
@ -770,7 +770,7 @@ NPError MakeNew4xStreamInternal (NPP npp,
|
||||||
|
|
||||||
nsIPluginStreamListener* listener = nsnull;
|
nsIPluginStreamListener* listener = nsnull;
|
||||||
if(target == nsnull)
|
if(target == nsnull)
|
||||||
((ns4xPluginInstance*)inst)->NewNotifyStream(&listener, notifyData, bDoNotify);
|
((ns4xPluginInstance*)inst)->NewNotifyStream(&listener, notifyData, bDoNotify, relativeURL);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case eNPPStreamTypeInternal_Get:
|
case eNPPStreamTypeInternal_Get:
|
||||||
|
|
|
@ -76,22 +76,27 @@ NS_IMPL_ISUPPORTS1(ns4xPluginStreamListener, nsIPluginStreamListener);
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ns4xPluginStreamListener::ns4xPluginStreamListener(nsIPluginInstance* inst,
|
ns4xPluginStreamListener::ns4xPluginStreamListener(nsIPluginInstance* inst,
|
||||||
void* notifyData)
|
void* notifyData,
|
||||||
|
const char* aURL)
|
||||||
: mNotifyData(notifyData),
|
: mNotifyData(notifyData),
|
||||||
|
mStreamBuffer(nsnull),
|
||||||
|
mNotifyURL(nsnull),
|
||||||
mStreamStarted(PR_FALSE),
|
mStreamStarted(PR_FALSE),
|
||||||
mStreamCleanedUp(PR_FALSE),
|
mStreamCleanedUp(PR_FALSE),
|
||||||
mStreamInfo(nsnull),
|
mCallNotify(PR_FALSE),
|
||||||
mCallNotify(PR_FALSE)
|
mStreamInfo(nsnull)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mInst = (ns4xPluginInstance*) inst;
|
mInst = (ns4xPluginInstance*) inst;
|
||||||
mStreamBuffer=nsnull;
|
|
||||||
mPosition = 0;
|
mPosition = 0;
|
||||||
mStreamBufferSize = 0;
|
mStreamBufferSize = 0;
|
||||||
// Initialize the 4.x interface structure
|
// Initialize the 4.x interface structure
|
||||||
memset(&mNPStream, 0, sizeof(mNPStream));
|
memset(&mNPStream, 0, sizeof(mNPStream));
|
||||||
|
|
||||||
NS_IF_ADDREF(mInst);
|
NS_IF_ADDREF(mInst);
|
||||||
|
|
||||||
|
if (aURL)
|
||||||
|
mNotifyURL = PL_strdup(aURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +135,9 @@ ns4xPluginStreamListener::~ns4xPluginStreamListener(void)
|
||||||
|
|
||||||
|
|
||||||
NS_IF_RELEASE(inst);
|
NS_IF_RELEASE(inst);
|
||||||
|
|
||||||
|
if (mNotifyURL)
|
||||||
|
PL_strfree(mNotifyURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -191,22 +199,21 @@ void ns4xPluginStreamListener::CallURLNotify(NPReason reason)
|
||||||
mInst->GetCallbacks(&callbacks);
|
mInst->GetCallbacks(&callbacks);
|
||||||
if(!callbacks)
|
if(!callbacks)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NPP npp;
|
|
||||||
mInst->GetNPP(&npp);
|
|
||||||
|
|
||||||
if (callbacks->urlnotify) {
|
if (callbacks->urlnotify) {
|
||||||
PRLibrary* lib = mInst->fLibrary;
|
|
||||||
|
NPP npp;
|
||||||
|
mInst->GetNPP(&npp);
|
||||||
|
|
||||||
NS_TRY_SAFE_CALL_VOID(CallNPP_URLNotifyProc(callbacks->urlnotify,
|
NS_TRY_SAFE_CALL_VOID(CallNPP_URLNotifyProc(callbacks->urlnotify,
|
||||||
npp,
|
npp,
|
||||||
mNPStream.url,
|
mNotifyURL,
|
||||||
reason,
|
reason,
|
||||||
mNotifyData), lib);
|
mNotifyData), mInst->fLibrary);
|
||||||
|
|
||||||
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||||
("NPP URLNotify called: this=%p, npp=%p, notify=%p, reason=%d, url=%s\n",
|
("NPP URLNotify called: this=%p, npp=%p, notify=%p, reason=%d, url=%s\n",
|
||||||
this, npp, mNotifyData, reason, mNPStream.url));
|
this, npp, mNotifyData, reason, mNotifyURL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's not leak this stream listener. Release the reference to the stream listener
|
// Let's not leak this stream listener. Release the reference to the stream listener
|
||||||
|
@ -981,7 +988,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window)
|
||||||
// Create a normal stream, one without a urlnotify callback
|
// Create a normal stream, one without a urlnotify callback
|
||||||
NS_IMETHODIMP ns4xPluginInstance::NewStream(nsIPluginStreamListener** listener)
|
NS_IMETHODIMP ns4xPluginInstance::NewStream(nsIPluginStreamListener** listener)
|
||||||
{
|
{
|
||||||
return NewNotifyStream(listener, nsnull, PR_FALSE);
|
return NewNotifyStream(listener, nsnull, PR_FALSE, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -989,9 +996,10 @@ NS_IMETHODIMP ns4xPluginInstance::NewStream(nsIPluginStreamListener** listener)
|
||||||
// Create a stream that will notify when complete
|
// Create a stream that will notify when complete
|
||||||
nsresult ns4xPluginInstance::NewNotifyStream(nsIPluginStreamListener** listener,
|
nsresult ns4xPluginInstance::NewNotifyStream(nsIPluginStreamListener** listener,
|
||||||
void* notifyData,
|
void* notifyData,
|
||||||
PRBool aCallNotify)
|
PRBool aCallNotify,
|
||||||
|
const char* aURL)
|
||||||
{
|
{
|
||||||
ns4xPluginStreamListener* stream = new ns4xPluginStreamListener(this, notifyData);
|
ns4xPluginStreamListener* stream = new ns4xPluginStreamListener(this, notifyData, aURL);
|
||||||
NS_ENSURE_TRUE(stream, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(stream, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
// add it to the list
|
// add it to the list
|
||||||
|
|
|
@ -133,7 +133,10 @@ public:
|
||||||
|
|
||||||
nsresult SetTransparent(PRBool aTransparent);
|
nsresult SetTransparent(PRBool aTransparent);
|
||||||
|
|
||||||
nsresult NewNotifyStream(nsIPluginStreamListener** listener, void* notifyData, PRBool aCallNotify);
|
nsresult NewNotifyStream(nsIPluginStreamListener** listener,
|
||||||
|
void* notifyData,
|
||||||
|
PRBool aCallNotify,
|
||||||
|
const char * aURL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new 4.x plugin instance with the specified peer
|
* Construct a new 4.x plugin instance with the specified peer
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
NS_IMETHOD GetStreamType(nsPluginStreamType *result);
|
NS_IMETHOD GetStreamType(nsPluginStreamType *result);
|
||||||
|
|
||||||
// ns4xPluginStreamListener specific methods:
|
// ns4xPluginStreamListener specific methods:
|
||||||
ns4xPluginStreamListener(nsIPluginInstance* inst, void* notifyData);
|
ns4xPluginStreamListener(nsIPluginInstance* inst, void* notifyData, const char* aURL);
|
||||||
virtual ~ns4xPluginStreamListener();
|
virtual ~ns4xPluginStreamListener();
|
||||||
PRBool IsStarted();
|
PRBool IsStarted();
|
||||||
nsresult CleanUpStream(NPReason reason);
|
nsresult CleanUpStream(NPReason reason);
|
||||||
|
@ -66,14 +66,16 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void* mNotifyData;
|
void* mNotifyData;
|
||||||
char* mStreamBuffer;
|
char* mStreamBuffer;
|
||||||
|
char* mNotifyURL;
|
||||||
ns4xPluginInstance* mInst;
|
ns4xPluginInstance* mInst;
|
||||||
NPStream mNPStream;
|
NPStream mNPStream;
|
||||||
PRUint32 mPosition;
|
PRUint32 mPosition;
|
||||||
PRUint32 mStreamBufferSize;
|
PRUint32 mStreamBufferSize;
|
||||||
nsPluginStreamType mStreamType;
|
nsPluginStreamType mStreamType;
|
||||||
PRBool mStreamStarted;
|
PRPackedBool mStreamStarted;
|
||||||
PRBool mStreamCleanedUp;
|
PRPackedBool mStreamCleanedUp;
|
||||||
PRBool mCallNotify;
|
PRPackedBool mCallNotify;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsIPluginStreamInfo * mStreamInfo;
|
nsIPluginStreamInfo * mStreamInfo;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче