Bug 1092121 - Get plugin quirks modes and nsPluginInstanceOwner::GetNetscapeWindow working with remote content. r=billm

This commit is contained in:
Jim Mathies
2015-01-23 04:10:52 -06:00
parent 0d79f46581
commit 3580fbc187
4 changed files with 22 additions and 12 deletions

View File

@@ -115,6 +115,12 @@ parent:
*/ */
sync PPluginWidget(); sync PPluginWidget();
/**
* Return native data of root widget
*/
sync GetWidgetNativeData() returns (WindowsHandle value);
parent:
/** /**
* When child sends this message, parent should move focus to * When child sends this message, parent should move focus to
* the next or previous focusable element. * the next or previous focusable element.
@@ -302,11 +308,6 @@ parent:
*/ */
sync GetDefaultScale() returns (double value); sync GetDefaultScale() returns (double value);
/**
* Return native data of root widget
*/
sync GetWidgetNativeData() returns (WindowsHandle value);
/** /**
* Set the native cursor. * Set the native cursor.
* @param value * @param value

View File

@@ -662,7 +662,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
nsViewManager* vm = mPluginFrame->PresContext()->GetPresShell()->GetViewManager(); nsViewManager* vm = mPluginFrame->PresContext()->GetPresShell()->GetViewManager();
if (!vm) if (!vm)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#if defined(XP_WIN)
// This property is provided to allow a "windowless" plugin to determine the window it is drawing // This property is provided to allow a "windowless" plugin to determine the window it is drawing
// in, so it can translate mouse coordinates it receives directly from the operating system // in, so it can translate mouse coordinates it receives directly from the operating system
// to coordinates relative to itself. // to coordinates relative to itself.
@@ -681,7 +680,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
// we only attempt to get the nearest window if this really is a "windowless" plugin so as not // we only attempt to get the nearest window if this really is a "windowless" plugin so as not
// to change any behaviour for the much more common windowed plugins, // to change any behaviour for the much more common windowed plugins,
// though why this method would even be being called for a windowed plugin escapes me. // though why this method would even be being called for a windowed plugin escapes me.
if (mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) { if (XRE_GetProcessType() != GeckoProcessType_Content &&
mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) {
// it turns out that flash also uses this window for determining focus, and is currently // it turns out that flash also uses this window for determining focus, and is currently
// unable to show a caret correctly if we return the enclosing window. Therefore for // unable to show a caret correctly if we return the enclosing window. Therefore for
// now we only return the enclosing window when there is an actual offset which // now we only return the enclosing window when there is an actual offset which
@@ -706,12 +706,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
} }
} }
} }
#endif
// simply return the topmost document window // simply return the topmost document window
nsCOMPtr<nsIWidget> widget; nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget)); vm->GetRootWidget(getter_AddRefs(widget));
if (widget) { if (widget) {
*pvalue = (void*)widget->GetNativeData(NS_NATIVE_WINDOW); *pvalue = (void*)widget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW);
} else { } else {
NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle"); NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle");
} }

View File

@@ -65,6 +65,7 @@ const wchar_t * kMozillaWindowClass = L"MozillaWindowClass";
#endif #endif
namespace { namespace {
// see PluginModuleChild::GetChrome()
PluginModuleChild* gChromeInstance = nullptr; PluginModuleChild* gChromeInstance = nullptr;
nsTArray<PluginModuleChild*>* gAllInstances; nsTArray<PluginModuleChild*>* gAllInstances;
} }
@@ -191,6 +192,9 @@ PluginModuleChild::~PluginModuleChild()
PluginModuleChild* PluginModuleChild*
PluginModuleChild::GetChrome() PluginModuleChild::GetChrome()
{ {
// A special PluginModuleChild instance that talks to the chrome process
// during startup and shutdown. Synchronous messages to or from this actor
// should be avoided because they may lead to hangs.
MOZ_ASSERT(gChromeInstance); MOZ_ASSERT(gChromeInstance);
return gChromeInstance; return gChromeInstance;
} }
@@ -230,7 +234,6 @@ PluginModuleChild::InitForContent(base::ProcessHandle aParentProcessHandle,
mTransport = aChannel; mTransport = aChannel;
mLibrary = GetChrome()->mLibrary; mLibrary = GetChrome()->mLibrary;
mQuirks = GetChrome()->mQuirks;
mFunctions = GetChrome()->mFunctions; mFunctions = GetChrome()->mFunctions;
return true; return true;
@@ -2062,7 +2065,13 @@ PluginModuleChild::AllocPPluginInstanceChild(const nsCString& aMimeType,
PLUGIN_LOG_DEBUG_METHOD; PLUGIN_LOG_DEBUG_METHOD;
AssertPluginThread(); AssertPluginThread();
InitQuirksModes(aMimeType); // In e10s, gChromeInstance hands out quirks to instances, but never
// allocates an instance on its own. Make sure it gets the latest copy
// of quirks once we have them. Also note, with process-per-tab, we may
// have multiple PluginModuleChilds in the same plugin process, so only
// initialize this once in gChromeInstance, which is a singleton.
GetChrome()->InitQuirksModes(aMimeType);
mQuirks = GetChrome()->mQuirks;
#ifdef XP_WIN #ifdef XP_WIN
if ((mQuirks & QUIRK_FLASH_HOOK_GETWINDOWINFO) && if ((mQuirks & QUIRK_FLASH_HOOK_GETWINDOWINFO) &&

View File

@@ -2922,8 +2922,9 @@ void* nsWindow::GetNativeData(uint32_t aDataType)
case NS_NATIVE_PLUGIN_PORT: case NS_NATIVE_PLUGIN_PORT:
case NS_NATIVE_WIDGET: case NS_NATIVE_WIDGET:
case NS_NATIVE_WINDOW: case NS_NATIVE_WINDOW:
case NS_NATIVE_SHAREABLE_WINDOW:
return (void*)mWnd; return (void*)mWnd;
case NS_NATIVE_SHAREABLE_WINDOW:
return (void*) WinUtils::GetTopLevelHWND(mWnd);
case NS_NATIVE_GRAPHIC: case NS_NATIVE_GRAPHIC:
// XXX: This is sleezy!! Remember to Release the DC after using it! // XXX: This is sleezy!! Remember to Release the DC after using it!
#ifdef MOZ_XUL #ifdef MOZ_XUL