Bug 669200 - nsPluginNativeWindow(Gtk/Win) support for content process plugins. Involves disabling some obsolete code and fixing helper calls like CallSetWindow, which no longer have access to native resources. r=blassey
This commit is contained in:
@@ -100,7 +100,13 @@ nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindo
|
|||||||
nsresult nsPluginNativeWindowGtk::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
nsresult nsPluginNativeWindowGtk::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||||
{
|
{
|
||||||
if (aPluginInstance) {
|
if (aPluginInstance) {
|
||||||
if (type == NPWindowTypeWindow) {
|
if (type == NPWindowTypeWindow &&
|
||||||
|
XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||||
|
// In this case, most of the initialization code here has already happened
|
||||||
|
// in the chrome process. The window we have in content is the XID of the
|
||||||
|
// socket widget we need to hand to plugins.
|
||||||
|
SetWindow((XID)window);
|
||||||
|
} else if (type == NPWindowTypeWindow) {
|
||||||
if (!mSocketWidget) {
|
if (!mSocketWidget) {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
@@ -165,9 +171,9 @@ nsresult nsPluginNativeWindowGtk::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
|
|||||||
#endif
|
#endif
|
||||||
} // NPWindowTypeWindow
|
} // NPWindowTypeWindow
|
||||||
aPluginInstance->SetWindow(this);
|
aPluginInstance->SetWindow(this);
|
||||||
}
|
} else if (mPluginInstance) {
|
||||||
else if (mPluginInstance)
|
|
||||||
mPluginInstance->SetWindow(nullptr);
|
mPluginInstance->SetWindow(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
SetPluginInstance(aPluginInstance);
|
SetPluginInstance(aPluginInstance);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|||||||
@@ -189,7 +189,14 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
|||||||
static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New plugin window procedure
|
* New plugin window procedure
|
||||||
|
*
|
||||||
|
* e10s note - this subclass, and the hooks we set below using WindowsDllInterceptor
|
||||||
|
* are currently not in use when running with e10s. (Utility calls like CallSetWindow
|
||||||
|
* are still in use in the content process.) We would like to keep things this away,
|
||||||
|
* essentially making all the hacks here obsolete. Some of the mitigation work here has
|
||||||
|
* already been supplanted by code in PluginInstanceChild. The rest we eventually want
|
||||||
|
* to rip out.
|
||||||
*/
|
*/
|
||||||
static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
@@ -601,6 +608,8 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
|
|||||||
// not interested in subclassing business any more, undo and don't subclass
|
// not interested in subclassing business any more, undo and don't subclass
|
||||||
if (!aPluginInstance) {
|
if (!aPluginInstance) {
|
||||||
UndoSubclassAndAssociateWindow();
|
UndoSubclassAndAssociateWindow();
|
||||||
|
// release plugin instance
|
||||||
|
SetPluginInstance(nullptr);
|
||||||
nsPluginNativeWindow::CallSetWindow(aPluginInstance);
|
nsPluginNativeWindow::CallSetWindow(aPluginInstance);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -621,6 +630,14 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// With e10s we execute in the content process and as such we don't
|
||||||
|
// have access to native widgets. CallSetWindow and skip native widget
|
||||||
|
// subclassing.
|
||||||
|
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||||
|
nsPluginNativeWindow::CallSetWindow(aPluginInstance);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
// grab the widget procedure before the plug-in does a subclass in
|
// grab the widget procedure before the plug-in does a subclass in
|
||||||
// setwindow. We'll use this in PluginWndProc for forwarding focus
|
// setwindow. We'll use this in PluginWndProc for forwarding focus
|
||||||
@@ -706,9 +723,6 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
|||||||
|
|
||||||
nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
||||||
{
|
{
|
||||||
// release plugin instance
|
|
||||||
SetPluginInstance(nullptr);
|
|
||||||
|
|
||||||
// remove window property
|
// remove window property
|
||||||
HWND hWnd = (HWND)window;
|
HWND hWnd = (HWND)window;
|
||||||
if (IsWindow(hWnd))
|
if (IsWindow(hWnd))
|
||||||
|
|||||||
Reference in New Issue
Block a user