diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 71af5ae0c267..35d67db81379 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -197,7 +197,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface, #endif // OS_WIN #if defined(OS_WIN) InitPopupMenuHook(); - if (GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) { + if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) { SetUnityHooks(); } #endif // OS_WIN @@ -207,7 +207,7 @@ PluginInstanceChild::~PluginInstanceChild() { #if defined(OS_WIN) NS_ASSERTION(!mPluginWindowHWND, "Destroying PluginInstanceChild without NPP_Destroy?"); - if (GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) { + if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) { ClearUnityHooks(); } #endif @@ -405,7 +405,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar, } if (result == NPERR_NO_ERROR || (GetQuirks() & - PluginModuleChild::QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN)) { + QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN)) { *static_cast(aValue) = ToNewCString(v); } return result; @@ -1028,7 +1028,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, mCARenderer->SetupRenderer(caLayer, mWindow.width, mWindow.height, mContentsScaleFactor, - GetQuirks() & PluginModuleChild::QUIRK_ALLOW_OFFLINE_RENDERER ? + GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ? ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER); // Flash needs to have the window set again after this step @@ -1254,7 +1254,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) switch (aWindow.type) { case NPWindowTypeWindow: { - if ((GetQuirks() & PluginModuleChild::QUIRK_QUICKTIME_AVOID_SETWINDOW) && + if ((GetQuirks() & QUIRK_QUICKTIME_AVOID_SETWINDOW) && aWindow.width == 0 && aWindow.height == 0) { // Skip SetWindow call for hidden QuickTime plugins @@ -1298,9 +1298,9 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow) case NPWindowTypeDrawable: mWindow.type = aWindow.type; - if (GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) + if (GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) CreateWinlessPopupSurrogate(); - if (GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS) + if (GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS) SetupFlashMsgThrottle(); return SharedSurfaceSetWindow(aWindow); break; @@ -1554,7 +1554,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd, } if (message == WM_USER+1 && - (self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)) { + (self->GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)) { self->FlashThrottleMessage(hWnd, message, wParam, lParam, true); return 0; } @@ -1571,7 +1571,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd, // caused by a bug in flash, since we are not setting the capture // on the window. if (message == WM_LBUTTONDOWN && - self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) { + self->GetQuirks() & QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) { wchar_t szClass[26]; HWND hwnd = GetForegroundWindow(); if (hwnd && GetClassNameW(hwnd, szClass, @@ -1732,7 +1732,7 @@ PluginInstanceChild::SetWindowLongWHook(HWND hWnd, void PluginInstanceChild::HookSetWindowLongPtr() { - if (!(GetQuirks() & PluginModuleChild::QUIRK_FLASH_HOOK_SETLONGPTR)) + if (!(GetQuirks() & QUIRK_FLASH_HOOK_SETLONGPTR)) return; sUser32Intercept.Init("user32.dll"); @@ -1819,7 +1819,7 @@ PluginInstanceChild::SetCaptureHook(HWND aHwnd) void PluginInstanceChild::SetUnityHooks() { - if (!(GetQuirks() & PluginModuleChild::QUIRK_UNITY_FIXUP_MOUSE_CAPTURE)) { + if (!(GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE)) { return; } @@ -1946,7 +1946,7 @@ PluginInstanceChild::TrackPopupHookProc(HMENU hMenu, void PluginInstanceChild::InitPopupMenuHook() { - if (!(GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) || + if (!(GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) || sUser32TrackPopupMenuStub) return; @@ -2008,7 +2008,7 @@ PluginInstanceChild::WinlessHandleEvent(NPEvent& event) // TrackPopupMenu will fail if the parent window is not associated with // our ui thread. So we hook TrackPopupMenu so we can hand in a surrogate // parent created in the child process. - if ((GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) && // XXX turn on by default? + if ((GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) && // XXX turn on by default? (event.event == WM_RBUTTONDOWN || // flash event.event == WM_RBUTTONUP)) { // silverlight sWinlessPopupSurrogateHWND = mWinlessPopupSurrogateHWND; @@ -2400,7 +2400,7 @@ PluginInstanceChild::AnswerSetPluginFocus() // this in response to a WM_SETFOCUS event on our parent, the parent // should have focus when we receive this. If not, ignore the call. if (::GetFocus() == mPluginWindowHWND || - ((GetQuirks() & PluginModuleChild::QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) && + ((GetQuirks() & QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) && (::GetFocus() != mPluginParentHWND))) return true; ::SetFocus(mPluginWindowHWND); @@ -2825,7 +2825,7 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, mContentsScaleFactor = aWindow.contentsScaleFactor; #endif - if (GetQuirks() & PluginModuleChild::QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT) + if (GetQuirks() & QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT) mIsTransparent = true; mLayersRendering = true; @@ -2833,9 +2833,9 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, UpdateWindowAttributes(true); #ifdef XP_WIN - if (GetQuirks() & PluginModuleChild::QUIRK_WINLESS_TRACKPOPUP_HOOK) + if (GetQuirks() & QUIRK_WINLESS_TRACKPOPUP_HOOK) CreateWinlessPopupSurrogate(); - if (GetQuirks() & PluginModuleChild::QUIRK_FLASH_THROTTLE_WMUSER_EVENTS) + if (GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS) SetupFlashMsgThrottle(); #endif @@ -3027,7 +3027,7 @@ PluginInstanceChild::EnsureCurrentBuffer(void) if (mDrawingModel == NPDrawingModelCoreGraphics) { if (!mCGLayer) { bool avoidCGCrashes = !nsCocoaFeatures::OnMountainLionOrLater() && - (GetQuirks() & PluginModuleChild::QUIRK_FLASH_AVOID_CGMODE_CRASHES); + (GetQuirks() & QUIRK_FLASH_AVOID_CGMODE_CRASHES); caLayer = mozilla::plugins::PluginUtilsOSX::GetCGLayer(CallCGDraw, this, avoidCGCrashes, mContentsScaleFactor); @@ -3061,7 +3061,7 @@ PluginInstanceChild::EnsureCurrentBuffer(void) if (!mDoubleBufferCARenderer.HasFrontSurface()) { bool allocSurface = mDoubleBufferCARenderer.InitFrontSurface( mWindow.width, mWindow.height, mContentsScaleFactor, - GetQuirks() & PluginModuleChild::QUIRK_ALLOW_OFFLINE_RENDERER ? + GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ? ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER); if (!allocSurface) { PLUGIN_LOG_DEBUG(("Fail to allocate front IOSurface")); @@ -3234,7 +3234,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, nsIntRect plPaintRect(aRect); nsRefPtr renderSurface = aSurface; #ifdef MOZ_X11 - if (mIsTransparent && (GetQuirks() & PluginModuleChild::QUIRK_FLASH_EXPOSE_COORD_TRANSLATION)) { + if (mIsTransparent && (GetQuirks() & QUIRK_FLASH_EXPOSE_COORD_TRANSLATION)) { // Work around a bug in Flash up to 10.1 d51 at least, where expose event // top left coordinates within the plugin-rect and not at the drawable // origin are misinterpreted. (We can move the top left coordinate diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 74a3dea519a6..ceb1faebc4e9 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -2111,55 +2111,11 @@ PluginModuleChild::AllocPPluginInstanceChild(const nsCString& aMimeType, void PluginModuleChild::InitQuirksModes(const nsCString& aMimeType) { - if (mQuirks != QUIRKS_NOT_INITIALIZED) + if (mQuirks != QUIRKS_NOT_INITIALIZED) { return; - mQuirks = 0; - - nsPluginHost::SpecialType specialType = nsPluginHost::GetSpecialType(aMimeType); - - if (specialType == nsPluginHost::eSpecialType_Silverlight) { - mQuirks |= QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT; -#ifdef OS_WIN - mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK; - mQuirks |= QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT; -#endif } - if (specialType == nsPluginHost::eSpecialType_Flash) { - mQuirks |= QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN; -#ifdef OS_WIN - mQuirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK; - mQuirks |= QUIRK_FLASH_THROTTLE_WMUSER_EVENTS; - mQuirks |= QUIRK_FLASH_HOOK_SETLONGPTR; - mQuirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO; - mQuirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE; -#endif - } - -#ifdef OS_WIN - // QuickTime plugin usually loaded with audio/mpeg mimetype - NS_NAMED_LITERAL_CSTRING(quicktime, "npqtplugin"); - if (FindInReadable(quicktime, mPluginFilename)) { - mQuirks |= QUIRK_QUICKTIME_AVOID_SETWINDOW; - } -#endif - -#ifdef XP_MACOSX - // Whitelist Flash and Quicktime to support offline renderer - NS_NAMED_LITERAL_CSTRING(quicktime, "QuickTime Plugin.plugin"); - if (specialType == nsPluginHost::eSpecialType_Flash) { - mQuirks |= QUIRK_FLASH_AVOID_CGMODE_CRASHES; - mQuirks |= QUIRK_ALLOW_OFFLINE_RENDERER; - } else if (FindInReadable(quicktime, mPluginFilename)) { - mQuirks |= QUIRK_ALLOW_OFFLINE_RENDERER; - } -#endif - -#ifdef OS_WIN - if (specialType == nsPluginHost::eSpecialType_Unity) { - mQuirks |= QUIRK_UNITY_FIXUP_MOUSE_CAPTURE; - } -#endif + mQuirks = GetQuirksFromMimeTypeAndFilename(aMimeType, mPluginFilename); } bool diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 6463576037fb..e399a4c3d397 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -31,6 +31,7 @@ #include "mozilla/plugins/PPluginModuleChild.h" #include "mozilla/plugins/PluginInstanceChild.h" #include "mozilla/plugins/PluginMessageUtils.h" +#include "mozilla/plugins/PluginQuirks.h" // NOTE: stolen from nsNPAPIPlugin.h @@ -242,56 +243,6 @@ public: } #endif - // Quirks mode support for various plugin mime types - enum PluginQuirks { - QUIRKS_NOT_INITIALIZED = 0, - // Silverlight assumes it is transparent in windowless mode. This quirk - // matches the logic in nsNPAPIPluginInstance::SetWindowless. - QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT = 1 << 0, - // Win32: Hook TrackPopupMenu api so that we can swap out parent - // hwnds. The api will fail with parents not associated with our - // child ui thread. See WinlessHandleEvent for details. - QUIRK_WINLESS_TRACKPOPUP_HOOK = 1 << 1, - // Win32: Throttle flash WM_USER+1 heart beat messages to prevent - // flooding chromium's dispatch loop, which can cause ipc traffic - // processing lag. - QUIRK_FLASH_THROTTLE_WMUSER_EVENTS = 1 << 2, - // Win32: Catch resets on our subclass by hooking SetWindowLong. - QUIRK_FLASH_HOOK_SETLONGPTR = 1 << 3, - // X11: Work around a bug in Flash up to 10.1 d51 at least, where - // expose event top left coordinates within the plugin-rect and - // not at the drawable origin are misinterpreted. - QUIRK_FLASH_EXPOSE_COORD_TRANSLATION = 1 << 4, - // Win32: Catch get window info calls on the browser and tweak the - // results so mouse input works when flash is displaying it's settings - // window. - QUIRK_FLASH_HOOK_GETWINDOWINFO = 1 << 5, - // Win: Addresses a flash bug with mouse capture and full screen - // windows. - QUIRK_FLASH_FIXUP_MOUSE_CAPTURE = 1 << 6, - // Win: QuickTime steals focus on SetWindow calls even if it's hidden. - // Avoid calling SetWindow in that case. - QUIRK_QUICKTIME_AVOID_SETWINDOW = 1 << 7, - // Win: Check to make sure the parent window has focus before calling - // set focus on the child. Addresses a full screen dialog prompt - // problem in Silverlight. - QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT = 1 << 8, - // Mac: Allow the plugin to use offline renderer mode. - // Use this only if the plugin is certified the support the offline renderer. - QUIRK_ALLOW_OFFLINE_RENDERER = 1 << 9, - // Mac: Work around a Flash bug that can cause plugin process crashes - // in CoreGraphics mode: The Flash plugin sometimes accesses the - // CGContextRef we pass to it in NPP_HandleEvent(NPCocoaEventDrawRect) - // outside of that call. See bug 804606. - QUIRK_FLASH_AVOID_CGMODE_CRASHES = 1 << 10, - // Work around a Flash bug where it fails to check the error code of a - // NPN_GetValue(NPNVdocumentOrigin) call before trying to dereference - // its char* output. - QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN = 1 << 11, - // Win: Addresses a Unity bug with mouse capture. - QUIRK_UNITY_FIXUP_MOUSE_CAPTURE = 1 << 12, - }; - int GetQuirks() { return mQuirks; } const PluginSettings& Settings() const { return mCachedSettings; } diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 996a1d2c6837..fa682f000799 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -36,6 +36,7 @@ #include "nsNPAPIPlugin.h" #include "nsPrintfCString.h" #include "prsystem.h" +#include "PluginQuirks.h" #include "GeckoProfiler.h" #include "nsPluginTags.h" #include "nsUnicharUtils.h" @@ -625,7 +626,8 @@ PluginModuleChromeParent::WaitForIPCConnection() } PluginModuleParent::PluginModuleParent(bool aIsChrome) - : mIsChrome(aIsChrome) + : mQuirks(QUIRKS_NOT_INITIALIZED) + , mIsChrome(aIsChrome) , mShutdown(false) , mHadLocalInstance(false) , mClearSiteDataSupported(false) @@ -1343,10 +1345,21 @@ PluginModuleParent::GetPluginDetails() } mPluginName = pluginTag->Name(); mPluginVersion = pluginTag->Version(); + mPluginFilename = pluginTag->FileName(); mIsFlashPlugin = pluginTag->mIsFlashPlugin; return true; } +void +PluginModuleParent::InitQuirksModes(const nsCString& aMimeType) +{ + if (mQuirks != QUIRKS_NOT_INITIALIZED) { + return; + } + + mQuirks = GetQuirksFromMimeTypeAndFilename(aMimeType, mPluginFilename); +} + #ifdef XP_WIN void PluginModuleChromeParent::EvaluateHangUIState(const bool aReset) @@ -2539,6 +2552,7 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance, if (mPluginName.IsEmpty()) { GetPluginDetails(); + InitQuirksModes(nsDependentCString(pluginType)); /** mTimeBlocked measures the time that the main thread has been blocked * on plugin module initialization. As implemented, this is the sum of * plugin-container launch + toolhelp32 snapshot + NP_Initialize. diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index a826d6a4d526..e3fb65d09612 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -137,6 +137,8 @@ public: mHadLocalInstance = true; } + int GetQuirks() { return mQuirks; } + protected: virtual mozilla::ipc::RacyInterruptPolicy MediateInterruptRace(const Message& parent, const Message& child) override @@ -278,6 +280,10 @@ private: std::map> mClearSiteDataCallbacks; std::map> mSitesWithDataCallbacks; + nsCString mPluginFilename; + int mQuirks; + void InitQuirksModes(const nsCString& aMimeType); + public: #if defined(XP_MACOSX) diff --git a/dom/plugins/ipc/PluginQuirks.cpp b/dom/plugins/ipc/PluginQuirks.cpp new file mode 100644 index 000000000000..12a19a904307 --- /dev/null +++ b/dom/plugins/ipc/PluginQuirks.cpp @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: sw=4 ts=4 et : + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "PluginQuirks.h" + +#include "nsPluginHost.h" + +namespace mozilla { +namespace plugins { + +int GetQuirksFromMimeTypeAndFilename(const nsCString& aMimeType, + const nsCString& aPluginFilename) +{ + int quirks = 0; + + nsPluginHost::SpecialType specialType = nsPluginHost::GetSpecialType(aMimeType); + + if (specialType == nsPluginHost::eSpecialType_Silverlight) { + quirks |= QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT; +#ifdef OS_WIN + quirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK; + quirks |= QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT; +#endif + } + + if (specialType == nsPluginHost::eSpecialType_Flash) { + quirks |= QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN; +#ifdef OS_WIN + quirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK; + quirks |= QUIRK_FLASH_THROTTLE_WMUSER_EVENTS; + quirks |= QUIRK_FLASH_HOOK_SETLONGPTR; + quirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO; + quirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE; +#endif + } + +#ifdef OS_WIN + // QuickTime plugin usually loaded with audio/mpeg mimetype + NS_NAMED_LITERAL_CSTRING(quicktime, "npqtplugin"); + if (FindInReadable(quicktime, aPluginFilename)) { + quirks |= QUIRK_QUICKTIME_AVOID_SETWINDOW; + } +#endif + +#ifdef XP_MACOSX + // Whitelist Flash and Quicktime to support offline renderer + NS_NAMED_LITERAL_CSTRING(quicktime, "QuickTime Plugin.plugin"); + if (specialType == nsPluginHost::eSpecialType_Flash) { + quirks |= QUIRK_FLASH_AVOID_CGMODE_CRASHES; + quirks |= QUIRK_ALLOW_OFFLINE_RENDERER; + } else if (FindInReadable(quicktime, aPluginFilename)) { + quirks |= QUIRK_ALLOW_OFFLINE_RENDERER; + } +#endif + +#ifdef OS_WIN + if (specialType == nsPluginHost::eSpecialType_Unity) { + quirks |= QUIRK_UNITY_FIXUP_MOUSE_CAPTURE; + } +#endif + + return quirks; +} + +} /* namespace plugins */ +} /* namespace mozilla */ diff --git a/dom/plugins/ipc/PluginQuirks.h b/dom/plugins/ipc/PluginQuirks.h new file mode 100644 index 000000000000..386f14461dbe --- /dev/null +++ b/dom/plugins/ipc/PluginQuirks.h @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: sw=4 ts=4 et : + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef dom_plugins_PluginQuirks_h +#define dom_plugins_PluginQuirks_h + +namespace mozilla { +namespace plugins { + +// Quirks mode support for various plugin mime types +enum PluginQuirks { + QUIRKS_NOT_INITIALIZED = 0, + // Silverlight assumes it is transparent in windowless mode. This quirk + // matches the logic in nsNPAPIPluginInstance::SetWindowless. + QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT = 1 << 0, + // Win32: Hook TrackPopupMenu api so that we can swap out parent + // hwnds. The api will fail with parents not associated with our + // child ui thread. See WinlessHandleEvent for details. + QUIRK_WINLESS_TRACKPOPUP_HOOK = 1 << 1, + // Win32: Throttle flash WM_USER+1 heart beat messages to prevent + // flooding chromium's dispatch loop, which can cause ipc traffic + // processing lag. + QUIRK_FLASH_THROTTLE_WMUSER_EVENTS = 1 << 2, + // Win32: Catch resets on our subclass by hooking SetWindowLong. + QUIRK_FLASH_HOOK_SETLONGPTR = 1 << 3, + // X11: Work around a bug in Flash up to 10.1 d51 at least, where + // expose event top left coordinates within the plugin-rect and + // not at the drawable origin are misinterpreted. + QUIRK_FLASH_EXPOSE_COORD_TRANSLATION = 1 << 4, + // Win32: Catch get window info calls on the browser and tweak the + // results so mouse input works when flash is displaying it's settings + // window. + QUIRK_FLASH_HOOK_GETWINDOWINFO = 1 << 5, + // Win: Addresses a flash bug with mouse capture and full screen + // windows. + QUIRK_FLASH_FIXUP_MOUSE_CAPTURE = 1 << 6, + // Win: QuickTime steals focus on SetWindow calls even if it's hidden. + // Avoid calling SetWindow in that case. + QUIRK_QUICKTIME_AVOID_SETWINDOW = 1 << 7, + // Win: Check to make sure the parent window has focus before calling + // set focus on the child. Addresses a full screen dialog prompt + // problem in Silverlight. + QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT = 1 << 8, + // Mac: Allow the plugin to use offline renderer mode. + // Use this only if the plugin is certified the support the offline renderer. + QUIRK_ALLOW_OFFLINE_RENDERER = 1 << 9, + // Mac: Work around a Flash bug that can cause plugin process crashes + // in CoreGraphics mode: The Flash plugin sometimes accesses the + // CGContextRef we pass to it in NPP_HandleEvent(NPCocoaEventDrawRect) + // outside of that call. See bug 804606. + QUIRK_FLASH_AVOID_CGMODE_CRASHES = 1 << 10, + // Work around a Flash bug where it fails to check the error code of a + // NPN_GetValue(NPNVdocumentOrigin) call before trying to dereference + // its char* output. + QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN = 1 << 11, + // Win: Addresses a Unity bug with mouse capture. + QUIRK_UNITY_FIXUP_MOUSE_CAPTURE = 1 << 12, +}; + +int GetQuirksFromMimeTypeAndFilename(const nsCString& aMimeType, + const nsCString& aPluginFilename); + +} /* namespace plugins */ +} /* namespace mozilla */ + +#endif // ifndef dom_plugins_PluginQuirks_h diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build index b387f9fbbb4f..b4b1b434470b 100644 --- a/dom/plugins/ipc/moz.build +++ b/dom/plugins/ipc/moz.build @@ -31,6 +31,7 @@ EXPORTS.mozilla.plugins += [ 'PluginModuleParent.h', 'PluginProcessChild.h', 'PluginProcessParent.h', + 'PluginQuirks.h', 'PluginScriptableObjectChild.h', 'PluginScriptableObjectParent.h', 'PluginScriptableObjectUtils-inl.h', @@ -86,6 +87,7 @@ UNIFIED_SOURCES += [ 'PluginModuleParent.cpp', 'PluginProcessChild.cpp', 'PluginProcessParent.cpp', + 'PluginQuirks.cpp', 'PluginScriptableObjectChild.cpp', 'PluginScriptableObjectParent.cpp', 'PluginStreamChild.cpp',