зеркало из https://github.com/mozilla/gecko-dev.git
Bug 536437 - work around a bug in the Mozilla plugin host where NPN_GetURLNotify can return an error and also call NPP_URLNotify, r=cjones
--HG-- extra : transplant_source : %07%7B%DBO%AF%069%16%F5%FF%1A%C5%F5Wi%E1%9D%E1%E6%83
This commit is contained in:
Родитель
f08afe579d
Коммит
04d26699a0
|
@ -270,6 +270,10 @@ PluginInstanceParent::AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
|
|||
const bool& file,
|
||||
NPError* result)
|
||||
{
|
||||
bool streamDestroyed = false;
|
||||
static_cast<StreamNotifyParent*>(actor)->
|
||||
SetDestructionFlag(&streamDestroyed);
|
||||
|
||||
if (!post) {
|
||||
*result = mNPNIface->geturlnotify(mNPP,
|
||||
NullableStringGet(url),
|
||||
|
@ -285,8 +289,11 @@ PluginInstanceParent::AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
|
|||
file, actor);
|
||||
}
|
||||
|
||||
if (*result != NPERR_NO_ERROR)
|
||||
PStreamNotifyParent::Call__delete__(actor, NPERR_GENERIC_ERROR);
|
||||
if (!streamDestroyed) {
|
||||
static_cast<StreamNotifyParent*>(actor)->ClearDestructionFlag();
|
||||
if (*result != NPERR_NO_ERROR)
|
||||
PStreamNotifyParent::Call__delete__(actor, NPERR_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,26 @@ class StreamNotifyParent : public PStreamNotifyParent
|
|||
{
|
||||
friend class PluginInstanceParent;
|
||||
|
||||
StreamNotifyParent() { }
|
||||
StreamNotifyParent()
|
||||
: mDestructionFlag(NULL)
|
||||
{ }
|
||||
~StreamNotifyParent() {
|
||||
if (mDestructionFlag)
|
||||
*mDestructionFlag = true;
|
||||
}
|
||||
|
||||
public:
|
||||
// If we are destroyed within the call to NPN_GetURLNotify, notify the caller
|
||||
// so that we aren't destroyed again. see bug 536437.
|
||||
void SetDestructionFlag(bool* flag) {
|
||||
mDestructionFlag = flag;
|
||||
}
|
||||
void ClearDestructionFlag() {
|
||||
mDestructionFlag = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
bool* mDestructionFlag;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
|
Загрузка…
Ссылка в новой задаче