Bug 549888: Have the browser win NPP_SetWindow races, and add a special-cased NPP_HandleEvent async WindowPosChanged message for windows. r=jimm,karlt

This commit is contained in:
Chris Jones 2010-03-22 17:35:15 -05:00
parent 530fc5d2c4
commit 44e86067dc
5 changed files with 39 additions and 4 deletions

View File

@ -79,9 +79,11 @@ child:
rpc NPP_HandleEvent(NPRemoteEvent event)
returns (int16_t handled);
// special case of HandleEvent to make mediating races simpler
// special cases of HandleEvent to make mediating races simpler
rpc Paint(NPRemoteEvent event)
returns (int16_t handled);
// this is only used on windows to forward WM_WINDOWPOSCHANGE
async WindowPosChanged(NPRemoteEvent event);
rpc NPP_Destroy()
returns (NPError rv);

View File

@ -499,6 +499,19 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
return true;
}
bool
PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
{
#ifdef OS_WIN
int16_t dontcare;
return AnswerNPP_HandleEvent(event, &dontcare);
#else
NS_RUNTIMEABORT("WindowPosChanged is a windows-only message");
return false;
#endif
}
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
static bool
XVisualIDToInfo(Display* aDisplay, VisualID aVisualID,

View File

@ -96,6 +96,10 @@ protected:
return AnswerNPP_HandleEvent(event, handled);
}
NS_OVERRIDE
virtual bool
RecvWindowPosChanged(const NPRemoteEvent& event);
virtual bool
AnswerNPP_Destroy(NPError* result);

View File

@ -566,6 +566,16 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
}
}
break;
case WM_WINDOWPOSCHANGED:
{
// We send this in nsObjectFrame just before painting
SendWindowPosChanged(npremoteevent);
// nsObjectFrame doesn't care whether we handle this
// or not, just returning 1 for good hygiene
return 1;
}
break;
}
}
#endif

View File

@ -82,10 +82,16 @@ RPCChannel::RacyRPCPolicy
MediateRace(const RPCChannel::Message& parent,
const RPCChannel::Message& child)
{
// our code relies on the frame list not changing during paints
bool isPaint = (PPluginInstance::Msg_Paint__ID == parent.type());
switch (parent.type()) {
case PPluginInstance::Msg_Paint__ID:
case PPluginInstance::Msg_NPP_SetWindow__ID:
// our code relies on the frame list not changing during paints and
// reflows
return RPCChannel::RRPParentWins;
return isPaint ? RPCChannel::RRPParentWins : RPCChannel::RRPChildWins;
default:
return RPCChannel::RRPChildWins;
}
}
PRLogModuleInfo* gPluginLog = PR_NewLogModule("IPCPlugins");