Bug 551387 - octoshape plugin crashes because it doesn't implement NPNFunctions.setwindow, r=bent

This commit is contained in:
Benjamin Smedberg 2010-03-10 10:54:22 -05:00
Родитель 10f77c8a5c
Коммит d69028e672
4 изменённых файлов: 26 добавлений и 17 удалений

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

@ -67,8 +67,7 @@ rpc protocol PPluginInstance
child:
rpc __delete__();
rpc NPP_SetWindow(NPRemoteWindow window)
returns (NPError rv);
rpc NPP_SetWindow(NPRemoteWindow window);
// this message is not used on non-X platforms
rpc NPP_GetValue_NPPVpluginNeedsXEmbed()

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

@ -472,7 +472,10 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
return true;
#endif
*handled = mPluginIface->event(&mData, reinterpret_cast<void*>(&evcopy));
if (!mPluginIface->event)
*handled = false;
else
*handled = mPluginIface->event(&mData, reinterpret_cast<void*>(&evcopy));
#ifdef MOZ_X11
if (GraphicsExpose == event.event.type) {
@ -521,8 +524,7 @@ XVisualIDToInfo(Display* aDisplay, VisualID aVisualID,
#endif
bool
PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
NPError* rv)
PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
{
PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
FULLFUNCTION,
@ -561,7 +563,8 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
#endif
}
*rv = mPluginIface->setwindow(&mData, &mWindow);
if (mPluginIface->setwindow)
(void) mPluginIface->setwindow(&mData, &mWindow);
#elif defined(OS_WIN)
switch (aWindow.type) {
@ -580,8 +583,8 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
mWindow.height = aWindow.height;
mWindow.type = aWindow.type;
*rv = mPluginIface->setwindow(&mData, &mWindow);
if (*rv == NPERR_NO_ERROR) {
if (mPluginIface->setwindow) {
(void) mPluginIface->setwindow(&mData, &mWindow);
WNDPROC wndProc = reinterpret_cast<WNDPROC>(
GetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC));
if (wndProc != PluginWindowProc) {
@ -594,7 +597,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow,
break;
case NPWindowTypeDrawable:
return SharedSurfaceSetWindow(aWindow, rv);
return SharedSurfaceSetWindow(aWindow);
break;
default:
@ -964,6 +967,9 @@ IsMouseInputEvent(UINT msg)
int16_t
PluginInstanceChild::WinlessHandleEvent(NPEvent& event)
{
if (!mPluginIface->event)
return false;
// Winless Silverlight quirk: winposchanged events are not used in
// determining the position of the plugin within the parent window,
// NPP_SetWindow values are used instead. Due to shared memory dib
@ -1023,8 +1029,7 @@ PluginInstanceChild::WinlessHandleEvent(NPEvent& event)
/* windowless drawing helpers */
bool
PluginInstanceChild::SharedSurfaceSetWindow(const NPRemoteWindow& aWindow,
NPError* rv)
PluginInstanceChild::SharedSurfaceSetWindow(const NPRemoteWindow& aWindow)
{
// If the surfaceHandle is empty, parent is telling us we can reuse our cached
// memory surface and hdc. Otherwise, we need to reset, usually due to a
@ -1052,7 +1057,9 @@ PluginInstanceChild::SharedSurfaceSetWindow(const NPRemoteWindow& aWindow,
mWindow.type = aWindow.type;
mWindow.window = reinterpret_cast<void*>(mSharedSurfaceDib.GetHDC());
*rv = mPluginIface->setwindow(&mData, &mWindow);
if (mPluginIface->setwindow)
mPluginIface->setwindow(&mData, &mWindow);
return true;
}
@ -1127,6 +1134,9 @@ PluginInstanceChild::UpdatePaintClipRect(RECT* aRect)
int16_t
PluginInstanceChild::SharedSurfacePaint(NPEvent& evcopy)
{
if (!mPluginIface->event)
return false;
RECT* pRect = reinterpret_cast<RECT*>(evcopy.lParam);
switch(mAlphaExtract.doublePass) {

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

@ -73,7 +73,7 @@ class PluginInstanceChild : public PPluginInstanceChild
#endif
protected:
virtual bool AnswerNPP_SetWindow(const NPRemoteWindow& window, NPError* rv);
virtual bool AnswerNPP_SetWindow(const NPRemoteWindow& window);
virtual bool
AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(bool* needs, NPError* rv);
@ -273,7 +273,7 @@ private:
#if defined(OS_WIN)
private:
// Shared dib rendering management for windowless plugins.
bool SharedSurfaceSetWindow(const NPRemoteWindow& aWindow, NPError* rv);
bool SharedSurfaceSetWindow(const NPRemoteWindow& aWindow);
int16_t SharedSurfacePaint(NPEvent& evcopy);
void SharedSurfaceRelease();
bool AlphaExtractCacheSetup();

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

@ -430,10 +430,10 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
window.colormap = ws_info->colormap;
#endif
NPError prv;
if (!CallNPP_SetWindow(window, &prv))
if (!CallNPP_SetWindow(window))
return NPERR_GENERIC_ERROR;
return prv;
return NPERR_NO_ERROR;
}
NPError