Bug 561817 part C - restore the NestableTasksAllowed munging that was removed in patch B: I thought it was vestigial, but it's necessary, r=bent

This commit is contained in:
Benjamin Smedberg 2010-04-30 14:43:59 -04:00
Родитель 5e051c5e8c
Коммит b2d8204f7c
2 изменённых файлов: 25 добавлений и 6 удалений

Просмотреть файл

@ -1860,15 +1860,19 @@ PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier)
void
PluginModuleChild::EnteredCall()
{
mIncallPumpingStack.AppendElement(false);
mIncallPumpingStack.AppendElement();
}
void
PluginModuleChild::ExitedCall()
{
NS_ASSERTION(mIncallPumpingStack.Length(), "mismatched entered/exited");
PRUint32 len = mIncallPumpingStack.Length() - 1;
mIncallPumpingStack.TruncateLength(len);
PRUint32 len = mIncallPumpingStack.Length();
const IncallFrame& f = mIncallPumpingStack[len - 1];
if (f._spinning)
MessageLoop::current()->SetNestableTasksAllowed(f._savedNestableTasksAllowed);
mIncallPumpingStack.TruncateLength(len - 1);
}
LRESULT CALLBACK
@ -1876,9 +1880,13 @@ PluginModuleChild::NestedInputEventHook(int nCode, WPARAM wParam, LPARAM lParam)
{
PluginModuleChild* self = current();
PRUint32 len = self->mIncallPumpingStack.Length();
if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]) {
if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]._spinning) {
self->SendProcessNativeEventsInRPCCall();
self->mIncallPumpingStack[len - 1] = true;
IncallFrame& f = self->mIncallPumpingStack[len - 1];
f._spinning = true;
MessageLoop* loop = MessageLoop::current();
f._savedNestableTasksAllowed = loop->NestableTasksAllowed();
loop->SetNestableTasksAllowed(true);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);

Просмотреть файл

@ -307,7 +307,18 @@ private:
// Entered/ExitedCall notifications keep track of whether the plugin has
// entered a nested event loop within this RPC call.
nsAutoTArray<bool, 8> mIncallPumpingStack;
struct IncallFrame
{
IncallFrame()
: _spinning(false)
, _savedNestableTasksAllowed(false)
{ }
bool _spinning;
bool _savedNestableTasksAllowed;
};
nsAutoTArray<IncallFrame, 8> mIncallPumpingStack;
static LRESULT CALLBACK NestedInputEventHook(int code,
WPARAM wParam,