Issue #1638 - Part 1: Put NPAPI code behind MOZ_ENABLE_NPAPI.

Adds --disable-npapi as an additional build option. The default is still to build in NPAPI compatibility, but with this flag, it's finally possible to build without pulling in GTK2 on systems that don't have the package.

This essentially ifdefs everything associated with NPAPI, following various Mozilla removal bugs.

Ref: BZ 1682030, BZ 1251202, BZ 1217665, BZ 1687239
This commit is contained in:
athenian200 committed 2024-01-10 04:03:35 -06:00
1 parent 9dac9de154
commit b787af5702
106 files changed
+1400 -273

No files matched your search

+9 -1
View File
@@ -44,7 +44,9 @@
#ifdef XP_WIN #ifdef XP_WIN
#include "mozilla/a11y/Compatibility.h" #include "mozilla/a11y/Compatibility.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#ifdef MOZ_ENABLE_NPAPI
#include "HTMLWin32ObjectAccessible.h" #include "HTMLWin32ObjectAccessible.h"
#endif
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
#endif #endif
@@ -55,7 +57,9 @@
#include "nsImageFrame.h" #include "nsImageFrame.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsSVGPathGeometryFrame.h" #include "nsSVGPathGeometryFrame.h"
#include "nsTreeBodyFrame.h" #include "nsTreeBodyFrame.h"
#include "nsTreeColumns.h" #include "nsTreeColumns.h"
@@ -79,7 +83,7 @@
#include "XULTabAccessible.h" #include "XULTabAccessible.h"
#include "XULTreeGridAccessibleWrap.h" #include "XULTreeGridAccessibleWrap.h"
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK) #if (defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)) && defined(MOZ_ENABLE_NPAPI)
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#endif #endif
@@ -431,6 +435,7 @@ private:
NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback) NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback)
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
already_AddRefed<Accessible> already_AddRefed<Accessible>
nsAccessibilityService::CreatePluginAccessible(nsPluginFrame* aFrame, nsAccessibilityService::CreatePluginAccessible(nsPluginFrame* aFrame,
nsIContent* aContent, nsIContent* aContent,
@@ -493,6 +498,7 @@ nsAccessibilityService::CreatePluginAccessible(nsPluginFrame* aFrame,
return nullptr; return nullptr;
} }
#endif // MOZ_ENABLE_NPAPI
void void
nsAccessibilityService::DeckPanelSwitched(nsIPresShell* aPresShell, nsAccessibilityService::DeckPanelSwitched(nsIPresShell* aPresShell,
@@ -1638,11 +1644,13 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
case eOuterDocType: case eOuterDocType:
newAcc = new OuterDocAccessible(aContent, document); newAcc = new OuterDocAccessible(aContent, document);
break; break;
#ifdef MOZ_ENABLE_NPAPI
case ePluginType: { case ePluginType: {
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame); nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
newAcc = CreatePluginAccessible(pluginFrame, aContent, aContext); newAcc = CreatePluginAccessible(pluginFrame, aContent, aContext);
break; break;
} }
#endif
case eTextLeafType: case eTextLeafType:
newAcc = new TextLeafAccessibleWrap(aContent, document); newAcc = new TextLeafAccessibleWrap(aContent, document);
break; break;
+4
View File
@@ -20,7 +20,9 @@
class nsImageFrame; class nsImageFrame;
class nsIArray; class nsIArray;
class nsIPersistentProperties; class nsIPersistentProperties;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginFrame; class nsPluginFrame;
#endif
class nsITreeView; class nsITreeView;
namespace mozilla { namespace mozilla {
@@ -87,9 +89,11 @@ public:
Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell, Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
bool aCanCreate); bool aCanCreate);
#ifdef MOZ_ENABLE_NPAPI
already_AddRefed<Accessible> already_AddRefed<Accessible>
CreatePluginAccessible(nsPluginFrame* aFrame, nsIContent* aContent, CreatePluginAccessible(nsPluginFrame* aFrame, nsIContent* aContent,
Accessible* aContext); Accessible* aContext);
#endif
/** /**
* Adds/remove ATK root accessible for gtk+ native window to/from children * Adds/remove ATK root accessible for gtk+ native window to/from children
+2 -1
View File
@@ -486,13 +486,14 @@ DocAccessibleParent::SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy)
IAccessibleHolder holder(Move(ptr)); IAccessibleHolder holder(Move(ptr));
Unused << SendParentCOMProxy(holder); Unused << SendParentCOMProxy(holder);
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
DocAccessibleParent::RecvGetWindowedPluginIAccessible( DocAccessibleParent::RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy)
{ {
return false; return false;
} }
#endif
#endif // defined(XP_WIN) #endif // defined(XP_WIN)
+3 -2
View File
@@ -143,10 +143,11 @@ public:
#if defined(XP_WIN) #if defined(XP_WIN)
void SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy); void SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy);
#ifdef MOZ_ENABLE_NPAPI
virtual bool RecvGetWindowedPluginIAccessible( virtual bool RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override; const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;
#endif #endif // MOZ_ENABLE_NPAPI
#endif // XP_WIN
private: private:
+2
View File
@@ -61,8 +61,10 @@ parent:
*/ */
async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID); async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
#ifdef MOZ_ENABLE_NPAPI
sync GetWindowedPluginIAccessible(WindowsHandle aHwnd) sync GetWindowedPluginIAccessible(WindowsHandle aHwnd)
returns (IAccessibleHolder aPluginCOMProxy); returns (IAccessibleHolder aPluginCOMProxy);
#endif
child: child:
async ParentCOMProxy(IAccessibleHolder aParentCOMProxy); async ParentCOMProxy(IAccessibleHolder aParentCOMProxy);
+1 -1
View File
@@ -8,7 +8,7 @@ if CONFIG['COMPILE_ENVIRONMENT']:
# With --disable-accessibility, we need to compile PDocAccessible.ipdl (which # With --disable-accessibility, we need to compile PDocAccessible.ipdl (which
# also depends on COMPtrTypes.h), but not the C++. # also depends on COMPtrTypes.h), but not the C++.
IPDL_SOURCES += ['PDocAccessible.ipdl'] PREPROCESSED_IPDL_SOURCES += ['PDocAccessible.ipdl']
EXPORTS.mozilla.a11y += ['COMPtrTypes.h'] EXPORTS.mozilla.a11y += ['COMPtrTypes.h']
if CONFIG['ACCESSIBILITY']: if CONFIG['ACCESSIBILITY']:
+7
View File
@@ -38,6 +38,13 @@ SOURCES += [
'XULTreeGridAccessibleWrap.cpp', 'XULTreeGridAccessibleWrap.cpp',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
SOURCES += [
'HTMLWin32ObjectAccessible.cpp',
]
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/accessible/base', '/accessible/base',
'/accessible/generic', '/accessible/generic',
+1
View File
@@ -207,6 +207,7 @@ def old_configure_options(*options):
'--enable-necko-wifi', '--enable-necko-wifi',
'--enable-negotiateauth', '--enable-negotiateauth',
'--enable-nfc', '--enable-nfc',
'--enable-npapi',
'--enable-nspr-build', '--enable-nspr-build',
'--enable-official-branding', '--enable-official-branding',
'--enable-official-vendor', '--enable-official-vendor',
+8
View File
@@ -8,7 +8,9 @@
#include "Navigator.h" #include "Navigator.h"
#include "nsIXULAppInfo.h" #include "nsIXULAppInfo.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginArray.h" #include "nsPluginArray.h"
#endif
#include "nsMimeTypeArray.h" #include "nsMimeTypeArray.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BodyExtractor.h" #include "mozilla/dom/BodyExtractor.h"
@@ -179,7 +181,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes)
#ifdef MOZ_ENABLE_NPAPI
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
@@ -210,10 +214,12 @@ Navigator::Invalidate()
mMimeTypes = nullptr; mMimeTypes = nullptr;
#ifdef MOZ_ENABLE_NPAPI
if (mPlugins) { if (mPlugins) {
mPlugins->Invalidate(); mPlugins->Invalidate();
mPlugins = nullptr; mPlugins = nullptr;
} }
#endif
mPermissions = nullptr; mPermissions = nullptr;
@@ -489,6 +495,7 @@ Navigator::GetMimeTypes(ErrorResult& aRv)
return mMimeTypes; return mMimeTypes;
} }
#ifdef MOZ_ENABLE_NPAPI
nsPluginArray* nsPluginArray*
Navigator::GetPlugins(ErrorResult& aRv) Navigator::GetPlugins(ErrorResult& aRv)
{ {
@@ -503,6 +510,7 @@ Navigator::GetPlugins(ErrorResult& aRv)
return mPlugins; return mPlugins;
} }
#endif
Permissions* Permissions*
Navigator::GetPermissions(ErrorResult& aRv) Navigator::GetPermissions(ErrorResult& aRv)
+6
View File
@@ -19,7 +19,9 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsWeakPtr.h" #include "nsWeakPtr.h"
#ifdef MOZ_ENABLE_NPAPI
class nsPluginArray; class nsPluginArray;
#endif
class nsMimeTypeArray; class nsMimeTypeArray;
class nsPIDOMWindowInner; class nsPIDOMWindowInner;
class nsIDOMNavigatorSystemMessages; class nsIDOMNavigatorSystemMessages;
@@ -127,7 +129,9 @@ public:
void RegisterContentHandler(const nsAString& aMIMEType, const nsAString& aURL, void RegisterContentHandler(const nsAString& aMIMEType, const nsAString& aURL,
const nsAString& aTitle, ErrorResult& aRv); const nsAString& aTitle, ErrorResult& aRv);
nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv); nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
#ifdef MOZ_ENABLE_NPAPI
nsPluginArray* GetPlugins(ErrorResult& aRv); nsPluginArray* GetPlugins(ErrorResult& aRv);
#endif
Permissions* GetPermissions(ErrorResult& aRv); Permissions* GetPermissions(ErrorResult& aRv);
bool GlobalPrivacyControl(); bool GlobalPrivacyControl();
Geolocation* GetGeolocation(ErrorResult& aRv); Geolocation* GetGeolocation(ErrorResult& aRv);
@@ -260,7 +264,9 @@ private:
ErrorResult& aRv); ErrorResult& aRv);
RefPtr<nsMimeTypeArray> mMimeTypes; RefPtr<nsMimeTypeArray> mMimeTypes;
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPluginArray> mPlugins; RefPtr<nsPluginArray> mPlugins;
#endif
RefPtr<Permissions> mPermissions; RefPtr<Permissions> mPermissions;
RefPtr<Geolocation> mGeolocation; RefPtr<Geolocation> mGeolocation;
RefPtr<DesktopNotificationCenter> mNotification; RefPtr<DesktopNotificationCenter> mNotification;
+3 -2
View File
@@ -394,10 +394,11 @@ SOURCES += [
'nsImageLoadingContent.cpp', 'nsImageLoadingContent.cpp',
# Because of OS X headers. # Because of OS X headers.
'nsObjectLoadingContent.cpp', 'nsObjectLoadingContent.cpp',
# nsPluginArray.cpp includes npapi.h indirectly, and that includes a lot of system headers
'nsPluginArray.cpp',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
SOURCES += ['nsPluginArray.cpp']
# Are we targeting x86-32 or x86-64? If so, we want to include SSE2 code for # Are we targeting x86-32 or x86-64? If so, we want to include SSE2 code for
# nsTextFragment.cpp # nsTextFragment.cpp
if CONFIG['INTEL_ARCHITECTURE']: if CONFIG['INTEL_ARCHITECTURE']:
+3 -1
View File
@@ -23,7 +23,9 @@
#include "Layers.h" #include "Layers.h"
#include "MediaDecoder.h" #include "MediaDecoder.h"
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h. // nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#endif
#include "gfxDrawable.h" #include "gfxDrawable.h"
#include "gfxPrefs.h" #include "gfxPrefs.h"
#include "ImageOps.h" #include "ImageOps.h"
@@ -6950,7 +6952,7 @@ nsContentUtils::HaveEqualPrincipals(nsIDocument* aDoc1, nsIDocument* aDoc2)
bool bool
nsContentUtils::HasPluginWithUncontrolledEventDispatch(nsIContent* aContent) nsContentUtils::HasPluginWithUncontrolledEventDispatch(nsIContent* aContent)
{ {
#ifdef XP_MACOSX #if defined(XP_MACOSX) || !defined(MOZ_ENABLE_NPAPI)
// We control dispatch to all mac plugins. // We control dispatch to all mac plugins.
return false; return false;
#else #else
+3
View File
@@ -3145,9 +3145,11 @@ nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugins) nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugins)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIDocument> doc = GetDocument(); nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc); NS_ENSURE_STATE(doc);
@@ -3159,6 +3161,7 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugin
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
aPlugins.setObject(*jsPlugins); aPlugins.setObject(*jsPlugins);
#endif
return NS_OK; return NS_OK;
} }
+3 -1
View File
@@ -9687,6 +9687,7 @@ nsDocument::RemovePlugin(nsIObjectLoadingContent* aPlugin)
mPlugins.RemoveEntry(aPlugin); mPlugins.RemoveEntry(aPlugin);
} }
#ifdef MOZ_ENABLE_NPAPI
static bool static bool
AllSubDocumentPluginEnum(nsIDocument* aDocument, void* userArg) AllSubDocumentPluginEnum(nsIDocument* aDocument, void* userArg)
{ {
@@ -9706,6 +9707,7 @@ nsDocument::GetPlugins(nsTArray<nsIObjectLoadingContent*>& aPlugins)
} }
EnumerateSubDocuments(AllSubDocumentPluginEnum, &aPlugins); EnumerateSubDocuments(AllSubDocumentPluginEnum, &aPlugins);
} }
#endif
nsresult nsresult
nsDocument::AddResponsiveContent(nsIContent* aContent) nsDocument::AddResponsiveContent(nsIContent* aContent)
@@ -12307,4 +12309,4 @@ nsIDocument::ModuleScriptsEnabled()
} }
return nsContentUtils::IsChromeDoc(this) || sEnabledForContent; return nsContentUtils::IsChromeDoc(this) || sEnabledForContent;
} }
+2 -1
View File
@@ -829,10 +829,11 @@ public:
// RemovePlugin removes a plugin-related element to mPlugins when the // RemovePlugin removes a plugin-related element to mPlugins when the
// element is removed from the tree. // element is removed from the tree.
virtual void RemovePlugin(nsIObjectLoadingContent* aPlugin) override; virtual void RemovePlugin(nsIObjectLoadingContent* aPlugin) override;
#ifdef MOZ_ENABLE_NPAPI
// GetPlugins returns the plugin-related elements from // GetPlugins returns the plugin-related elements from
// the frame and any subframes. // the frame and any subframes.
virtual void GetPlugins(nsTArray<nsIObjectLoadingContent*>& aPlugins) override; virtual void GetPlugins(nsTArray<nsIObjectLoadingContent*>& aPlugins) override;
#endif
// Adds an element to mResponsiveContent when the element is // Adds an element to mResponsiveContent when the element is
// added to the tree. // added to the tree.
virtual nsresult AddResponsiveContent(nsIContent* aContent) override; virtual nsresult AddResponsiveContent(nsIContent* aContent) override;
+4
View File
@@ -78,8 +78,10 @@
#include "AppProcessChecker.h" #include "AppProcessChecker.h"
#include "ContentParent.h" #include "ContentParent.h"
#include "TabParent.h" #include "TabParent.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PPluginWidgetParent.h" #include "mozilla/plugins/PPluginWidgetParent.h"
#include "../plugins/ipc/PluginWidgetParent.h" #include "../plugins/ipc/PluginWidgetParent.h"
#endif
#include "mozilla/AsyncEventDispatcher.h" #include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "mozilla/GuardObjects.h" #include "mozilla/GuardObjects.h"
@@ -1153,6 +1155,7 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
aOther->mRemoteBrowser->SetBrowserDOMWindow(browserDOMWindow); aOther->mRemoteBrowser->SetBrowserDOMWindow(browserDOMWindow);
mRemoteBrowser->SetBrowserDOMWindow(otherBrowserDOMWindow); mRemoteBrowser->SetBrowserDOMWindow(otherBrowserDOMWindow);
#ifdef MOZ_ENABLE_NPAPI
// Native plugin windows used by this remote content need to be reparented. // Native plugin windows used by this remote content need to be reparented.
if (nsPIDOMWindowOuter* newWin = ourDoc->GetWindow()) { if (nsPIDOMWindowOuter* newWin = ourDoc->GetWindow()) {
RefPtr<nsIWidget> newParent = nsGlobalWindow::Cast(newWin)->GetMainWidget(); RefPtr<nsIWidget> newParent = nsGlobalWindow::Cast(newWin)->GetMainWidget();
@@ -1162,6 +1165,7 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
static_cast<mozilla::plugins::PluginWidgetParent*>(iter.Get()->GetKey())->SetParent(newParent); static_cast<mozilla::plugins::PluginWidgetParent*>(iter.Get()->GetKey())->SetParent(newParent);
} }
} }
#endif // MOZ_ENABLE_NPAPI
MaybeUpdatePrimaryTabParent(eTabParentRemoved); MaybeUpdatePrimaryTabParent(eTabParentRemoved);
aOther->MaybeUpdatePrimaryTabParent(eTabParentRemoved); aOther->MaybeUpdatePrimaryTabParent(eTabParentRemoved);
+2 -1
View File
@@ -2383,8 +2383,9 @@ public:
virtual nsresult AddPlugin(nsIObjectLoadingContent* aPlugin) = 0; virtual nsresult AddPlugin(nsIObjectLoadingContent* aPlugin) = 0;
virtual void RemovePlugin(nsIObjectLoadingContent* aPlugin) = 0; virtual void RemovePlugin(nsIObjectLoadingContent* aPlugin) = 0;
#ifdef MOZ_ENABLE_NPAPI
virtual void GetPlugins(nsTArray<nsIObjectLoadingContent*>& aPlugins) = 0; virtual void GetPlugins(nsTArray<nsIObjectLoadingContent*>& aPlugins) = 0;
#endif
virtual nsresult AddResponsiveContent(nsIContent* aContent) = 0; virtual nsresult AddResponsiveContent(nsIContent* aContent) = 0;
virtual void RemoveResponsiveContent(nsIContent* aContent) = 0; virtual void RemoveResponsiveContent(nsIContent* aContent) = 0;
virtual void NotifyMediaFeatureValuesChanged() = 0; virtual void NotifyMediaFeatureValuesChanged() = 0;
+1
View File
@@ -114,6 +114,7 @@ interface nsIObjectLoadingContent : nsISupports
* printing the plugin. The returned nsIFrame is in the original document, * printing the plugin. The returned nsIFrame is in the original document,
* not in the static clone. * not in the static clone.
*/ */
[noscript] nsIFrame getPrintFrame(); [noscript] nsIFrame getPrintFrame();
/* /*
+20 -2
View File
@@ -9,7 +9,9 @@
#include "mozilla/dom/MimeTypeBinding.h" #include "mozilla/dom/MimeTypeBinding.h"
#include "nsIDOMNavigator.h" #include "nsIDOMNavigator.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginArray.h" #include "nsPluginArray.h"
#endif
#include "nsIMIMEService.h" #include "nsIMIMEService.h"
#include "nsIMIMEInfo.h" #include "nsIMIMEInfo.h"
#include "Navigator.h" #include "Navigator.h"
@@ -118,6 +120,7 @@ FindMimeType(const nsTArray<RefPtr<nsMimeType>>& aMimeTypes,
nsMimeType* nsMimeType*
nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound) nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
{ {
#ifdef MOZ_ENABLE_NPAPI
aFound = false; aFound = false;
if (ResistFingerprinting()) { if (ResistFingerprinting()) {
@@ -138,7 +141,7 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
if (hiddenType) { if (hiddenType) {
nsPluginArray::NotifyHiddenPluginTouched(hiddenType->GetEnabledPlugin()); nsPluginArray::NotifyHiddenPluginTouched(hiddenType->GetEnabledPlugin());
} }
#endif
return nullptr; return nullptr;
} }
@@ -167,6 +170,7 @@ nsMimeTypeArray::GetSupportedNames(nsTArray<nsString>& aRetval)
void void
nsMimeTypeArray::EnsurePluginMimeTypes() nsMimeTypeArray::EnsurePluginMimeTypes()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!mMimeTypes.IsEmpty() || !mWindow) { if (!mMimeTypes.IsEmpty() || !mWindow) {
return; return;
} }
@@ -186,15 +190,25 @@ nsMimeTypeArray::EnsurePluginMimeTypes()
pluginArray->GetMimeTypes(mMimeTypes); pluginArray->GetMimeTypes(mMimeTypes);
pluginArray->GetCTPMimeTypes(mCTPMimeTypes); pluginArray->GetCTPMimeTypes(mCTPMimeTypes);
#else
return;
#endif
} }
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsMimeType, AddRef) NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsMimeType, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsMimeType, Release) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsMimeType, Release)
#ifdef MOZ_ENABLE_NPAPI
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mWindow, mPluginElement) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mWindow, mPluginElement)
#else
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mWindow)
#endif
nsMimeType::nsMimeType(nsPIDOMWindowInner* aWindow, nsMimeType::nsMimeType(nsPIDOMWindowInner* aWindow,
#ifdef MOZ_ENABLE_NPAPI
nsPluginElement* aPluginElement, nsPluginElement* aPluginElement,
#else
void* aPluginElement,
#endif
const nsAString& aType, const nsAString& aType,
const nsAString& aDescription, const nsAString& aDescription,
const nsAString& aExtension) const nsAString& aExtension)
@@ -233,12 +247,16 @@ nsMimeType::GetDescription(nsString& aRetval) const
nsPluginElement* nsPluginElement*
nsMimeType::GetEnabledPlugin() const nsMimeType::GetEnabledPlugin() const
{ {
#ifdef MOZ_ENABLE_NPAPI
// mPluginElement might be null if we got unlinked but are still somehow being // mPluginElement might be null if we got unlinked but are still somehow being
// called into. // called into.
if (!mPluginElement || !mPluginElement->PluginTag()->IsEnabled()) { if (!mPluginElement || !mPluginElement->PluginTag()->IsEnabled()) {
return nullptr; return nullptr;
} }
return mPluginElement; return mPluginElement;
#else
return nullptr;
#endif
} }
void void
+8
View File
@@ -57,7 +57,11 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType)
nsMimeType(nsPIDOMWindowInner* aWindow, nsMimeType(nsPIDOMWindowInner* aWindow,
#ifdef MOZ_ENABLE_NPAPI
nsPluginElement* aPluginElement, nsPluginElement* aPluginElement,
#else
void* aPluginElement,
#endif
const nsAString& aType, const nsAString& aType,
const nsAString& aDescription, const nsAString& aDescription,
const nsAString& aExtension); const nsAString& aExtension);
@@ -83,7 +87,11 @@ protected:
// Strong reference to the active plugin. Note that this creates an explicit // Strong reference to the active plugin. Note that this creates an explicit
// reference cycle through the plugin element's mimetype array. We rely on the // reference cycle through the plugin element's mimetype array. We rely on the
// cycle collector to break this cycle. // cycle collector to break this cycle.
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPluginElement> mPluginElement; RefPtr<nsPluginElement> mPluginElement;
#else
void* mPluginElement;
#endif
nsString mType; nsString mType;
nsString mDescription; nsString mDescription;
nsString mExtension; nsString mExtension;
+125 -16
View File
@@ -21,11 +21,15 @@
#include "nsIDOMHTMLAppletElement.h" #include "nsIDOMHTMLAppletElement.h"
#include "nsIExternalProtocolHandler.h" #include "nsIExternalProtocolHandler.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIObjectFrame.h" #include "nsIObjectFrame.h"
#endif
#include "nsIPermissionManager.h" #include "nsIPermissionManager.h"
#include "nsPluginHost.h" #include "nsPluginHost.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#include "nsJSNPRuntime.h" #include "nsJSNPRuntime.h"
#endif
#include "nsINestedURI.h" #include "nsINestedURI.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsScriptSecurityManager.h" #include "nsScriptSecurityManager.h"
@@ -68,7 +72,9 @@
#include "mozAutoDocUpdate.h" #include "mozAutoDocUpdate.h"
#include "nsIContentSecurityPolicy.h" #include "nsIContentSecurityPolicy.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsDOMClassInfo.h" #include "nsDOMClassInfo.h"
#include "nsWrapperCacheInlines.h" #include "nsWrapperCacheInlines.h"
#include "nsDOMJSUtils.h" #include "nsDOMJSUtils.h"
@@ -101,7 +107,9 @@
#include "mozilla/dom/HTMLObjectElement.h" #include "mozilla/dom/HTMLObjectElement.h"
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#endif
static const char *kPrefJavaMIME = "plugin.java.mime"; static const char *kPrefJavaMIME = "plugin.java.mime";
static const char *kPrefYoutubeRewrite = "plugins.rewrite_youtube_embeds"; static const char *kPrefYoutubeRewrite = "plugins.rewrite_youtube_embeds";
@@ -123,6 +131,7 @@ GetObjectLog()
#define LOG(args) MOZ_LOG(GetObjectLog(), mozilla::LogLevel::Debug, args) #define LOG(args) MOZ_LOG(GetObjectLog(), mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug) #define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug)
#ifdef MOZ_ENABLE_NPAPI
static bool static bool
IsJavaMIME(const nsACString & aMIMEType) IsJavaMIME(const nsACString & aMIMEType)
{ {
@@ -136,6 +145,7 @@ IsFlashMIME(const nsACString & aMIMEType)
return return
nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Flash; nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Flash;
} }
#endif
static bool static bool
InActiveDocument(nsIContent *aContent) InActiveDocument(nsIContent *aContent)
@@ -371,6 +381,7 @@ nsPluginCrashedEvent::Run()
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
class nsStopPluginRunnable : public Runnable, public nsITimerCallback class nsStopPluginRunnable : public Runnable, public nsITimerCallback
{ {
public: public:
@@ -442,6 +453,7 @@ nsStopPluginRunnable::Run()
return NS_OK; return NS_OK;
} }
#endif
// You can't take the address of bitfield members, so we have two separate // You can't take the address of bitfield members, so we have two separate
// classes for these :-/ // classes for these :-/
@@ -561,6 +573,7 @@ GetExtensionFromURI(nsIURI* uri, nsCString& ext)
bool bool
IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType) IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsAutoCString ext; nsAutoCString ext;
GetExtensionFromURI(uri, ext); GetExtensionFromURI(uri, ext);
@@ -586,6 +599,9 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
} }
return pluginHost->HavePluginForExtension(ext, mimeType); return pluginHost->HavePluginForExtension(ext, mimeType);
#else
return false;
#endif
} }
/// ///
@@ -604,6 +620,7 @@ nsObjectLoadingContent::QueueCheckPluginStopEvent()
// Tedious syntax to create a plugin stream listener with checks and put it in // Tedious syntax to create a plugin stream listener with checks and put it in
// mFinalListener // mFinalListener
#ifdef MOZ_ENABLE_NPAPI
bool bool
nsObjectLoadingContent::MakePluginListener() nsObjectLoadingContent::MakePluginListener()
{ {
@@ -628,7 +645,13 @@ nsObjectLoadingContent::MakePluginListener()
mFinalListener = finalListener; mFinalListener = finalListener;
return true; return true;
} }
#else
bool
nsObjectLoadingContent::MakePluginListener()
{
return false;
}
#endif // MOZ_ENABLE_NPAPI
bool bool
nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType) nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
@@ -699,7 +722,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
MOZ_ASSERT(thisContent); MOZ_ASSERT(thisContent);
nsIDocument* ownerDoc = thisContent->OwnerDoc(); nsIDocument* ownerDoc = thisContent->OwnerDoc();
ownerDoc->RemovePlugin(this); ownerDoc->RemovePlugin(this);
#ifdef MOZ_ENABLE_NPAPI
if (mType == eType_Plugin && (mInstanceOwner || mInstantiating)) { if (mType == eType_Plugin && (mInstanceOwner || mInstantiating)) {
// we'll let the plugin continue to run at least until we get back to // we'll let the plugin continue to run at least until we get back to
// the event loop. If we get back to the event loop and the node // the event loop. If we get back to the event loop and the node
@@ -707,6 +730,9 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
// plugin // plugin
QueueCheckPluginStopEvent(); QueueCheckPluginStopEvent();
} else if (mType != eType_Image) { } else if (mType != eType_Image) {
#else
if (mType != eType_Image) {
#endif
// nsImageLoadingContent handles the image case. // nsImageLoadingContent handles the image case.
// Reset state and clear pending events // Reset state and clear pending events
/// XXX(johns): The implementation for GenericFrame notes that ideally we /// XXX(johns): The implementation for GenericFrame notes that ideally we
@@ -760,6 +786,7 @@ nsObjectLoadingContent::~nsObjectLoadingContent()
nsresult nsresult
nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading) nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mInstanceOwner || mType != eType_Plugin || (mIsLoading != aIsLoading) || if (mInstanceOwner || mType != eType_Plugin || (mIsLoading != aIsLoading) ||
mInstantiating) { mInstantiating) {
// If we hit this assertion it's probably because LoadObject re-entered :( // If we hit this assertion it's probably because LoadObject re-entered :(
@@ -920,6 +947,9 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
#endif #endif
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif // MOZ_ENABLE_NPAPI
} }
void void
@@ -1023,9 +1053,11 @@ nsObjectLoadingContent::BuildParametersArray()
atom->ToString(param.mName); atom->ToString(param.mName);
mCachedAttributes.AppendElement(param); mCachedAttributes.AppendElement(param);
} }
#ifdef MOZ_ENABLE_NPAPI
bool isJava = IsJavaMIME(mContentType); bool isJava = IsJavaMIME(mContentType);
#else
bool isJava = false;
#endif
nsCString codebase; nsCString codebase;
if (isJava) { if (isJava) {
nsresult rv = mBaseURI->GetSpec(codebase); nsresult rv = mBaseURI->GetSpec(codebase);
@@ -1104,7 +1136,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
// happens when a new load starts before the previous one got here // happens when a new load starts before the previous one got here
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
#ifdef MOZ_ENABLE_NPAPI
// If we already switched to type plugin, this channel can just be passed to // If we already switched to type plugin, this channel can just be passed to
// the final listener. // the final listener.
if (mType == eType_Plugin) { if (mType == eType_Plugin) {
@@ -1120,6 +1152,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
} }
#endif
// Otherwise we should be state loading, and call LoadObject with the channel // Otherwise we should be state loading, and call LoadObject with the channel
if (mType != eType_Loading) { if (mType != eType_Loading) {
@@ -1263,9 +1296,11 @@ nsObjectLoadingContent::GetDisplayedType(uint32_t* aType)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame) nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mType != eType_Plugin) { if (mType != eType_Plugin) {
return NS_OK; return NS_OK;
} }
@@ -1298,11 +1333,15 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
mInstanceOwner->SetFrame(objFrame); mInstanceOwner->SetFrame(objFrame);
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::GetPluginInstance(nsNPAPIPluginInstance** aInstance) nsObjectLoadingContent::GetPluginInstance(nsNPAPIPluginInstance** aInstance)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aInstance = nullptr; *aInstance = nullptr;
if (!mInstanceOwner) { if (!mInstanceOwner) {
@@ -1310,6 +1349,9 @@ nsObjectLoadingContent::GetPluginInstance(nsNPAPIPluginInstance** aInstance)
} }
return mInstanceOwner->GetInstance(aInstance); return mInstanceOwner->GetInstance(aInstance);
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -1701,6 +1743,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
bool isJava = false; bool isJava = false;
// Set if this state can't be used to load anything, forces eType_Null // Set if this state can't be used to load anything, forces eType_Null
bool stateInvalid = false; bool stateInvalid = false;
// Indicates what parameters changed. // Indicates what parameters changed.
// eParamChannelChanged - means parameters that affect channel opening // eParamChannelChanged - means parameters that affect channel opening
// decisions changed // decisions changed
@@ -1713,7 +1756,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
// parameter changes require re-opening the channel even if we haven't gotten // parameter changes require re-opening the channel even if we haven't gotten
// that far. // that far.
nsObjectLoadingContent::ParameterUpdateFlags retval = eParamNoChange; nsObjectLoadingContent::ParameterUpdateFlags retval = eParamNoChange;
#ifdef MOZ_ENABLE_NPAPI
/// ///
/// Initial MIME Type /// Initial MIME Type
/// ///
@@ -1733,11 +1776,11 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
isJava = IsJavaMIME(newMime); isJava = IsJavaMIME(newMime);
} }
} }
#endif
/// ///
/// classID /// classID
/// ///
#ifdef MOZ_ENABLE_NPAPI
if (caps & eSupportClassID) { if (caps & eSupportClassID) {
nsAutoString classIDAttr; nsAutoString classIDAttr;
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr); thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
@@ -1761,7 +1804,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
} }
} }
} }
#endif
/// ///
/// Codebase /// Codebase
/// ///
@@ -1863,7 +1906,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
stateInvalid = true; stateInvalid = true;
} }
} }
#ifdef MOZ_ENABLE_NPAPI
// For eAllowPluginSkipChannel tags, if we have a non-plugin type, but can get // For eAllowPluginSkipChannel tags, if we have a non-plugin type, but can get
// a plugin type from the extension, prefer that to falling back to a channel. // a plugin type from the extension, prefer that to falling back to a channel.
if (GetTypeOfContent(newMime) != eType_Plugin && newURI && if (GetTypeOfContent(newMime) != eType_Plugin && newURI &&
@@ -1874,6 +1917,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
return UpdateObjectParameters(true); return UpdateObjectParameters(true);
} }
} }
#endif
/// ///
/// Check if the original (pre-channel) content-type or URI changed, and /// Check if the original (pre-channel) content-type or URI changed, and
@@ -1986,6 +2030,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
} }
} else { } else {
newMime = channelType; newMime = channelType;
#ifdef MOZ_ENABLE_NPAPI
if (IsJavaMIME(newMime)) { if (IsJavaMIME(newMime)) {
// Java does not load with a channel, and being java retroactively // Java does not load with a channel, and being java retroactively
// changes how we may have interpreted the codebase to construct this // changes how we may have interpreted the codebase to construct this
@@ -1995,6 +2040,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
this)); this));
stateInvalid = true; stateInvalid = true;
} }
#endif
} }
} else if (newChannel) { } else if (newChannel) {
LOG(("OBJLC [%p]: We failed to open a channel, marking invalid", this)); LOG(("OBJLC [%p]: We failed to open a channel, marking invalid", this));
@@ -2107,6 +2153,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::InitializeFromChannel(nsIRequest *aChannel) nsObjectLoadingContent::InitializeFromChannel(nsIRequest *aChannel)
{ {
#ifdef MOZ_ENABLE_NPAPI
LOG(("OBJLC [%p] InitializeFromChannel: %p", this, aChannel)); LOG(("OBJLC [%p] InitializeFromChannel: %p", this, aChannel));
if (mType != eType_Loading || mChannel) { if (mType != eType_Loading || mChannel) {
// We could technically call UnloadObject() here, if consumers have a valid // We could technically call UnloadObject() here, if consumers have a valid
@@ -2127,6 +2174,7 @@ nsObjectLoadingContent::InitializeFromChannel(nsIRequest *aChannel)
// OnStartRequest will now see we have a channel in the loading state, and // OnStartRequest will now see we have a channel in the loading state, and
// call into LoadObject. There's a possibility LoadObject will decide not to // call into LoadObject. There's a possibility LoadObject will decide not to
// load anything from a channel - it will call CloseChannel() in that case. // load anything from a channel - it will call CloseChannel() in that case.
#endif
return NS_OK; return NS_OK;
} }
@@ -2257,9 +2305,11 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
if (mType != eType_Null) { if (mType != eType_Null) {
bool allowLoad = true; bool allowLoad = true;
#ifdef MOZ_ENABLE_NPAPI
if (IsJavaMIME(mContentType)) { if (IsJavaMIME(mContentType)) {
allowLoad = CheckJavaCodebase(); allowLoad = CheckJavaCodebase();
} }
#endif
int16_t contentPolicy = nsIContentPolicy::ACCEPT; int16_t contentPolicy = nsIContentPolicy::ACCEPT;
// If mChannelLoaded is set we presumably already passed load policy // If mChannelLoaded is set we presumably already passed load policy
// If mType == eType_Loading then we call OpenChannel() which internally // If mType == eType_Loading then we call OpenChannel() which internally
@@ -2734,7 +2784,7 @@ nsObjectLoadingContent::UnloadObject(bool aResetState)
mInstantiating = false; mInstantiating = false;
mScriptRequested = false; mScriptRequested = false;
#ifdef MOZ_ENABLE_NPAPI
if (mIsStopping) { if (mIsStopping) {
// The protochain is normally thrown out after a plugin stops, but if we // The protochain is normally thrown out after a plugin stops, but if we
// re-enter while stopping a plugin and try to load something new, we need // re-enter while stopping a plugin and try to load something new, we need
@@ -2742,6 +2792,9 @@ nsObjectLoadingContent::UnloadObject(bool aResetState)
TeardownProtoChain(); TeardownProtoChain();
mIsStopping = false; mIsStopping = false;
} }
#else
mIsStopping = false;
#endif
mCachedAttributes.Clear(); mCachedAttributes.Clear();
mCachedParameters.Clear(); mCachedParameters.Clear();
@@ -2840,6 +2893,7 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
return eType_Document; return eType_Document;
} }
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if ((caps & eSupportPlugins) && if ((caps & eSupportPlugins) &&
pluginHost && pluginHost &&
@@ -2847,10 +2901,12 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
// ShouldPlay will handle checking for disabled plugins // ShouldPlay will handle checking for disabled plugins
return eType_Plugin; return eType_Plugin;
} }
#endif
return eType_Null; return eType_Null;
} }
#ifdef MOZ_ENABLE_NPAPI
nsPluginFrame* nsPluginFrame*
nsObjectLoadingContent::GetExistingFrame() nsObjectLoadingContent::GetExistingFrame()
{ {
@@ -2859,6 +2915,7 @@ nsObjectLoadingContent::GetExistingFrame()
nsIObjectFrame* objFrame = do_QueryFrame(frame); nsIObjectFrame* objFrame = do_QueryFrame(frame);
return static_cast<nsPluginFrame*>(objFrame); return static_cast<nsPluginFrame*>(objFrame);
} }
#endif
void void
nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
@@ -2866,12 +2923,14 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
nsImageLoadingContent::CreateStaticImageClone(aDest); nsImageLoadingContent::CreateStaticImageClone(aDest);
aDest->mType = mType; aDest->mType = mType;
#ifdef MOZ_ENABLE_NPAPI
nsObjectLoadingContent* thisObj = const_cast<nsObjectLoadingContent*>(this); nsObjectLoadingContent* thisObj = const_cast<nsObjectLoadingContent*>(this);
if (thisObj->mPrintFrame.IsAlive()) { if (thisObj->mPrintFrame.IsAlive()) {
aDest->mPrintFrame = thisObj->mPrintFrame; aDest->mPrintFrame = thisObj->mPrintFrame;
} else { } else {
aDest->mPrintFrame = const_cast<nsObjectLoadingContent*>(this)->GetExistingFrame(); aDest->mPrintFrame = const_cast<nsObjectLoadingContent*>(this)->GetExistingFrame();
} }
#endif
if (mFrameLoader) { if (mFrameLoader) {
nsCOMPtr<nsIContent> content = nsCOMPtr<nsIContent> content =
@@ -2887,13 +2946,18 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::GetPrintFrame(nsIFrame** aFrame) nsObjectLoadingContent::GetPrintFrame(nsIFrame** aFrame)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aFrame = mPrintFrame.GetFrame(); *aFrame = mPrintFrame.GetFrame();
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::PluginDestroyed() nsObjectLoadingContent::PluginDestroyed()
{ {
#ifdef MOZ_ENABLE_NPAPI
// Called when our plugin is destroyed from under us, usually when reloading // Called when our plugin is destroyed from under us, usually when reloading
// plugins in plugin host. Invalidate instance owner / prototype but otherwise // plugins in plugin host. Invalidate instance owner / prototype but otherwise
// don't take any action. // don't take any action.
@@ -2902,6 +2966,7 @@ nsObjectLoadingContent::PluginDestroyed()
mInstanceOwner->Destroy(); mInstanceOwner->Destroy();
mInstanceOwner = nullptr; mInstanceOwner = nullptr;
} }
#endif
return NS_OK; return NS_OK;
} }
@@ -2911,6 +2976,7 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
const nsAString& browserDumpID, const nsAString& browserDumpID,
bool submittedCrashReport) bool submittedCrashReport)
{ {
#ifdef MOZ_ENABLE_NPAPI
LOG(("OBJLC [%p]: Plugin Crashed, queuing crash event", this)); LOG(("OBJLC [%p]: Plugin Crashed, queuing crash event", this));
NS_ASSERTION(mType == eType_Plugin, "PluginCrashed at non-plugin type"); NS_ASSERTION(mType == eType_Plugin, "PluginCrashed at non-plugin type");
@@ -2946,9 +3012,11 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("failed to dispatch nsPluginCrashedEvent"); NS_WARNING("failed to dispatch nsPluginCrashedEvent");
} }
#endif
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx, nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx,
nsNPAPIPluginInstance **aResult) nsNPAPIPluginInstance **aResult)
@@ -2991,6 +3059,7 @@ nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx,
SyncStartPluginInstance(); SyncStartPluginInstance();
} }
if (mInstanceOwner) { if (mInstanceOwner) {
return mInstanceOwner->GetInstance(aResult); return mInstanceOwner->GetInstance(aResult);
} }
@@ -2998,10 +3067,12 @@ nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx,
// Note that returning a null plugin is expected (and happens often) // Note that returning a null plugin is expected (and happens often)
return NS_OK; return NS_OK;
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::SyncStartPluginInstance() nsObjectLoadingContent::SyncStartPluginInstance()
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(), NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
"Must be able to run script in order to instantiate a plugin instance!"); "Must be able to run script in order to instantiate a plugin instance!");
@@ -3017,11 +3088,15 @@ nsObjectLoadingContent::SyncStartPluginInstance()
mozilla::Unused << kungFuURIGrip; // This URI is not referred to within this function mozilla::Unused << kungFuURIGrip; // This URI is not referred to within this function
nsCString contentType(mContentType); nsCString contentType(mContentType);
return InstantiatePluginInstance(); return InstantiatePluginInstance();
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::AsyncStartPluginInstance() nsObjectLoadingContent::AsyncStartPluginInstance()
{ {
#ifdef MOZ_ENABLE_NPAPI
// OK to have an instance already or a pending spawn. // OK to have an instance already or a pending spawn.
if (mInstanceOwner || mPendingInstantiateEvent) { if (mInstanceOwner || mPendingInstantiateEvent) {
return NS_OK; return NS_OK;
@@ -3042,6 +3117,9 @@ nsObjectLoadingContent::AsyncStartPluginInstance()
} }
return rv; return rv;
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -3051,6 +3129,7 @@ nsObjectLoadingContent::GetSrcURI(nsIURI** aURI)
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
static bool static bool
DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner, DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner,
nsObjectLoadingContent* aContent, nsObjectLoadingContent* aContent,
@@ -3073,6 +3152,7 @@ DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner,
} }
return false; return false;
} }
#endif
void void
nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) { nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
@@ -3136,6 +3216,7 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
NotifyStateChanged(oldType, oldState, false, true); NotifyStateChanged(oldType, oldState, false, true);
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner,
bool aDelayedStop, bool aDelayedStop,
@@ -3180,6 +3261,7 @@ nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner,
TeardownProtoChain(); TeardownProtoChain();
mIsStopping = false; mIsStopping = false;
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::StopPluginInstance() nsObjectLoadingContent::StopPluginInstance()
@@ -3193,6 +3275,7 @@ nsObjectLoadingContent::StopPluginInstance()
// InstantiatePluginInstance's re-entrance check to destroy the created plugin // InstantiatePluginInstance's re-entrance check to destroy the created plugin
mInstantiating = false; mInstantiating = false;
#ifdef MOZ_ENABLE_NPAPI
if (!mInstanceOwner) { if (!mInstanceOwner) {
return NS_OK; return NS_OK;
} }
@@ -3212,7 +3295,7 @@ nsObjectLoadingContent::StopPluginInstance()
mInstanceOwner->SetFrame(nullptr); mInstanceOwner->SetFrame(nullptr);
bool delayedStop = false; bool delayedStop = false;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// Force delayed stop for Real plugin only; see bug 420886, 426852. // Force delayed stop for Real plugin only; see bug 420886, 426852.
RefPtr<nsNPAPIPluginInstance> inst; RefPtr<nsNPAPIPluginInstance> inst;
mInstanceOwner->GetInstance(getter_AddRefs(inst)); mInstanceOwner->GetInstance(getter_AddRefs(inst));
@@ -3233,9 +3316,11 @@ nsObjectLoadingContent::StopPluginInstance()
// This can/will re-enter // This can/will re-enter
DoStopPlugin(ownerGrip, delayedStop); DoStopPlugin(ownerGrip, delayedStop);
#endif // MOZ_ENABLE_NPAPI
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsObjectLoadingContent::NotifyContentObjectWrapper() nsObjectLoadingContent::NotifyContentObjectWrapper()
{ {
@@ -3255,10 +3340,12 @@ nsObjectLoadingContent::NotifyContentObjectWrapper()
SetupProtoChain(cx, obj); SetupProtoChain(cx, obj);
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::PlayPlugin() nsObjectLoadingContent::PlayPlugin()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!nsContentUtils::IsCallerChrome()) if (!nsContentUtils::IsCallerChrome())
return NS_OK; return NS_OK;
@@ -3273,6 +3360,7 @@ nsObjectLoadingContent::PlayPlugin()
if (mType == eType_Null && mFallbackType >= eFallbackClickToPlay) { if (mType == eType_Null && mFallbackType >= eFallbackClickToPlay) {
return LoadObject(true, true); return LoadObject(true, true);
} }
#endif
return NS_OK; return NS_OK;
} }
@@ -3316,9 +3404,13 @@ nsObjectLoadingContent::DefaultFallbackType()
NS_IMETHODIMP NS_IMETHODIMP
nsObjectLoadingContent::GetHasRunningPlugin(bool *aHasPlugin) nsObjectLoadingContent::GetHasRunningPlugin(bool *aHasPlugin)
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
*aHasPlugin = HasRunningPlugin(); *aHasPlugin = HasRunningPlugin();
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -3364,10 +3456,11 @@ nsObjectLoadingContent::ShouldBlockContent()
if (!sPrefsInitialized) { if (!sPrefsInitialized) {
initializeObjectLoadingContentPrefs(); initializeObjectLoadingContentPrefs();
} }
#ifdef MOZ_ENABLE_NPAPI
if (mContentBlockingEnabled && mURI && IsFlashMIME(mContentType) && sBlockURIs ) { if (mContentBlockingEnabled && mURI && IsFlashMIME(mContentType) && sBlockURIs ) {
return true; return true;
} }
#endif
return false; return false;
} }
@@ -3375,6 +3468,7 @@ nsObjectLoadingContent::ShouldBlockContent()
bool bool
nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentType) nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentType)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsresult rv; nsresult rv;
if (!sPrefsInitialized) { if (!sPrefsInitialized) {
@@ -3514,10 +3608,14 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentTyp
return false; return false;
} }
MOZ_CRASH("Unexpected enabledState"); MOZ_CRASH("Unexpected enabledState");
#else
return true;
#endif
} }
bool bool
nsObjectLoadingContent::FavorFallbackMode(bool aIsPluginClickToPlay) { nsObjectLoadingContent::FavorFallbackMode(bool aIsPluginClickToPlay) {
#ifdef MOZ_ENABLE_NPAPI
if (!IsFlashMIME(mContentType)) { if (!IsFlashMIME(mContentType)) {
return false; return false;
} }
@@ -3533,7 +3631,7 @@ nsObjectLoadingContent::FavorFallbackMode(bool aIsPluginClickToPlay) {
return true; return true;
} }
} }
#endif
return false; return false;
} }
@@ -3684,6 +3782,7 @@ nsObjectLoadingContent::LegacyCall(JSContext* aCx,
JS::MutableHandle<JS::Value> aRetval, JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aRv) ErrorResult& aRv)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIContent> thisContent = nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this)); do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
JS::Rooted<JSObject*> obj(aCx, thisContent->GetWrapper()); JS::Rooted<JSObject*> obj(aCx, thisContent->GetWrapper());
@@ -3757,8 +3856,12 @@ nsObjectLoadingContent::LegacyCall(JSContext* aCx,
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
} }
#else
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsObjectLoadingContent::SetupProtoChain(JSContext* aCx, nsObjectLoadingContent::SetupProtoChain(JSContext* aCx,
JS::Handle<JSObject*> aObject) JS::Handle<JSObject*> aObject)
@@ -3947,6 +4050,7 @@ nsObjectLoadingContent::TeardownProtoChain()
obj = proto; obj = proto;
} }
} }
#endif
bool bool
nsObjectLoadingContent::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject, nsObjectLoadingContent::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
@@ -3955,12 +4059,13 @@ nsObjectLoadingContent::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
{ {
// We don't resolve anything; we just try to make sure we're instantiated. // We don't resolve anything; we just try to make sure we're instantiated.
// This purposefully does not fire for chrome/xray resolves, see bug 967694 // This purposefully does not fire for chrome/xray resolves, see bug 967694
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsNPAPIPluginInstance> pi; RefPtr<nsNPAPIPluginInstance> pi;
nsresult rv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi)); nsresult rv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return mozilla::dom::Throw(aCx, rv); return mozilla::dom::Throw(aCx, rv);
} }
#endif
return true; return true;
} }
@@ -3977,11 +4082,13 @@ nsObjectLoadingContent::GetOwnPropertyNames(JSContext* aCx,
nsTArray<nsString>& /* unused */, nsTArray<nsString>& /* unused */,
ErrorResult& aRv) ErrorResult& aRv)
{ {
#ifdef MOZ_ENABLE_NPAPI
// Just like DoResolve, just make sure we're instantiated. That will do // Just like DoResolve, just make sure we're instantiated. That will do
// the work our Enumerate hook needs to do. This purposefully does not fire // the work our Enumerate hook needs to do. This purposefully does not fire
// for xray resolves, see bug 967694 // for xray resolves, see bug 967694
RefPtr<nsNPAPIPluginInstance> pi; RefPtr<nsNPAPIPluginInstance> pi;
aRv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi)); aRv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi));
#endif
} }
void void
@@ -4000,6 +4107,7 @@ nsObjectLoadingContent::MaybeFireErrorEvent()
} }
} }
#ifdef MOZ_ENABLE_NPAPI
// SetupProtoChainRunner implementation // SetupProtoChainRunner implementation
nsObjectLoadingContent::SetupProtoChainRunner::SetupProtoChainRunner( nsObjectLoadingContent::SetupProtoChainRunner::SetupProtoChainRunner(
nsObjectLoadingContent* aContent) nsObjectLoadingContent* aContent)
@@ -4032,3 +4140,4 @@ nsObjectLoadingContent::SetupProtoChainRunner::Run()
} }
NS_IMPL_ISUPPORTS(nsObjectLoadingContent::SetupProtoChainRunner, nsIRunnable) NS_IMPL_ISUPPORTS(nsObjectLoadingContent::SetupProtoChainRunner, nsIRunnable)
#endif
+20 -4
View File
@@ -30,7 +30,9 @@ class nsIPrincipal;
class nsFrameLoader; class nsFrameLoader;
class nsPluginFrame; class nsPluginFrame;
class nsXULElement; class nsXULElement;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginInstanceOwner; class nsPluginInstanceOwner;
#endif
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@@ -161,10 +163,12 @@ class nsObjectLoadingContent : public nsImageLoadingContent
* that our plug-in, if any, is instantiated. * that our plug-in, if any, is instantiated.
*/ */
// Helper for WebIDL node wrapping // Helper for WebIDL node wrapping
#ifdef MOZ_ENABLE_NPAPI
void SetupProtoChain(JSContext* aCx, JS::Handle<JSObject*> aObject); void SetupProtoChain(JSContext* aCx, JS::Handle<JSObject*> aObject);
// Remove plugin from protochain // Remove plugin from protochain
void TeardownProtoChain(); void TeardownProtoChain();
#endif
// Helper for WebIDL NeedResolve // Helper for WebIDL NeedResolve
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject, bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
@@ -194,7 +198,11 @@ class nsObjectLoadingContent : public nsImageLoadingContent
} }
void PlayPlugin(mozilla::ErrorResult& aRv) void PlayPlugin(mozilla::ErrorResult& aRv)
{ {
#ifdef MOZ_ENABLE_NPAPI
aRv = PlayPlugin(); aRv = PlayPlugin();
#else
return;
#endif
} }
void Reload(bool aClearActivation, mozilla::ErrorResult& aRv) void Reload(bool aClearActivation, mozilla::ErrorResult& aRv)
{ {
@@ -219,10 +227,12 @@ class nsObjectLoadingContent : public nsImageLoadingContent
{ {
return mFallbackType; return mFallbackType;
} }
#ifdef MOZ_ENABLE_NPAPI
bool HasRunningPlugin() const bool HasRunningPlugin() const
{ {
return !!mInstanceOwner; return !!mInstanceOwner;
} }
#endif
void SwapFrameLoaders(mozilla::dom::HTMLIFrameElement& aOtherLoaderOwner, void SwapFrameLoaders(mozilla::dom::HTMLIFrameElement& aOtherLoaderOwner,
mozilla::ErrorResult& aRv) mozilla::ErrorResult& aRv)
{ {
@@ -330,8 +340,10 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void CreateStaticClone(nsObjectLoadingContent* aDest) const; void CreateStaticClone(nsObjectLoadingContent* aDest) const;
#ifdef MOZ_ENABLE_NPAPI
void DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, bool aDelayedStop, void DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, bool aDelayedStop,
bool aForcedReentry = false); bool aForcedReentry = false);
#endif
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent, nsIContent* aBindingParent,
@@ -434,8 +446,9 @@ class nsObjectLoadingContent : public nsImageLoadingContent
* Queue a CheckPluginStopEvent and track it in mPendingCheckPluginStopEvent * Queue a CheckPluginStopEvent and track it in mPendingCheckPluginStopEvent
*/ */
void QueueCheckPluginStopEvent(); void QueueCheckPluginStopEvent();
#ifdef MOZ_ENABLE_NPAPI
void NotifyContentObjectWrapper(); void NotifyContentObjectWrapper();
#endif
/** /**
* Opens the channel pointed to by mURI into mChannel. * Opens the channel pointed to by mURI into mChannel.
@@ -586,7 +599,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void MaybeRewriteYoutubeEmbed(nsIURI* aURI, void MaybeRewriteYoutubeEmbed(nsIURI* aURI,
nsIURI* aBaseURI, nsIURI* aBaseURI,
nsIURI** aRewrittenURI); nsIURI** aRewrittenURI);
#ifdef MOZ_ENABLE_NPAPI
// Helper class for SetupProtoChain // Helper class for SetupProtoChain
class SetupProtoChainRunner final : public nsIRunnable class SetupProtoChainRunner final : public nsIRunnable
{ {
@@ -614,7 +627,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
nsNPAPIPluginInstance *plugin_inst, nsNPAPIPluginInstance *plugin_inst,
JS::MutableHandle<JSObject*> plugin_obj, JS::MutableHandle<JSObject*> plugin_obj,
JS::MutableHandle<JSObject*> plugin_proto); JS::MutableHandle<JSObject*> plugin_proto);
#endif
// Utility for firing an error event, if we're an <object>. // Utility for firing an error event, if we're an <object>.
void MaybeFireErrorEvent(); void MaybeFireErrorEvent();
@@ -711,8 +724,11 @@ class nsObjectLoadingContent : public nsImageLoadingContent
bool mPreferFallbackKnown : 1; bool mPreferFallbackKnown : 1;
nsWeakFrame mPrintFrame; nsWeakFrame mPrintFrame;
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPluginInstanceOwner> mInstanceOwner; RefPtr<nsPluginInstanceOwner> mInstanceOwner;
#else
bool mInstanceOwner = false;
#endif
nsTArray<mozilla::dom::MozPluginParameter> mCachedAttributes; nsTArray<mozilla::dom::MozPluginParameter> mCachedAttributes;
nsTArray<mozilla::dom::MozPluginParameter> mCachedParameters; nsTArray<mozilla::dom::MozPluginParameter> mCachedParameters;
}; };
+2 -1
View File
@@ -2234,7 +2234,7 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
MOZ_CRASH(); MOZ_CRASH();
} }
} }
#ifdef MOZ_ENABLE_NPAPI
JS::Rooted<JSObject*> maybeObjLC(aCx, aObj); JS::Rooted<JSObject*> maybeObjLC(aCx, aObj);
nsObjectLoadingContent* htmlobject; nsObjectLoadingContent* htmlobject;
nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, &maybeObjLC, htmlobject); nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, &maybeObjLC, htmlobject);
@@ -2252,6 +2252,7 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
if (htmlobject) { if (htmlobject) {
htmlobject->SetupProtoChain(aCx, aObj); htmlobject->SetupProtoChain(aCx, aObj);
} }
#endif
} }
GlobalObject::GlobalObject(JSContext* aCx, JSObject* aObject) GlobalObject::GlobalObject(JSContext* aCx, JSObject* aObject)
+12 -1
View File
@@ -51,7 +51,9 @@
#include "nsIContentViewer.h" #include "nsIContentViewer.h"
#include "nsFrameManager.h" #include "nsFrameManager.h"
#include "nsITabChild.h" #include "nsITabChild.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsMenuPopupFrame.h" #include "nsMenuPopupFrame.h"
#include "nsIDOMXULElement.h" #include "nsIDOMXULElement.h"
@@ -2440,6 +2442,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
// hasn't moved. // hasn't moved.
nsIFrame* lastScrollFrame = WheelTransaction::GetTargetFrame(); nsIFrame* lastScrollFrame = WheelTransaction::GetTargetFrame();
if (lastScrollFrame) { if (lastScrollFrame) {
#ifdef MOZ_ENABLE_NPAPI
if (aOptions & INCLUDE_PLUGIN_AS_TARGET) { if (aOptions & INCLUDE_PLUGIN_AS_TARGET) {
nsPluginFrame* pluginFrame = do_QueryFrame(lastScrollFrame); nsPluginFrame* pluginFrame = do_QueryFrame(lastScrollFrame);
if (pluginFrame && if (pluginFrame &&
@@ -2447,6 +2450,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
return lastScrollFrame; return lastScrollFrame;
} }
} }
#endif
nsIScrollableFrame* scrollableFrame = nsIScrollableFrame* scrollableFrame =
lastScrollFrame->GetScrollTargetFrame(); lastScrollFrame->GetScrollTargetFrame();
if (scrollableFrame) { if (scrollableFrame) {
@@ -2476,6 +2480,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
// Check whether the frame wants to provide us with a scrollable view. // Check whether the frame wants to provide us with a scrollable view.
nsIScrollableFrame* scrollableFrame = scrollFrame->GetScrollTargetFrame(); nsIScrollableFrame* scrollableFrame = scrollFrame->GetScrollTargetFrame();
if (!scrollableFrame) { if (!scrollableFrame) {
#ifdef MOZ_ENABLE_NPAPI
// If the frame is a plugin frame, then, the plugin content may handle // If the frame is a plugin frame, then, the plugin content may handle
// wheel events. Only when the caller computes the scroll target for // wheel events. Only when the caller computes the scroll target for
// default action handling, we should assume the plugin frame as // default action handling, we should assume the plugin frame as
@@ -2488,6 +2493,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
return scrollFrame; return scrollFrame;
} }
} }
#endif
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(scrollFrame); nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(scrollFrame);
if (menuPopupFrame) { if (menuPopupFrame) {
return nullptr; return nullptr;
@@ -3213,11 +3219,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsIFrame* frameToScroll = nsIFrame* frameToScroll =
ComputeScrollTarget(mCurrentTarget, wheelEvent, ComputeScrollTarget(mCurrentTarget, wheelEvent,
COMPUTE_DEFAULT_ACTION_TARGET); COMPUTE_DEFAULT_ACTION_TARGET);
#ifdef MOZ_ENABLE_NPAPI
nsPluginFrame* pluginFrame = do_QueryFrame(frameToScroll); nsPluginFrame* pluginFrame = do_QueryFrame(frameToScroll);
#endif
// When APZ is enabled, the actual scroll animation might be handled by // When APZ is enabled, the actual scroll animation might be handled by
// the compositor. // the compositor.
WheelPrefs::Action action; WheelPrefs::Action action;
#ifdef MOZ_ENABLE_NPAPI
if (pluginFrame) { if (pluginFrame) {
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction()); MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
action = WheelPrefs::ACTION_SEND_TO_PLUGIN; action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
@@ -3226,6 +3234,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
} else { } else {
action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent); action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
} }
#endif
switch (action) { switch (action) {
case WheelPrefs::ACTION_HSCROLL: { case WheelPrefs::ACTION_HSCROLL: {
// Swap axes and fall through // Swap axes and fall through
@@ -3288,6 +3297,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
DoScrollZoom(mCurrentTarget, intDelta); DoScrollZoom(mCurrentTarget, intDelta);
break; break;
} }
#ifdef MOZ_ENABLE_NPAPI
case WheelPrefs::ACTION_SEND_TO_PLUGIN: case WheelPrefs::ACTION_SEND_TO_PLUGIN:
MOZ_ASSERT(pluginFrame); MOZ_ASSERT(pluginFrame);
@@ -3305,6 +3315,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
pluginFrame->HandleWheelEventAsDefaultAction(wheelEvent); pluginFrame->HandleWheelEventAsDefaultAction(wheelEvent);
break; break;
#endif
case WheelPrefs::ACTION_NONE: case WheelPrefs::ACTION_NONE:
default: default:
bool allDeltaOverflown = false; bool allDeltaOverflown = false;
+4 -1
View File
@@ -28,7 +28,9 @@
#define Comment _Comment #define Comment _Comment
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
#undef TextRange #undef TextRange
@@ -147,9 +149,10 @@ TextComposition::DispatchEvent(WidgetCompositionEvent* aDispatchEvent,
EventDispatchingCallback* aCallBack, EventDispatchingCallback* aCallBack,
const WidgetCompositionEvent *aOriginalEvent) const WidgetCompositionEvent *aOriginalEvent)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsPluginInstanceOwner::GeneratePluginEvent(aOriginalEvent, nsPluginInstanceOwner::GeneratePluginEvent(aOriginalEvent,
aDispatchEvent); aDispatchEvent);
#endif
EventDispatcher::Dispatch(mNode, mPresContext, EventDispatcher::Dispatch(mNode, mPresContext,
aDispatchEvent, nullptr, aStatus, aCallBack); aDispatchEvent, nullptr, aStatus, aCallBack);
+9
View File
@@ -16,7 +16,9 @@
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "nsITimer.h" #include "nsITimer.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsPresContext.h" #include "nsPresContext.h"
#include "prtime.h" #include "prtime.h"
#include "Units.h" #include "Units.h"
@@ -51,11 +53,18 @@ WheelHandlingUtils::CanScrollOn(nsIFrame* aFrame,
double aDirectionX, double aDirectionY) double aDirectionX, double aDirectionY)
{ {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aFrame); nsIScrollableFrame* scrollableFrame = do_QueryFrame(aFrame);
#ifdef MOZ_ENABLE_NPAPI
if (scrollableFrame) { if (scrollableFrame) {
return CanScrollOn(scrollableFrame, aDirectionX, aDirectionY); return CanScrollOn(scrollableFrame, aDirectionX, aDirectionY);
} }
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame); nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
return pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction(); return pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction();
#else
if (!scrollableFrame) {
return false;
}
return CanScrollOn(scrollableFrame, aDirectionX, aDirectionY);
#endif
} }
/* static */ bool /* static */ bool
+14 -1
View File
@@ -12,10 +12,14 @@
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsError.h" #include "nsError.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginDocument.h" #include "nsIPluginDocument.h"
#endif
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIObjectFrame.h" #include "nsIObjectFrame.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#endif
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#ifdef XP_MACOSX #ifdef XP_MACOSX
@@ -267,8 +271,11 @@ HTMLObjectElement::BindToTree(nsIDocument *aDocument,
// Don't kick off load from being bound to a plugin document - the plugin // Don't kick off load from being bound to a plugin document - the plugin
// document will call nsObjectLoadingContent::InitializeFromChannel() for the // document will call nsObjectLoadingContent::InitializeFromChannel() for the
// initial load. // initial load.
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument); nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument);
#else
bool pluginDoc = false;
#endif
// If we already have all the children, start the load. // If we already have all the children, start the load.
if (mIsDoneAddingChildren && !pluginDoc) { if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad; void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
@@ -424,6 +431,7 @@ HTMLObjectElement::Reset()
NS_IMETHODIMP NS_IMETHODIMP
HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission) HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsAutoString name; nsAutoString name;
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) { if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
// No name, don't submit. // No name, don't submit.
@@ -450,6 +458,9 @@ HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission)
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return aFormSubmission->AddNameValuePair(name, value); return aFormSubmission->AddNameValuePair(name, value);
#else
return NS_OK;
#endif
} }
NS_IMPL_STRING_ATTR(HTMLObjectElement, Align, align) NS_IMPL_STRING_ATTR(HTMLObjectElement, Align, align)
@@ -600,7 +611,9 @@ HTMLObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
if (!obj) { if (!obj) {
return nullptr; return nullptr;
} }
#ifdef MOZ_ENABLE_NPAPI
SetupProtoChain(aCx, obj); SetupProtoChain(aCx, obj);
#endif
return obj; return obj;
} }
+10 -1
View File
@@ -10,7 +10,9 @@
#include "mozilla/dom/ElementInlines.h" #include "mozilla/dom/ElementInlines.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginDocument.h" #include "nsIPluginDocument.h"
#endif
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
@@ -132,8 +134,11 @@ HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
// Don't kick off load from being bound to a plugin document - the plugin // Don't kick off load from being bound to a plugin document - the plugin
// document will call nsObjectLoadingContent::InitializeFromChannel() for the // document will call nsObjectLoadingContent::InitializeFromChannel() for the
// initial load. // initial load.
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument); nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument);
#else
bool pluginDoc = false;
#endif
// If we already have all the children, start the load. // If we already have all the children, start the load.
if (mIsDoneAddingChildren && !pluginDoc) { if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLSharedObjectElement::*start)() = void (HTMLSharedObjectElement::*start)() =
@@ -391,6 +396,7 @@ HTMLSharedObjectElement::CopyInnerTo(Element* aDest)
JSObject* JSObject*
HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{ {
#ifdef MOZ_ENABLE_NPAPI
JSObject* obj; JSObject* obj;
if (mNodeInfo->Equals(nsGkAtoms::applet)) { if (mNodeInfo->Equals(nsGkAtoms::applet)) {
obj = HTMLAppletElementBinding::Wrap(aCx, this, aGivenProto); obj = HTMLAppletElementBinding::Wrap(aCx, this, aGivenProto);
@@ -404,6 +410,9 @@ HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenPr
JS::Rooted<JSObject*> rootedObj(aCx, obj); JS::Rooted<JSObject*> rootedObj(aCx, obj);
SetupProtoChain(aCx, rootedObj); SetupProtoChain(aCx, rootedObj);
return rootedObj; return rootedObj;
#else
return HTMLEmbedElementBinding::Wrap(aCx, this, aGivenProto);
#endif
} }
nsContentPolicyType nsContentPolicyType
+5 -4
View File
@@ -210,10 +210,11 @@ UNIFIED_SOURCES += [
'VideoDocument.cpp', 'VideoDocument.cpp',
] ]
SOURCES += [ if CONFIG['MOZ_ENABLE_NPAPI']:
# Includes npapi.h. SOURCES += [
'PluginDocument.cpp', # Includes npapi.h.
] 'PluginDocument.cpp',
]
EXTRA_COMPONENTS += [ EXTRA_COMPONENTS += [
'htmlMenuBuilder.js', 'htmlMenuBuilder.js',
+2
View File
@@ -39,7 +39,9 @@ class nsHTMLDocument : public nsDocument,
{ {
public: public:
using nsDocument::SetDocumentURI; using nsDocument::SetDocumentURI;
#ifdef MOZ_ENABLE_NPAPI
using nsDocument::GetPlugins; using nsDocument::GetPlugins;
#endif
nsHTMLDocument(); nsHTMLDocument();
virtual nsresult Init() override; virtual nsresult Init() override;
@@ -1661,6 +1661,7 @@ interface nsIDOMWindowUtils : nsISupports {
* Will throw a DOM security error if called without chrome privileges. * Will throw a DOM security error if called without chrome privileges.
* *
*/ */
[implicit_jscontext] [implicit_jscontext]
readonly attribute jsval plugins; readonly attribute jsval plugins;
+7 -2
View File
@@ -51,8 +51,10 @@
#include "mozilla/layout/RenderFrameChild.h" #include "mozilla/layout/RenderFrameChild.h"
#include "mozilla/net/NeckoChild.h" #include "mozilla/net/NeckoChild.h"
#include "mozilla/net/CaptivePortalService.h" #include "mozilla/net/CaptivePortalService.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginInstanceParent.h" #include "mozilla/plugins/PluginInstanceParent.h"
#include "mozilla/plugins/PluginModuleParent.h" #include "mozilla/plugins/PluginModuleParent.h"
#endif
#include "mozilla/widget/WidgetMessageUtils.h" #include "mozilla/widget/WidgetMessageUtils.h"
#include "nsBaseDragService.h" #include "nsBaseDragService.h"
#include "mozilla/media/MediaChild.h" #include "mozilla/media/MediaChild.h"
@@ -1104,13 +1106,14 @@ ContentChild::DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* /* a
// this point, so we shouldn't touch the actor in any case. // this point, so we shouldn't touch the actor in any case.
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
mozilla::plugins::PPluginModuleParent* mozilla::plugins::PPluginModuleParent*
ContentChild::AllocPPluginModuleParent(mozilla::ipc::Transport* aTransport, ContentChild::AllocPPluginModuleParent(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherProcess) base::ProcessId aOtherProcess)
{ {
return plugins::PluginModuleContentParent::Initialize(aTransport, aOtherProcess); return plugins::PluginModuleContentParent::Initialize(aTransport, aOtherProcess);
} }
#endif
PContentBridgeChild* PContentBridgeChild*
ContentChild::AllocPContentBridgeChild(mozilla::ipc::Transport* aTransport, ContentChild::AllocPContentBridgeChild(mozilla::ipc::Transport* aTransport,
@@ -2336,6 +2339,7 @@ ContentChild::DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* actor)
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
ContentChild::RecvLoadPluginResult(const uint32_t& aPluginId, ContentChild::RecvLoadPluginResult(const uint32_t& aPluginId,
const bool& aResult) const bool& aResult)
@@ -2355,6 +2359,7 @@ ContentChild::RecvAssociatePluginId(const uint32_t& aPluginId,
plugins::PluginModuleContentParent::AssociatePluginId(aPluginId, aProcessId); plugins::PluginModuleContentParent::AssociatePluginId(aPluginId, aProcessId);
return true; return true;
} }
#endif
bool bool
ContentChild::RecvDomainSetChanged(const uint32_t& aSetType, ContentChild::RecvDomainSetChanged(const uint32_t& aSetType,
@@ -2516,7 +2521,7 @@ ContentChild::GetBrowserOrId(TabChild* aTabChild)
bool bool
ContentChild::RecvUpdateWindow(const uintptr_t& aChildId) ContentChild::RecvUpdateWindow(const uintptr_t& aChildId)
{ {
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
NS_ASSERTION(aChildId, "Expected child hwnd value for remote plugin instance."); NS_ASSERTION(aChildId, "Expected child hwnd value for remote plugin instance.");
mozilla::plugins::PluginInstanceParent* parentInstance = mozilla::plugins::PluginInstanceParent* parentInstance =
mozilla::plugins::PluginInstanceParent::LookupPluginInstanceByID(aChildId); mozilla::plugins::PluginInstanceParent::LookupPluginInstanceByID(aChildId);
+4 -4
View File
@@ -128,11 +128,11 @@ public:
} }
RefPtr<ContentBridgeParent> mLastBridge; RefPtr<ContentBridgeParent> mLastBridge;
#ifdef MOZ_ENABLE_NPAPI
PPluginModuleParent * PPluginModuleParent *
AllocPPluginModuleParent(mozilla::ipc::Transport* transport, AllocPPluginModuleParent(mozilla::ipc::Transport* transport,
base::ProcessId otherProcess) override; base::ProcessId otherProcess) override;
#endif
PContentBridgeParent* PContentBridgeParent*
AllocPContentBridgeParent(mozilla::ipc::Transport* transport, AllocPContentBridgeParent(mozilla::ipc::Transport* transport,
base::ProcessId otherProcess) override; base::ProcessId otherProcess) override;
@@ -427,13 +427,13 @@ public:
virtual bool RecvNotifyIdleObserver(const uint64_t& aObserver, virtual bool RecvNotifyIdleObserver(const uint64_t& aObserver,
const nsCString& aTopic, const nsCString& aTopic,
const nsString& aData) override; const nsString& aData) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool RecvAssociatePluginId(const uint32_t& aPluginId, virtual bool RecvAssociatePluginId(const uint32_t& aPluginId,
const base::ProcessId& aProcessId) override; const base::ProcessId& aProcessId) override;
virtual bool RecvLoadPluginResult(const uint32_t& aPluginId, virtual bool RecvLoadPluginResult(const uint32_t& aPluginId,
const bool& aResult) override; const bool& aResult) override;
#endif
virtual bool RecvUpdateWindow(const uintptr_t& aChildId) override; virtual bool RecvUpdateWindow(const uintptr_t& aChildId) override;
virtual bool RecvDomainSetChanged(const uint32_t& aSetType, virtual bool RecvDomainSetChanged(const uint32_t& aSetType,
+21 -2
View File
@@ -75,7 +75,9 @@
#include "mozilla/media/MediaParent.h" #include "mozilla/media/MediaParent.h"
#include "mozilla/Move.h" #include "mozilla/Move.h"
#include "mozilla/net/NeckoParent.h" #include "mozilla/net/NeckoParent.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginBridge.h" #include "mozilla/plugins/PluginBridge.h"
#endif
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/ProcessHangMonitor.h" #include "mozilla/ProcessHangMonitor.h"
#include "mozilla/ProcessHangMonitorIPC.h" #include "mozilla/ProcessHangMonitorIPC.h"
@@ -746,7 +748,7 @@ ContentParent::GetInitialProcessPriority(Element* aFrameElement)
return PROCESS_PRIORITY_FOREGROUND; return PROCESS_PRIORITY_FOREGROUND;
} }
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
extern const wchar_t* kPluginWidgetContentParentProperty; extern const wchar_t* kPluginWidgetContentParentProperty;
/*static*/ void /*static*/ void
@@ -764,7 +766,10 @@ ContentParent::SendAsyncUpdate(nsIWidget* aWidget)
Unused << cp->SendUpdateWindow((uintptr_t)hwnd); Unused << cp->SendUpdateWindow((uintptr_t)hwnd);
} }
} }
#endif // defined(XP_WIN) #elif defined(XP_WIN)
/*static*/ void
ContentParent::SendAsyncUpdate(nsIWidget* aWidget) {}
#endif
bool bool
ContentParent::PreallocatedProcessReady() ContentParent::PreallocatedProcessReady()
@@ -874,11 +879,16 @@ ContentParent::RecvCreateGMPService()
} }
#endif #endif
bool bool
ContentParent::RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID) ContentParent::RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aRv = NS_OK; *aRv = NS_OK;
return mozilla::plugins::SetupBridge(aPluginId, this, false, aRv, aRunID); return mozilla::plugins::SetupBridge(aPluginId, this, false, aRv, aRunID);
#else
return false;
#endif
} }
bool bool
@@ -901,6 +911,7 @@ ContentParent::RecvRemovePermission(const IPC::Principal& aPrincipal,
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
ContentParent::RecvConnectPluginBridge(const uint32_t& aPluginId, nsresult* aRv) ContentParent::RecvConnectPluginBridge(const uint32_t& aPluginId, nsresult* aRv)
{ {
@@ -911,14 +922,17 @@ ContentParent::RecvConnectPluginBridge(const uint32_t& aPluginId, nsresult* aRv)
uint32_t dummy = 0; uint32_t dummy = 0;
return mozilla::plugins::SetupBridge(aPluginId, this, true, aRv, &dummy); return mozilla::plugins::SetupBridge(aPluginId, this, true, aRv, &dummy);
} }
#endif
bool bool
ContentParent::RecvGetBlocklistState(const uint32_t& aPluginId, ContentParent::RecvGetBlocklistState(const uint32_t& aPluginId,
uint32_t* aState) uint32_t* aState)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aState = nsIBlocklistService::STATE_BLOCKED; *aState = nsIBlocklistService::STATE_BLOCKED;
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if (!pluginHost) { if (!pluginHost) {
NS_WARNING("Plugin host not found"); NS_WARNING("Plugin host not found");
return false; return false;
@@ -932,8 +946,12 @@ ContentParent::RecvGetBlocklistState(const uint32_t& aPluginId,
} }
return NS_SUCCEEDED(tag->GetBlocklistState(aState)); return NS_SUCCEEDED(tag->GetBlocklistState(aState));
#else
return false;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch, ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch,
nsresult* aRv, nsresult* aRv,
@@ -943,6 +961,7 @@ ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch,
*aRv = mozilla::plugins::FindPluginsForContent(aPluginEpoch, aPlugins, aNewPluginEpoch); *aRv = mozilla::plugins::FindPluginsForContent(aPluginEpoch, aPlugins, aNewPluginEpoch);
return true; return true;
} }
#endif
/*static*/ TabParent* /*static*/ TabParent*
ContentParent::CreateBrowserOrApp(const TabContext& aContext, ContentParent::CreateBrowserOrApp(const TabContext& aContext,
+4 -3
View File
@@ -243,17 +243,18 @@ public:
virtual bool RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, virtual bool RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv,
uint32_t* aRunID) override; uint32_t* aRunID) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool RecvConnectPluginBridge(const uint32_t& aPluginId, virtual bool RecvConnectPluginBridge(const uint32_t& aPluginId,
nsresult* aRv) override; nsresult* aRv) override;
#endif
virtual bool RecvGetBlocklistState(const uint32_t& aPluginId, virtual bool RecvGetBlocklistState(const uint32_t& aPluginId,
uint32_t* aIsBlocklisted) override; uint32_t* aIsBlocklisted) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool RecvFindPlugins(const uint32_t& aPluginEpoch, virtual bool RecvFindPlugins(const uint32_t& aPluginEpoch,
nsresult* aRv, nsresult* aRv,
nsTArray<PluginTag>* aPlugins, nsTArray<PluginTag>* aPlugins,
uint32_t* aNewPluginEpoch) override; uint32_t* aNewPluginEpoch) override;
#endif
virtual bool RecvUngrabPointer(const uint32_t& aTime) override; virtual bool RecvUngrabPointer(const uint32_t& aTime) override;
+6
View File
@@ -12,7 +12,9 @@ include protocol PDocAccessible;
include protocol PFilePicker; include protocol PFilePicker;
include protocol PIndexedDBPermissionRequest; include protocol PIndexedDBPermissionRequest;
include protocol PRenderFrame; include protocol PRenderFrame;
#ifdef MOZ_ENABLE_NPAPI
include protocol PPluginWidget; include protocol PPluginWidget;
#endif
include protocol PRemotePrintJob; include protocol PRemotePrintJob;
include DOMTypes; include DOMTypes;
include JavaScriptTypes; include JavaScriptTypes;
@@ -118,7 +120,9 @@ nested(upto inside_cpow) sync protocol PBrowser
manages PFilePicker; manages PFilePicker;
manages PIndexedDBPermissionRequest; manages PIndexedDBPermissionRequest;
manages PRenderFrame; manages PRenderFrame;
#ifdef MOZ_ENABLE_NPAPI
manages PPluginWidget; manages PPluginWidget;
#endif
both: both:
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows, async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
@@ -147,7 +151,9 @@ parent:
* in e10s mode. This is always initiated from the child in response * in e10s mode. This is always initiated from the child in response
* to windowed plugin creation. * to windowed plugin creation.
*/ */
#ifdef MOZ_ENABLE_NPAPI
sync PPluginWidget(); sync PPluginWidget();
#endif
/** /**
* Return native data of root widget * Return native data of root widget
+11 -4
View File
@@ -31,7 +31,7 @@ include protocol PGMPContent;
include protocol PGMPService; include protocol PGMPService;
include protocol PPluginModule; include protocol PPluginModule;
include protocol PGMP; include protocol PGMP;
#else #elif MOZ_ENABLE_NPAPI
include protocol PPluginModule; include protocol PPluginModule;
#endif #endif
include protocol PPrinting; include protocol PPrinting;
@@ -52,7 +52,9 @@ include JavaScriptTypes;
include InputStreamParams; include InputStreamParams;
include PTabContext; include PTabContext;
include URIParams; include URIParams;
#ifdef MOZ_ENABLE_NPAPI
include PluginTypes; include PluginTypes;
#endif
include ProtocolTypes; include ProtocolTypes;
include PBackgroundSharedTypes; include PBackgroundSharedTypes;
include PContentPermission; include PContentPermission;
@@ -232,7 +234,9 @@ struct GMPCapabilityData
nested(upto inside_cpow) sync protocol PContent nested(upto inside_cpow) sync protocol PContent
{ {
#ifdef MOZ_ENABLE_NPAPI
parent spawns PPluginModule; parent spawns PPluginModule;
#endif
parent opens PProcessHangMonitor; parent opens PProcessHangMonitor;
#ifdef MOZ_GMP #ifdef MOZ_GMP
@@ -447,7 +451,7 @@ child:
* Notify idle observers in the child * Notify idle observers in the child
*/ */
async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str); async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Called during plugin initialization to map a plugin id to a child process * Called during plugin initialization to map a plugin id to a child process
* id. * id.
@@ -460,7 +464,7 @@ child:
* init has completed. * init has completed.
*/ */
async LoadPluginResult(uint32_t aPluginId, bool aResult); async LoadPluginResult(uint32_t aPluginId, bool aResult);
#endif
async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action); async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action);
async EndDragSession(bool aDoneDrag, bool aUserCancelled, async EndDragSession(bool aDoneDrag, bool aUserCancelled,
@@ -577,7 +581,9 @@ parent:
* the specified plugin id. When this call returns, the requested bridge * the specified plugin id. When this call returns, the requested bridge
* connection has been made. * connection has been made.
*/ */
#ifdef MOZ_ENABLE_NPAPI
sync ConnectPluginBridge(uint32_t aPluginId) returns (nsresult rv); sync ConnectPluginBridge(uint32_t aPluginId) returns (nsresult rv);
#endif
/** /**
* Return the current blocklist state for a particular plugin. * Return the current blocklist state for a particular plugin.
@@ -596,8 +602,9 @@ parent:
* process. |newPluginEpoch| is the current epoch in the chrome process. If * process. |newPluginEpoch| is the current epoch in the chrome process. If
* |pluginEpoch == newPluginEpoch|, then |plugins| will be left empty. * |pluginEpoch == newPluginEpoch|, then |plugins| will be left empty.
*/ */
#ifdef MOZ_ENABLE_NPAPI
sync FindPlugins(uint32_t pluginEpoch) returns (nsresult aResult, PluginTag[] plugins, uint32_t newPluginEpoch); sync FindPlugins(uint32_t pluginEpoch) returns (nsresult aResult, PluginTag[] plugins, uint32_t newPluginEpoch);
#endif
async PJavaScript(); async PJavaScript();
async PRemoteSpellcheckEngine(); async PRemoteSpellcheckEngine();
+14 -2
View File
@@ -17,7 +17,9 @@
#include "mozilla/dom/TabChild.h" #include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h" #include "mozilla/dom/TabParent.h"
#include "mozilla/Monitor.h" #include "mozilla/Monitor.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginBridge.h" #include "mozilla/plugins/PluginBridge.h"
#endif
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
@@ -647,8 +649,8 @@ public:
{ {
// chrome process, main thread // chrome process, main thread
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsString dumpId; nsString dumpId;
#ifdef MOZ_ENABLE_NPAPI
if ((mHangData.type() == HangData::TPluginHangData) && mTakeMinidump) { if ((mHangData.type() == HangData::TPluginHangData) && mTakeMinidump) {
// We've been handed a partial minidump; complete it with plugin and // We've been handed a partial minidump; complete it with plugin and
// content process dumps. // content process dumps.
@@ -657,9 +659,12 @@ public:
mBrowserDumpId, dumpId); mBrowserDumpId, dumpId);
mParent->UpdateMinidump(phd.pluginId(), dumpId); mParent->UpdateMinidump(phd.pluginId(), dumpId);
} else { } else {
#endif
// We already have a full minidump; go ahead and use it. // We already have a full minidump; go ahead and use it.
dumpId = mBrowserDumpId; dumpId = mBrowserDumpId;
#ifdef MOZ_ENABLE_NPAPI
} }
#endif
mProcess->SetHangData(mHangData, dumpId); mProcess->SetHangData(mHangData, dumpId);
@@ -903,7 +908,7 @@ HangMonitoredProcess::GetPluginName(nsACString& aPluginName)
if (mHangData.type() != HangData::TPluginHangData) { if (mHangData.type() != HangData::TPluginHangData) {
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
#ifdef MOZ_ENABLE_NPAPI
uint32_t id = mHangData.get_PluginHangData().pluginId(); uint32_t id = mHangData.get_PluginHangData().pluginId();
RefPtr<nsPluginHost> host = nsPluginHost::GetInst(); RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
@@ -914,6 +919,9 @@ HangMonitoredProcess::GetPluginName(nsACString& aPluginName)
aPluginName = tag->Name(); aPluginName = tag->Name();
return NS_OK; return NS_OK;
#else
return NS_ERROR_UNEXPECTED;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -970,6 +978,7 @@ HangMonitoredProcess::EndStartingDebugger()
NS_IMETHODIMP NS_IMETHODIMP
HangMonitoredProcess::TerminatePlugin() HangMonitoredProcess::TerminatePlugin()
{ {
#ifdef MOZ_ENABLE_NPAPI
MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (mHangData.type() != HangData::TPluginHangData) { if (mHangData.type() != HangData::TPluginHangData) {
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
@@ -985,6 +994,9 @@ HangMonitoredProcess::TerminatePlugin()
mActor->CleanupPluginHang(id, false); mActor->CleanupPluginHang(id, false);
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_UNEXPECTED;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
+4 -1
View File
@@ -19,7 +19,9 @@
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/EventListenerManager.h" #include "mozilla/EventListenerManager.h"
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h" #include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginWidgetChild.h" #include "mozilla/plugins/PluginWidgetChild.h"
#endif
#include "mozilla/IMEStateManager.h" #include "mozilla/IMEStateManager.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/APZChild.h" #include "mozilla/layers/APZChild.h"
@@ -3035,7 +3037,7 @@ TabChild::RecvSetFreshProcess()
mIsFreshProcess = true; mIsFreshProcess = true;
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
mozilla::plugins::PPluginWidgetChild* mozilla::plugins::PPluginWidgetChild*
TabChild::AllocPPluginWidgetChild() TabChild::AllocPPluginWidgetChild()
{ {
@@ -3079,6 +3081,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
pluginWidget.forget(aOut); pluginWidget.forget(aOut);
return rv; return rv;
} }
#endif // MOZ_ENABLE_NPAPI
ScreenIntSize ScreenIntSize
TabChild::GetInnerSize() TabChild::GetInnerSize()
+2
View File
@@ -576,6 +576,7 @@ public:
virtual bool RecvUpdateNativeWindowHandle(const uintptr_t& aNewHandle) override; virtual bool RecvUpdateNativeWindowHandle(const uintptr_t& aNewHandle) override;
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Native widget remoting protocol for use with windowed plugins with e10s. * Native widget remoting protocol for use with windowed plugins with e10s.
*/ */
@@ -584,6 +585,7 @@ public:
bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override; bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut); nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
#endif
LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; } LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; }
LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; }; LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; };
+6
View File
@@ -20,7 +20,9 @@
#include "mozilla/dom/DataTransfer.h" #include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/Event.h" #include "mozilla/dom/Event.h"
#include "mozilla/dom/indexedDB/ActorsParent.h" #include "mozilla/dom/indexedDB/ActorsParent.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginWidgetParent.h" #include "mozilla/plugins/PluginWidgetParent.h"
#endif
#include "mozilla/EventStateManager.h" #include "mozilla/EventStateManager.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/gfx/DataSurfaceHelpers.h"
@@ -368,6 +370,7 @@ TabParent::DestroyInternal()
frame->Destroy(); frame->Destroy();
} }
#ifdef MOZ_ENABLE_NPAPI
// Let all PluginWidgets know we are tearing down. Prevents // Let all PluginWidgets know we are tearing down. Prevents
// these objects from sending async events after the child side // these objects from sending async events after the child side
// is shut down. // is shut down.
@@ -377,6 +380,7 @@ TabParent::DestroyInternal()
static_cast<mozilla::plugins::PluginWidgetParent*>( static_cast<mozilla::plugins::PluginWidgetParent*>(
iter.Get()->GetKey())->ParentDestroy(); iter.Get()->GetKey())->ParentDestroy();
} }
#endif
} }
void void
@@ -2826,6 +2830,7 @@ TabParent::RecvRemotePaintIsReady()
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
mozilla::plugins::PPluginWidgetParent* mozilla::plugins::PPluginWidgetParent*
TabParent::AllocPPluginWidgetParent() TabParent::AllocPPluginWidgetParent()
{ {
@@ -2838,6 +2843,7 @@ TabParent::DeallocPPluginWidgetParent(mozilla::plugins::PPluginWidgetParent* aAc
delete aActor; delete aActor;
return true; return true;
} }
#endif
nsresult nsresult
TabParent::HandleEvent(nsIDOMEvent* aEvent) TabParent::HandleEvent(nsIDOMEvent* aEvent)
+2
View File
@@ -535,6 +535,7 @@ public:
LayoutDeviceIntPoint GetChildProcessOffset(); LayoutDeviceIntPoint GetChildProcessOffset();
LayoutDevicePoint AdjustTapToChildWidget(const LayoutDevicePoint& aPoint); LayoutDevicePoint AdjustTapToChildWidget(const LayoutDevicePoint& aPoint);
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Native widget remoting protocol for use with windowed plugins with e10s. * Native widget remoting protocol for use with windowed plugins with e10s.
*/ */
@@ -542,6 +543,7 @@ public:
virtual bool virtual bool
DeallocPPluginWidgetParent(PPluginWidgetParent* aActor) override; DeallocPPluginWidgetParent(PPluginWidgetParent* aActor) override;
#endif
void SetInitedByParent() { mInitedByParent = true; } void SetInitedByParent() { mInitedByParent = true; }
+5 -1
View File
@@ -88,13 +88,17 @@ PREPROCESSED_IPDL_SOURCES += [
'PCycleCollectWithLogs.ipdl', 'PCycleCollectWithLogs.ipdl',
'PFilePicker.ipdl', 'PFilePicker.ipdl',
'PMemoryReportRequest.ipdl', 'PMemoryReportRequest.ipdl',
'PPluginWidget.ipdl',
'PProcessHangMonitor.ipdl', 'PProcessHangMonitor.ipdl',
'PScreenManager.ipdl', 'PScreenManager.ipdl',
'PTabContext.ipdlh', 'PTabContext.ipdlh',
'ServiceWorkerConfiguration.ipdlh', 'ServiceWorkerConfiguration.ipdlh',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
PREPROCESSED_IPDL_SOURCES += [
'PPluginWidget.ipdl',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'
+2 -1
View File
@@ -383,6 +383,7 @@ enum SilverlightPresence {
static SilverlightPresence static SilverlightPresence
CheckSilverlight() CheckSilverlight()
{ {
#ifdef MOZ_ENABLE_NPAPI
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if (!pluginHost) { if (!pluginHost) {
@@ -398,7 +399,7 @@ CheckSilverlight()
} }
} }
} }
#endif
return eNoSilverlight; return eNoSilverlight;
} }
+2
View File
@@ -289,6 +289,7 @@ bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
return false; return false;
} }
#ifdef MOZ_ENABLE_NPAPI
// If an external plugin which can handle quicktime video is available // If an external plugin which can handle quicktime video is available
// (and not disabled), prefer it over native playback as there are // (and not disabled), prefer it over native playback as there are
// several codecs found in the wild that we do not handle. // several codecs found in the wild that we do not handle.
@@ -299,6 +300,7 @@ bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
return false; return false;
} }
} }
#endif
MediaContentType parsed{nsDependentCString(aMIMEType)}; MediaContentType parsed{nsDependentCString(aMIMEType)};
return CanHandleMediaType(parsed, aDiagnostics) return CanHandleMediaType(parsed, aDiagnostics)
+4 -2
View File
@@ -74,7 +74,6 @@ DIRS += [
'network', 'network',
'permission', 'permission',
'plugins/base', 'plugins/base',
'plugins/ipc',
'indexedDB', 'indexedDB',
'system', 'system',
'ipc', 'ipc',
@@ -100,7 +99,10 @@ DIRS += [
'script', 'script',
] ]
if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['MOZ_ENABLE_NPAPI']:
DIRS += ['plugins/ipc']
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_ENABLE_NPAPI']:
DIRS += ['plugins/ipc/hangui'] DIRS += ['plugins/ipc/hangui']
if CONFIG['MOZ_SECUREELEMENT']: if CONFIG['MOZ_SECUREELEMENT']:
+56 -31
View File
@@ -4,67 +4,87 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [ XPIDL_SOURCES += [
'nsIHTTPHeaderListener.idl',
'nsIPluginDocument.idl',
'nsIPluginHost.idl',
'nsIPluginInputStream.idl',
'nsIPluginInstanceOwner.idl',
'nsIPluginTag.idl', 'nsIPluginTag.idl',
'nspluginroot.idl',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
XPIDL_SOURCES += [
'nsIHTTPHeaderListener.idl',
'nsIPluginDocument.idl',
'nsIPluginHost.idl',
'nsIPluginInputStream.idl',
'nsIPluginInstanceOwner.idl',
'nspluginroot.idl',
]
else:
XPIDL_SOURCES += ['no_npapi/nsIPluginHost.idl']
XPIDL_MODULE = 'plugin' XPIDL_MODULE = 'plugin'
EXPORTS += [ EXPORTS += [
'npapi.h', 'npapi.h',
'npfunctions.h',
'npruntime.h',
'nptypes.h', 'nptypes.h',
'nsJSNPRuntime.h',
'nsNPAPIPluginInstance.h',
'nsPluginDirServiceProvider.h', 'nsPluginDirServiceProvider.h',
'nsPluginHost.h', 'nsPluginHost.h',
'nsPluginInstanceOwner.h',
'nsPluginLogging.h', 'nsPluginLogging.h',
'nsPluginNativeWindow.h',
'nsPluginNativeWindowGtk.h', 'nsPluginNativeWindowGtk.h',
'nsPluginsCID.h',
'nsPluginsDir.h',
'nsPluginTags.h', 'nsPluginTags.h',
] ]
EXPORTS.mozilla += [ if CONFIG['MOZ_ENABLE_NPAPI']:
'PluginPRLibrary.h', EXPORTS += [
] 'npfunctions.h',
'npruntime.h',
'nsJSNPRuntime.h',
'nsNPAPIPluginInstance.h',
'nsPluginInstanceOwner.h',
'nsPluginNativeWindow.h',
'nsPluginsCID.h',
'nsPluginsDir.h',
]
EXPORTS.mozilla += [
'PluginPRLibrary.h',
]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'nsJSNPRuntime.cpp',
'nsNPAPIPluginInstance.cpp',
'nsNPAPIPluginStreamListener.cpp',
'nsPluginInstanceOwner.cpp',
'nsPluginModule.cpp',
'nsPluginStreamListenerPeer.cpp',
'nsPluginTags.cpp', 'nsPluginTags.cpp',
'PluginPRLibrary.cpp',
] ]
SOURCES += [ if CONFIG['MOZ_ENABLE_NPAPI']:
'nsNPAPIPlugin.cpp', # Conflict with X11 headers UNIFIED_SOURCES += [
'nsPluginHost.cpp', # Conflict with NS_NPAPIPLUGIN_CALLBACK 'nsJSNPRuntime.cpp',
] 'nsNPAPIPluginInstance.cpp',
'nsNPAPIPluginStreamListener.cpp',
'nsPluginInstanceOwner.cpp',
'nsPluginModule.cpp',
'nsPluginStreamListenerPeer.cpp',
'PluginPRLibrary.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT': SOURCES += [
'nsNPAPIPlugin.cpp', # Conflict with X11 headers
'nsPluginHost.cpp', # Conflict with NS_NPAPIPLUGIN_CALLBACK
]
#SOURCES += [
# 'nsPluginHost.cpp', # Conflict with NS_NPAPIPLUGIN_CALLBACK
#]
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_ENABLE_NPAPI']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'nsPluginDirServiceProvider.cpp', 'nsPluginDirServiceProvider.cpp',
'nsPluginNativeWindowWin.cpp', 'nsPluginNativeWindowWin.cpp',
'nsPluginsDirWin.cpp', 'nsPluginsDirWin.cpp',
] ]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['MOZ_ENABLE_NPAPI']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'nsPluginNativeWindow.cpp', 'nsPluginNativeWindow.cpp',
'nsPluginsDirDarwin.cpp', 'nsPluginsDirDarwin.cpp',
] ]
else: elif CONFIG['MOZ_ENABLE_NPAPI']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'nsPluginsDirUnix.cpp', 'nsPluginsDirUnix.cpp',
] ]
@@ -94,6 +114,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'/xpcom/base', '/xpcom/base',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
LOCAL_INCLUDES += [
'/dom/plugins/ipc',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'
+171
View File
@@ -0,0 +1,171 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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 "nsISupports.idl"
#include "nsIPluginTag.idl"
%{C++
#define MOZ_PLUGIN_HOST_CONTRACTID \
"@mozilla.org/plugin/host;1"
%}
[scriptable, function, uuid(9c311778-7c2c-4ad8-b439-b8a2786a20dd)]
interface nsIClearSiteDataCallback : nsISupports
{
/**
* callback with the result from a call to clearSiteData
*/
void callback(in nsresult rv);
};
[scriptable, uuid(f938f5ba-7093-42cd-a559-af8039d99204)]
interface nsIPluginHost : nsISupports
{
/**
* Causes the plugins directory to be searched again for new plugin
* libraries.
*/
void reloadPlugins();
void getPluginTags([optional] out unsigned long aPluginCount,
[retval, array, size_is(aPluginCount)] out nsIPluginTag aResults);
/*
* Flags for use with clearSiteData.
*
* FLAG_CLEAR_ALL: clear all data associated with a site.
* FLAG_CLEAR_CACHE: clear cached data that can be retrieved again without
* loss of functionality. To be used out of concern for
* space and not necessarily privacy.
*/
const uint32_t FLAG_CLEAR_ALL = 0;
const uint32_t FLAG_CLEAR_CACHE = 1;
/*
* For use with Get*ForType functions
*/
const uint32_t EXCLUDE_NONE = 0;
const uint32_t EXCLUDE_DISABLED = 1 << 0;
const uint32_t EXCLUDE_FAKE = 1 << 1;
/*
* Clear site data for a given plugin.
*
* @param plugin: the plugin to clear data for, such as one returned by
* nsIPluginHost.getPluginTags.
* @param domain: the domain to clear data for. If this argument is null,
* clear data for all domains. Otherwise, it must be a domain
* only (not a complete URI or IRI). The base domain for the
* given site will be determined; any data for the base domain
* or its subdomains will be cleared.
* @param flags: a flag value defined above.
* @param maxAge: the maximum age in seconds of data to clear, inclusive. If
* maxAge is 0, no data is cleared; if it is -1, all data is
* cleared.
*
* @throws NS_ERROR_INVALID_ARG if the domain argument is malformed.
* @throws NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED if maxAge is a value other
* than -1 and the plugin does not support clearing by timerange in
* general or for that particular site and/or flag combination.
*/
void clearSiteData(in nsIPluginTag plugin, in AUTF8String domain,
in uint64_t flags, in int64_t maxAge,
in nsIClearSiteDataCallback callback);
/*
* Determine if a plugin has stored data for a given site.
*
* @param plugin: the plugin to query, such as one returned by
* nsIPluginHost.getPluginTags.
* @param domain: the domain to test. If this argument is null, test if data
* is stored for any site. The base domain for the given domain
* will be determined; if any data for the base domain or its
* subdomains is found, return true.
*/
boolean siteHasData(in nsIPluginTag plugin, in AUTF8String domain);
/**
* Get the "permission string" for the plugin. This is a string that can be
* passed to the permission manager to see whether the plugin is allowed to
* run, for example. This will typically be based on the plugin's "nice name"
* and its blocklist state.
*
* @mimeType The MIME type we're interested in.
* @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
*/
ACString getPermissionStringForType(in AUTF8String mimeType,
[optional] in uint32_t excludeFlags);
/**
* Get the "permission string" for the plugin. This is a string that can be
* passed to the permission manager to see whether the plugin is allowed to
* run, for example. This will typically be based on the plugin's "nice name"
* and its blocklist state.
*
* @tag The tage we're interested in
* @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
*/
ACString getPermissionStringForTag(in nsIPluginTag tag,
[optional] in uint32_t excludeFlags);
/**
* Get the nsIPluginTag for this MIME type. This method works with both
* enabled and disabled/blocklisted plugins, but an enabled plugin will
* always be returned if available.
*
* A fake plugin tag, if one exists and is available, will be returned in
* preference to NPAPI plugin tags unless excluded by the excludeFlags.
*
* @mimeType The MIME type we're interested in.
* @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
*
* @throws NS_ERROR_NOT_AVAILABLE if no plugin is available for this MIME
* type.
*/
nsIPluginTag getPluginTagForType(in AUTF8String mimeType,
[optional] in uint32_t excludeFlags);
/**
* Get the nsIPluginTag enabled state for this MIME type. See
* nsIPluginTag.enabledState.
*
* @mimeType The MIME type we're interested in.
* @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
*/
unsigned long getStateForType(in AUTF8String mimeType,
[optional] in uint32_t excludeFlags);
/**
* Get the blocklist state for a MIME type. See nsIPluginTag.blocklistState.
*
* @mimeType The MIME type we're interested in.
* @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
*/
uint32_t getBlocklistStateForType(in AUTF8String aMimeType,
[optional] in uint32_t excludeFlags);
/**
* Create a fake plugin tag, register it, and return it. The argument is a
* FakePluginTagInit dictionary. See documentation in
* FakePluginTagInit.webidl for what it should look like. Will throw
* NS_ERROR_UNEXPECTED if there is already a fake plugin registered with the
* given handler URI.
*/
[implicit_jscontext]
nsIFakePluginTag registerFakePlugin(in jsval initDictionary);
/**
* Get a reference to an existing fake plugin tag for the given MIME type, if
* any. Can return null.
*/
nsIFakePluginTag getFakePlugin(in AUTF8String mimeType);
/**
* Unregister a fake plugin. The argument can be the .handlerURI.spec of an
* existing nsIFakePluginTag, or just a known handler URI string that was
* passed in the FakePluginTagInit when registering.
*/
void unregisterFakePlugin(in AUTF8String handlerURI);
};
+2 -2
View File
@@ -258,7 +258,7 @@ typedef struct
#endif /* XP_UNIX */ #endif /* XP_UNIX */
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
/* /*
* Windows specific structures and definitions * Windows specific structures and definitions
*/ */
@@ -401,7 +401,7 @@ typedef enum {
#endif #endif
/* Notification that the plugin just started or stopped playing audio */ /* Notification that the plugin just started or stopped playing audio */
, NPPVpluginIsPlayingAudio = 4000 , NPPVpluginIsPlayingAudio = 4000
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
/* Notification that the plugin requests notification when the default audio device has changed */ /* Notification that the plugin requests notification when the default audio device has changed */
, NPPVpluginRequiresAudioDeviceChanges = 4001 , NPPVpluginRequiresAudioDeviceChanges = 4001
#endif #endif
+168 -13
View File
@@ -11,12 +11,16 @@
#include "prenv.h" #include "prenv.h"
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPlugin.h" #include "nsNPAPIPlugin.h"
#include "nsNPAPIPluginStreamListener.h" #include "nsNPAPIPluginStreamListener.h"
#endif
#include "nsPluginHost.h" #include "nsPluginHost.h"
#include "nsPluginLogging.h" #include "nsPluginLogging.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#endif
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
@@ -25,8 +29,10 @@
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsJSNPRuntime.h" #include "nsJSNPRuntime.h"
#include "nsPluginStreamListenerPeer.h" #include "nsPluginStreamListenerPeer.h"
#endif
#include "nsSize.h" #include "nsSize.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsIContent.h" #include "nsIContent.h"
@@ -42,10 +48,14 @@ using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla; using namespace mozilla;
#ifdef MOZ_ENABLE_NPAPI
using namespace mozilla::plugins::parent; using namespace mozilla::plugins::parent;
#endif
using namespace mozilla::layers; using namespace mozilla::layers;
#ifdef MOZ_ENABLE_NPAPI
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
#endif
NS_IMPL_ISUPPORTS(nsNPAPIPluginInstance, nsIAudioChannelAgentCallback) NS_IMPL_ISUPPORTS(nsNPAPIPluginInstance, nsIAudioChannelAgentCallback)
@@ -57,9 +67,13 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance()
, mCached(false) , mCached(false)
, mUsesDOMForCursor(false) , mUsesDOMForCursor(false)
, mInPluginInitCall(false) , mInPluginInitCall(false)
#ifdef MOZ_ENABLE_NPAPI
, mPlugin(nullptr) , mPlugin(nullptr)
#endif
, mMIMEType(nullptr) , mMIMEType(nullptr)
#ifdef MOZ_ENABLE_NPAPI
, mOwner(nullptr) , mOwner(nullptr)
#endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
, mCurrentPluginEvent(nullptr) , mCurrentPluginEvent(nullptr)
#endif #endif
@@ -113,7 +127,9 @@ void
nsNPAPIPluginInstance::Destroy() nsNPAPIPluginInstance::Destroy()
{ {
Stop(); Stop();
#ifdef MOZ_ENABLE_NPAPI
mPlugin = nullptr; mPlugin = nullptr;
#endif
mAudioChannelAgent = nullptr; mAudioChannelAgent = nullptr;
} }
@@ -123,6 +139,7 @@ nsNPAPIPluginInstance::StopTime()
return mStopTime; return mStopTime;
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsNPAPIPluginInstance::Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType) nsresult nsNPAPIPluginInstance::Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType)
{ {
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
@@ -140,9 +157,11 @@ nsresult nsNPAPIPluginInstance::Initialize(nsNPAPIPlugin *aPlugin, nsPluginInsta
return Start(); return Start();
} }
#endif
nsresult nsNPAPIPluginInstance::Stop() nsresult nsNPAPIPluginInstance::Stop()
{ {
#ifdef MOZ_ENABLE_NPAPI
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Stop this=%p\n",this)); PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Stop this=%p\n",this));
// Make sure the plugin didn't leave popups enabled. // Make sure the plugin didn't leave popups enabled.
@@ -186,7 +205,9 @@ nsresult nsNPAPIPluginInstance::Stop()
} }
if (!mPlugin || !mPlugin->GetLibrary()) if (!mPlugin || !mPlugin->GetLibrary())
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs(); NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
@@ -208,11 +229,13 @@ nsresult nsNPAPIPluginInstance::Stop()
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
else else
return NS_OK; return NS_OK;
#endif
} }
already_AddRefed<nsPIDOMWindowOuter> already_AddRefed<nsPIDOMWindowOuter>
nsNPAPIPluginInstance::GetDOMWindow() nsNPAPIPluginInstance::GetDOMWindow()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!mOwner) if (!mOwner)
return nullptr; return nullptr;
@@ -221,13 +244,17 @@ nsNPAPIPluginInstance::GetDOMWindow()
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
kungFuDeathGrip->GetDocument(getter_AddRefs(doc)); kungFuDeathGrip->GetDocument(getter_AddRefs(doc));
if (!doc) if (!doc)
#endif
return nullptr; return nullptr;
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPIDOMWindowOuter> window = doc->GetWindow(); RefPtr<nsPIDOMWindowOuter> window = doc->GetWindow();
return window.forget(); return window.forget();
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsNPAPIPluginInstance::GetTagType(nsPluginTagType *result) nsNPAPIPluginInstance::GetTagType(nsPluginTagType *result)
{ {
@@ -238,6 +265,7 @@ nsNPAPIPluginInstance::GetTagType(nsPluginTagType *result)
return mOwner->GetTagType(result); return mOwner->GetTagType(result);
} }
nsresult nsresult
nsNPAPIPluginInstance::GetMode(int32_t *result) nsNPAPIPluginInstance::GetMode(int32_t *result)
{ {
@@ -246,7 +274,9 @@ nsNPAPIPluginInstance::GetMode(int32_t *result)
else else
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
#endif
#ifdef MOZ_ENABLE_NPAPI
nsTArray<nsNPAPIPluginStreamListener*>* nsTArray<nsNPAPIPluginStreamListener*>*
nsNPAPIPluginInstance::StreamListeners() nsNPAPIPluginInstance::StreamListeners()
{ {
@@ -258,17 +288,21 @@ nsNPAPIPluginInstance::FileCachedStreamListeners()
{ {
return &mFileCachedStreamListeners; return &mFileCachedStreamListeners;
} }
#endif
nsresult nsresult
nsNPAPIPluginInstance::Start() nsNPAPIPluginInstance::Start()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mRunning == RUNNING) { if (mRunning == RUNNING) {
return NS_OK; return NS_OK;
} }
if (!mOwner) { if (!mOwner) {
MOZ_ASSERT(false, "Should not be calling Start() on unowned plugin."); MOZ_ASSERT(false, "Should not be calling Start() on unowned plugin.");
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
} }
PluginDestructionGuard guard(this); PluginDestructionGuard guard(this);
@@ -354,10 +388,12 @@ nsNPAPIPluginInstance::Start()
} }
return newResult; return newResult;
#endif // MOZ_ENABLE_NPAPI
} }
nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window) nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
{ {
#ifdef MOZ_ENABLE_NPAPI
// NPAPI plugins don't want a SetWindow(nullptr). // NPAPI plugins don't want a SetWindow(nullptr).
if (!window || RUNNING != mRunning) if (!window || RUNNING != mRunning)
return NS_OK; return NS_OK;
@@ -408,16 +444,24 @@ nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
window->clipRect.top, window->clipRect.bottom, window->clipRect.left, window->clipRect.right, error)); window->clipRect.top, window->clipRect.bottom, window->clipRect.left, window->clipRect.right, error));
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif // MOZ_ENABLE_NPAPI
} }
nsresult nsresult
nsNPAPIPluginInstance::NewStreamFromPlugin(const char* type, const char* target, nsNPAPIPluginInstance::NewStreamFromPlugin(const char* type, const char* target,
nsIOutputStream* *result) nsIOutputStream* *result)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsPluginStreamToFile* stream = new nsPluginStreamToFile(target, mOwner); nsPluginStreamToFile* stream = new nsPluginStreamToFile(target, mOwner);
return stream->QueryInterface(kIOutputStreamIID, (void**)result); return stream->QueryInterface(kIOutputStreamIID, (void**)result);
#else
return NS_ERROR_FAILURE;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsNPAPIPluginInstance::NewStreamListener(const char* aURL, void* notifyData, nsNPAPIPluginInstance::NewStreamListener(const char* aURL, void* notifyData,
nsNPAPIPluginStreamListener** listener) nsNPAPIPluginStreamListener** listener)
@@ -430,9 +474,11 @@ nsNPAPIPluginInstance::NewStreamListener(const char* aURL, void* notifyData,
return NS_OK; return NS_OK;
} }
#endif
nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint) nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ENSURE_TRUE(platformPrint, NS_ERROR_NULL_POINTER); NS_ENSURE_TRUE(platformPrint, NS_ERROR_NULL_POINTER);
PluginDestructionGuard guard(this); PluginDestructionGuard guard(this);
@@ -480,11 +526,15 @@ nsresult nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
platformPrint->print.embedPrint.window.clipRect.right)); platformPrint->print.embedPrint.window.clipRect.right));
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result, nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result,
NSPluginCallReentry aSafeToReenterGecko) NSPluginCallReentry aSafeToReenterGecko)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
@@ -525,13 +575,18 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result,
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif // MOZ_ENABLE_NPAPI
} }
nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value) nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!mPlugin || !mPlugin->GetLibrary()) if (!mPlugin || !mPlugin->GetLibrary())
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs(); NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
@@ -552,12 +607,15 @@ nsresult nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* v
} }
return rv; return rv;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
nsNPAPIPlugin* nsNPAPIPluginInstance::GetPlugin() nsNPAPIPlugin* nsNPAPIPluginInstance::GetPlugin()
{ {
return mPlugin; return mPlugin;
} }
#endif
nsresult nsNPAPIPluginInstance::GetNPP(NPP* aNPP) nsresult nsNPAPIPluginInstance::GetNPP(NPP* aNPP)
{ {
@@ -614,12 +672,15 @@ void nsNPAPIPluginInstance::SetDrawingModel(NPDrawingModel aModel)
void nsNPAPIPluginInstance::RedrawPlugin() void nsNPAPIPluginInstance::RedrawPlugin()
{ {
#ifdef MOZ_ENABLE_NPAPI
mOwner->RedrawPlugin(); mOwner->RedrawPlugin();
#endif
} }
#if defined(XP_MACOSX) #if defined(XP_MACOSX)
void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel) void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel)
{ {
#ifdef MOZ_ENABLE_NPAPI
// the event model needs to be set for the object frame immediately // the event model needs to be set for the object frame immediately
if (!mOwner) { if (!mOwner) {
NS_WARNING("Trying to set event model without a plugin instance owner!"); NS_WARNING("Trying to set event model without a plugin instance owner!");
@@ -627,8 +688,9 @@ void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel)
} }
mOwner->SetEventModel(aModel); mOwner->SetEventModel(aModel);
#endif // MOZ_ENABLE_NPAPI
} }
#endif #endif // XP_MACOSX
nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel) nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel)
{ {
@@ -638,7 +700,7 @@ nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel)
nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(bool* aDrawing) nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(bool* aDrawing)
{ {
#ifdef XP_MACOSX #if defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
if (!mPlugin) if (!mPlugin)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -655,7 +717,7 @@ nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(bool* aDrawing)
nsresult nsresult
nsNPAPIPluginInstance::ContentsScaleFactorChanged(double aContentsScaleFactor) nsNPAPIPluginInstance::ContentsScaleFactorChanged(double aContentsScaleFactor)
{ {
#if defined(XP_MACOSX) || defined(XP_WIN) #if (defined(XP_MACOSX) || defined(XP_WIN)) && defined(MOZ_ENABLE_NPAPI)
if (!mPlugin) if (!mPlugin)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -676,14 +738,16 @@ nsNPAPIPluginInstance::ContentsScaleFactorChanged(double aContentsScaleFactor)
nsresult nsresult
nsNPAPIPluginInstance::CSSZoomFactorChanged(float aCSSZoomFactor) nsNPAPIPluginInstance::CSSZoomFactorChanged(float aCSSZoomFactor)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of CSS Zoom Factor change this=%p\n",this)); PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of CSS Zoom Factor change this=%p\n",this));
if (!mPlugin || !mPlugin->GetLibrary()) if (!mPlugin || !mPlugin->GetLibrary())
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs(); NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
if (!pluginFunctions->setvalue) if (!pluginFunctions->setvalue)
@@ -696,13 +760,17 @@ nsNPAPIPluginInstance::CSSZoomFactorChanged(float aCSSZoomFactor)
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVCSSZoomFactor, &value), this, NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVCSSZoomFactor, &value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE; return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject) nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mHaveJavaC2PJSObjectQuirk) { if (mHaveJavaC2PJSObjectQuirk) {
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
} }
NPObject *npobj = nullptr; NPObject *npobj = nullptr;
@@ -715,6 +783,7 @@ nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
_releaseobject(npobj); _releaseobject(npobj);
return NS_OK; return NS_OK;
#endif
} }
void void
@@ -741,6 +810,7 @@ nsNPAPIPluginInstance::IsWindowless(bool* isWindowless)
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
class MOZ_STACK_CLASS AutoPluginLibraryCall class MOZ_STACK_CLASS AutoPluginLibraryCall
{ {
public: public:
@@ -759,23 +829,28 @@ private:
PluginDestructionGuard mGuard; PluginDestructionGuard mGuard;
PluginLibrary* mLibrary; PluginLibrary* mLibrary;
}; };
#endif
nsresult nsresult
nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window) nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
if (!library) if (!library)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return library->AsyncSetWindow(&mNPP, window); return library->AsyncSetWindow(&mNPP, window);
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::GetImageContainer(ImageContainer**aContainer) nsNPAPIPluginInstance::GetImageContainer(ImageContainer**aContainer)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aContainer = nullptr; *aContainer = nullptr;
if (RUNNING != mRunning) if (RUNNING != mRunning)
@@ -783,11 +858,15 @@ nsNPAPIPluginInstance::GetImageContainer(ImageContainer**aContainer)
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
return !library ? NS_ERROR_FAILURE : library->GetImageContainer(&mNPP, aContainer); return !library ? NS_ERROR_FAILURE : library->GetImageContainer(&mNPP, aContainer);
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::GetImageSize(nsIntSize* aSize) nsNPAPIPluginInstance::GetImageSize(nsIntSize* aSize)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aSize = nsIntSize(0, 0); *aSize = nsIntSize(0, 0);
if (RUNNING != mRunning) if (RUNNING != mRunning)
@@ -795,12 +874,16 @@ nsNPAPIPluginInstance::GetImageSize(nsIntSize* aSize)
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
return !library ? NS_ERROR_FAILURE : library->GetImageSize(&mNPP, aSize); return !library ? NS_ERROR_FAILURE : library->GetImageSize(&mNPP, aSize);
#else
return NS_ERROR_FAILURE;
#endif
} }
#if defined(XP_WIN) #if defined(XP_WIN)
nsresult nsresult
nsNPAPIPluginInstance::GetScrollCaptureContainer(ImageContainer**aContainer) nsNPAPIPluginInstance::GetScrollCaptureContainer(ImageContainer**aContainer)
{ {
#ifdef MOZ_ENABLE_NPAPI
*aContainer = nullptr; *aContainer = nullptr;
if (RUNNING != mRunning) if (RUNNING != mRunning)
@@ -808,6 +891,9 @@ nsNPAPIPluginInstance::GetScrollCaptureContainer(ImageContainer**aContainer)
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
return !library ? NS_ERROR_FAILURE : library->GetScrollCaptureContainer(&mNPP, aContainer); return !library ? NS_ERROR_FAILURE : library->GetScrollCaptureContainer(&mNPP, aContainer);
#else
return NS_ERROR_FAILURE;
#endif // MOZ_ENABLE_NPAPI
} }
#endif #endif
@@ -816,6 +902,7 @@ nsNPAPIPluginInstance::HandledWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData, const NativeEventData& aKeyEventData,
bool aIsConsumed) bool aIsConsumed)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (NS_WARN_IF(!mPlugin)) { if (NS_WARN_IF(!mPlugin)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@@ -826,16 +913,21 @@ nsNPAPIPluginInstance::HandledWindowedPluginKeyEvent(
} }
return library->HandledWindowedPluginKeyEvent(&mNPP, aKeyEventData, return library->HandledWindowedPluginKeyEvent(&mNPP, aKeyEventData,
aIsConsumed); aIsConsumed);
#else
return NS_ERROR_FAILURE;
#endif
} }
void void
nsNPAPIPluginInstance::DidComposite() nsNPAPIPluginInstance::DidComposite()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return; return;
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
library->DidComposite(&mNPP); library->DidComposite(&mNPP);
#endif
} }
nsresult nsresult
@@ -848,52 +940,64 @@ nsNPAPIPluginInstance::NotifyPainted(void)
nsresult nsresult
nsNPAPIPluginInstance::GetIsOOP(bool* aIsAsync) nsNPAPIPluginInstance::GetIsOOP(bool* aIsAsync)
{ {
#ifdef MOZ_ENABLE_NPAPI
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
if (!library) if (!library)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
*aIsAsync = library->IsOOP(); *aIsAsync = library->IsOOP();
return NS_OK; return NS_OK;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::SetBackgroundUnknown() nsNPAPIPluginInstance::SetBackgroundUnknown()
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
if (!library) if (!library)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return library->SetBackgroundUnknown(&mNPP); return library->SetBackgroundUnknown(&mNPP);
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::BeginUpdateBackground(nsIntRect* aRect, nsNPAPIPluginInstance::BeginUpdateBackground(nsIntRect* aRect,
DrawTarget** aDrawTarget) DrawTarget** aDrawTarget)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
if (!library) if (!library)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return library->BeginUpdateBackground(&mNPP, *aRect, aDrawTarget); return library->BeginUpdateBackground(&mNPP, *aRect, aDrawTarget);
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::EndUpdateBackground(nsIntRect* aRect) nsNPAPIPluginInstance::EndUpdateBackground(nsIntRect* aRect)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
AutoPluginLibraryCall library(this); AutoPluginLibraryCall library(this);
if (!library) if (!library)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return library->EndUpdateBackground(&mNPP, *aRect); return library->EndUpdateBackground(&mNPP, *aRect);
#endif
} }
nsresult nsresult
@@ -968,11 +1072,13 @@ nsNPAPIPluginInstance::PopPopupsEnabledState()
nsresult nsresult
nsNPAPIPluginInstance::GetPluginAPIVersion(uint16_t* version) nsNPAPIPluginInstance::GetPluginAPIVersion(uint16_t* version)
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ENSURE_ARG_POINTER(version); NS_ENSURE_ARG_POINTER(version);
if (!mPlugin) if (!mPlugin)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
if (!mPlugin->GetLibrary()) if (!mPlugin->GetLibrary())
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -981,19 +1087,22 @@ nsNPAPIPluginInstance::GetPluginAPIVersion(uint16_t* version)
*version = pluginFunctions->version; *version = pluginFunctions->version;
return NS_OK; return NS_OK;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled) nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of private mode state change this=%p\n",this)); PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance informing plugin of private mode state change this=%p\n",this));
if (!mPlugin || !mPlugin->GetLibrary()) if (!mPlugin || !mPlugin->GetLibrary())
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs(); NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
if (!pluginFunctions->setvalue) if (!pluginFunctions->setvalue)
@@ -1006,13 +1115,17 @@ nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled)
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this, NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVprivateModeBool, &value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE; return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::IsPrivateBrowsing(bool* aEnabled) nsNPAPIPluginInstance::IsPrivateBrowsing(bool* aEnabled)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!mOwner) if (!mOwner)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
mOwner->GetDocument(getter_AddRefs(doc)); mOwner->GetDocument(getter_AddRefs(doc));
@@ -1025,6 +1138,7 @@ nsNPAPIPluginInstance::IsPrivateBrowsing(bool* aEnabled)
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell); nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
*aEnabled = (loadContext && loadContext->UsePrivateBrowsing()); *aEnabled = (loadContext && loadContext->UsePrivateBrowsing());
return NS_OK; return NS_OK;
#endif
} }
static void static void
@@ -1134,9 +1248,11 @@ NPBool
nsNPAPIPluginInstance::ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, nsNPAPIPluginInstance::ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double *destX, double *destY, NPCoordinateSpace destSpace) double *destX, double *destY, NPCoordinateSpace destSpace)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mOwner) { if (mOwner) {
return mOwner->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace); return mOwner->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace);
} }
#endif
return false; return false;
} }
@@ -1144,36 +1260,47 @@ nsNPAPIPluginInstance::ConvertPoint(double sourceX, double sourceY, NPCoordinate
nsresult nsresult
nsNPAPIPluginInstance::GetDOMElement(nsIDOMElement* *result) nsNPAPIPluginInstance::GetDOMElement(nsIDOMElement* *result)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!mOwner) { if (!mOwner) {
*result = nullptr; *result = nullptr;
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
} }
return mOwner->GetDOMElement(result); return mOwner->GetDOMElement(result);
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::InvalidateRect(NPRect *invalidRect) nsNPAPIPluginInstance::InvalidateRect(NPRect *invalidRect)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
if (!mOwner) if (!mOwner)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return mOwner->InvalidateRect(invalidRect); return mOwner->InvalidateRect(invalidRect);
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::InvalidateRegion(NPRegion invalidRegion) nsNPAPIPluginInstance::InvalidateRegion(NPRegion invalidRegion)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
if (!mOwner) if (!mOwner)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
return mOwner->InvalidateRegion(invalidRegion); return mOwner->InvalidateRegion(invalidRegion);
#endif
} }
nsresult nsresult
@@ -1187,6 +1314,7 @@ nsNPAPIPluginInstance::GetMIMEType(const char* *result)
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
nsPluginInstanceOwner* nsPluginInstanceOwner*
nsNPAPIPluginInstance::GetOwner() nsNPAPIPluginInstance::GetOwner()
{ {
@@ -1198,6 +1326,7 @@ nsNPAPIPluginInstance::SetOwner(nsPluginInstanceOwner *aOwner)
{ {
mOwner = aOwner; mOwner = aOwner;
} }
#endif
nsresult nsresult
nsNPAPIPluginInstance::AsyncSetWindow(NPWindow& window) nsNPAPIPluginInstance::AsyncSetWindow(NPWindow& window)
@@ -1208,6 +1337,7 @@ nsNPAPIPluginInstance::AsyncSetWindow(NPWindow& window)
void void
nsNPAPIPluginInstance::URLRedirectResponse(void* notifyData, NPBool allow) nsNPAPIPluginInstance::URLRedirectResponse(void* notifyData, NPBool allow)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!notifyData) { if (!notifyData) {
return; return;
} }
@@ -1219,15 +1349,18 @@ nsNPAPIPluginInstance::URLRedirectResponse(void* notifyData, NPBool allow)
currentListener->URLRedirectResponse(allow); currentListener->URLRedirectResponse(allow);
} }
} }
#endif
} }
NPError NPError
nsNPAPIPluginInstance::InitAsyncSurface(NPSize *size, NPImageFormat format, nsNPAPIPluginInstance::InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface) void *initData, NPAsyncSurface *surface)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mOwner) { if (mOwner) {
return mOwner->InitAsyncSurface(size, format, initData, surface); return mOwner->InitAsyncSurface(size, format, initData, surface);
} }
#endif
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
@@ -1235,9 +1368,11 @@ nsNPAPIPluginInstance::InitAsyncSurface(NPSize *size, NPImageFormat format,
NPError NPError
nsNPAPIPluginInstance::FinalizeAsyncSurface(NPAsyncSurface *surface) nsNPAPIPluginInstance::FinalizeAsyncSurface(NPAsyncSurface *surface)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mOwner) { if (mOwner) {
return mOwner->FinalizeAsyncSurface(surface); return mOwner->FinalizeAsyncSurface(surface);
} }
#endif
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
@@ -1245,9 +1380,11 @@ nsNPAPIPluginInstance::FinalizeAsyncSurface(NPAsyncSurface *surface)
void void
nsNPAPIPluginInstance::SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) nsNPAPIPluginInstance::SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (mOwner) { if (mOwner) {
mOwner->SetCurrentAsyncSurface(surface, changed); mOwner->SetCurrentAsyncSurface(surface, changed);
} }
#endif
} }
class CarbonEventModelFailureEvent : public Runnable { class CarbonEventModelFailureEvent : public Runnable {
@@ -1318,6 +1455,7 @@ GetJavaVersionFromMimetype(nsPluginTag* pluginTag, nsCString& version)
return false; return false;
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsNPAPIPluginInstance::CheckJavaC2PJSObjectQuirk(uint16_t paramCount, nsNPAPIPluginInstance::CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
const char* const* paramNames, const char* const* paramNames,
@@ -1382,30 +1520,40 @@ nsNPAPIPluginInstance::CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
mHaveJavaC2PJSObjectQuirk = true; mHaveJavaC2PJSObjectQuirk = true;
} }
#endif
double double
nsNPAPIPluginInstance::GetContentsScaleFactor() nsNPAPIPluginInstance::GetContentsScaleFactor()
{ {
#ifdef MOZ_ENABLE_NPAPI
double scaleFactor = 1.0; double scaleFactor = 1.0;
if (mOwner) { if (mOwner) {
mOwner->GetContentsScaleFactor(&scaleFactor); mOwner->GetContentsScaleFactor(&scaleFactor);
} }
return scaleFactor; return scaleFactor;
#else
return -1.0;
#endif
} }
float float
nsNPAPIPluginInstance::GetCSSZoomFactor() nsNPAPIPluginInstance::GetCSSZoomFactor()
{ {
#ifdef MOZ_ENABLE_NPAPI
float zoomFactor = 1.0; float zoomFactor = 1.0;
if (mOwner) { if (mOwner) {
mOwner->GetCSSZoomFactor(&zoomFactor); mOwner->GetCSSZoomFactor(&zoomFactor);
} }
return zoomFactor; return zoomFactor;
#else
return -1.0f;
#endif
} }
nsresult nsresult
nsNPAPIPluginInstance::GetRunID(uint32_t* aRunID) nsNPAPIPluginInstance::GetRunID(uint32_t* aRunID)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (NS_WARN_IF(!aRunID)) { if (NS_WARN_IF(!aRunID)) {
return NS_ERROR_INVALID_POINTER; return NS_ERROR_INVALID_POINTER;
} }
@@ -1420,6 +1568,9 @@ nsNPAPIPluginInstance::GetRunID(uint32_t* aRunID)
} }
return library->GetRunID(aRunID); return library->GetRunID(aRunID);
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsresult
@@ -1485,6 +1636,7 @@ nsNPAPIPluginInstance::WindowAudioCaptureChanged(bool aCapture)
nsresult nsresult
nsNPAPIPluginInstance::SetMuted(bool aIsMuted) nsNPAPIPluginInstance::SetMuted(bool aIsMuted)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (RUNNING != mRunning) if (RUNNING != mRunning)
return NS_OK; return NS_OK;
@@ -1505,4 +1657,7 @@ nsNPAPIPluginInstance::SetMuted(bool aIsMuted)
NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVmuteAudioBool, &value), this, NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVmuteAudioBool, &value), this,
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE; return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
#else
return NS_ERROR_FAILURE;
#endif
} }
+37 -2
View File
@@ -11,24 +11,43 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsITimer.h" #include "nsITimer.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginInstanceOwner.h" #include "nsIPluginInstanceOwner.h"
#endif
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIChannel.h" #include "nsIChannel.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include <prinrval.h> #include <prinrval.h>
#include "js/TypeDecls.h" #include "js/TypeDecls.h"
#include "nsIAudioChannelAgent.h" #include "nsIAudioChannelAgent.h"
#ifndef MOZ_ENABLE_NPAPI
#include "npapi.h"
#include "nsRect.h"
#include "mozilla/gfx/2D.h"
#endif
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/PluginLibrary.h" #include "mozilla/PluginLibrary.h"
#endif
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/WeakPtr.h" #include "mozilla/WeakPtr.h"
#ifdef MOZ_ENABLE_NPAPI
class nsPluginStreamListenerPeer; // browser-initiated stream class class nsPluginStreamListenerPeer; // browser-initiated stream class
class nsNPAPIPluginStreamListener; // plugin-initiated stream class class nsNPAPIPluginStreamListener; // plugin-initiated stream class
class nsIPluginInstanceOwner; class nsIPluginInstanceOwner;
#endif
class nsIOutputStream; class nsIOutputStream;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginInstanceOwner; class nsPluginInstanceOwner;
#endif
namespace mozilla {
namespace layers {
class ImageContainer;
} // namespace layers
} // namespace mozilla
#if defined(OS_WIN) #if defined(OS_WIN)
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin; const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin;
@@ -71,7 +90,9 @@ class nsNPAPIPluginInstance final : public nsIAudioChannelAgentCallback
, public mozilla::SupportsWeakPtr<nsNPAPIPluginInstance> , public mozilla::SupportsWeakPtr<nsNPAPIPluginInstance>
{ {
private: private:
#ifdef MOZ_ENABLE_NPAPI
typedef mozilla::PluginLibrary PluginLibrary; typedef mozilla::PluginLibrary PluginLibrary;
#endif
public: public:
typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::DrawTarget DrawTarget;
@@ -80,7 +101,9 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
#ifdef MOZ_ENABLE_NPAPI
nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType); nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const nsACString& aMIMEType);
#endif
nsresult Start(); nsresult Start();
nsresult Stop(); nsresult Stop();
nsresult SetWindow(NPWindow* window); nsresult SetWindow(NPWindow* window);
@@ -118,8 +141,10 @@ public:
nsresult HandledWindowedPluginKeyEvent( nsresult HandledWindowedPluginKeyEvent(
const mozilla::NativeEventData& aKeyEventData, const mozilla::NativeEventData& aKeyEventData,
bool aIsConsumed); bool aIsConsumed);
#ifdef MOZ_ENABLE_NPAPI
nsPluginInstanceOwner* GetOwner(); nsPluginInstanceOwner* GetOwner();
void SetOwner(nsPluginInstanceOwner *aOwner); void SetOwner(nsPluginInstanceOwner *aOwner);
#endif
void DidComposite(); void DidComposite();
bool HasAudioChannelAgent() const bool HasAudioChannelAgent() const
@@ -131,7 +156,9 @@ public:
nsresult SetMuted(bool aIsMuted); nsresult SetMuted(bool aIsMuted);
#ifdef MOZ_ENABLE_NPAPI
nsNPAPIPlugin* GetPlugin(); nsNPAPIPlugin* GetPlugin();
#endif
nsresult GetNPP(NPP * aNPP); nsresult GetNPP(NPP * aNPP);
@@ -154,9 +181,10 @@ public:
} }
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
nsresult NewStreamListener(const char* aURL, void* notifyData, nsresult NewStreamListener(const char* aURL, void* notifyData,
nsNPAPIPluginStreamListener** listener); nsNPAPIPluginStreamListener** listener);
#endif
nsNPAPIPluginInstance(); nsNPAPIPluginInstance();
// To be called when an instance becomes orphaned, when // To be called when an instance becomes orphaned, when
@@ -196,9 +224,11 @@ public:
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
#ifdef MOZ_ENABLE_NPAPI
nsTArray<nsNPAPIPluginStreamListener*> *StreamListeners(); nsTArray<nsNPAPIPluginStreamListener*> *StreamListeners();
nsTArray<nsPluginStreamListenerPeer*> *FileCachedStreamListeners(); nsTArray<nsPluginStreamListenerPeer*> *FileCachedStreamListeners();
#endif
nsresult AsyncSetWindow(NPWindow& window); nsresult AsyncSetWindow(NPWindow& window);
@@ -240,7 +270,9 @@ protected:
virtual ~nsNPAPIPluginInstance(); virtual ~nsNPAPIPluginInstance();
#ifdef MOZ_ENABLE_NPAPI
nsresult GetTagType(nsPluginTagType *result); nsresult GetTagType(nsPluginTagType *result);
#endif
nsresult GetMode(int32_t *result); nsresult GetMode(int32_t *result);
// check if this is a Java applet and affected by bug 750480 // check if this is a Java applet and affected by bug 750480
@@ -275,19 +307,22 @@ public:
nsXPIDLCString mFakeURL; nsXPIDLCString mFakeURL;
private: private:
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsNPAPIPlugin> mPlugin; RefPtr<nsNPAPIPlugin> mPlugin;
nsTArray<nsNPAPIPluginStreamListener*> mStreamListeners; nsTArray<nsNPAPIPluginStreamListener*> mStreamListeners;
nsTArray<nsPluginStreamListenerPeer*> mFileCachedStreamListeners; nsTArray<nsPluginStreamListenerPeer*> mFileCachedStreamListeners;
#endif
nsTArray<PopupControlState> mPopupStates; nsTArray<PopupControlState> mPopupStates;
char* mMIMEType; char* mMIMEType;
// Weak pointer to the owner. The owner nulls this out (by calling // Weak pointer to the owner. The owner nulls this out (by calling
// InvalidateOwner()) when it's no longer our owner. // InvalidateOwner()) when it's no longer our owner.
#ifdef MOZ_ENABLE_NPAPI
nsPluginInstanceOwner *mOwner; nsPluginInstanceOwner *mOwner;
#endif
nsTArray<nsNPAPITimer*> mTimers; nsTArray<nsNPAPITimer*> mTimers;
+95 -10
View File
@@ -12,12 +12,18 @@
#include <stdio.h> #include <stdio.h>
#include "prio.h" #include "prio.h"
#include "prmem.h" #include "prmem.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPlugin.h" #include "nsNPAPIPlugin.h"
#include "nsNPAPIPluginStreamListener.h" #include "nsNPAPIPluginStreamListener.h"
#endif
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#endif
#include "nsObjectLoadingContent.h" #include "nsObjectLoadingContent.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIHTTPHeaderListener.h" #include "nsIHTTPHeaderListener.h"
#endif
#include "nsIHttpHeaderVisitor.h" #include "nsIHttpHeaderVisitor.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsIHttpProtocolHandler.h" #include "nsIHttpProtocolHandler.h"
@@ -50,13 +56,17 @@
#include "nsIObjectLoadingContent.h" #include "nsIObjectLoadingContent.h"
#include "nsIWritablePropertyBag2.h" #include "nsIWritablePropertyBag2.h"
#include "nsICategoryManager.h" #include "nsICategoryManager.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginStreamListenerPeer.h" #include "nsPluginStreamListenerPeer.h"
#endif
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/FakePluginTagInitBinding.h" #include "mozilla/dom/FakePluginTagInitBinding.h"
#include "mozilla/LoadInfo.h" #include "mozilla/LoadInfo.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginAsyncSurrogate.h" #include "mozilla/plugins/PluginAsyncSurrogate.h"
#include "mozilla/plugins/PluginBridge.h" #include "mozilla/plugins/PluginBridge.h"
#include "mozilla/plugins/PluginTypes.h" #include "mozilla/plugins/PluginTypes.h"
#endif
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsEnumeratorUtils.h" #include "nsEnumeratorUtils.h"
@@ -107,8 +117,10 @@
using namespace mozilla; using namespace mozilla;
using mozilla::TimeStamp; using mozilla::TimeStamp;
#ifdef MOZ_ENABLE_NPAPI
using mozilla::plugins::PluginTag; using mozilla::plugins::PluginTag;
using mozilla::plugins::PluginAsyncSurrogate; using mozilla::plugins::PluginAsyncSurrogate;
#endif
using mozilla::dom::FakePluginTagInit; using mozilla::dom::FakePluginTagInit;
// Null out a strong ref to a linked list iteratively to avoid // Null out a strong ref to a linked list iteratively to avoid
@@ -259,6 +271,7 @@ nsPluginHost::nsPluginHost()
// No need to initialize members to nullptr, false etc because this class // No need to initialize members to nullptr, false etc because this class
// has a zeroing operator new. // has a zeroing operator new.
{ {
#ifdef MOZ_ENABLE_NPAPI
// Bump the pluginchanged epoch on startup. This insures content gets a // Bump the pluginchanged epoch on startup. This insures content gets a
// good plugin list the first time it requests it. Normally we'd just // good plugin list the first time it requests it. Normally we'd just
// init this to 1, but due to the unique nature of our ctor we need to do // init this to 1, but due to the unique nature of our ctor we need to do
@@ -272,6 +285,7 @@ nsPluginHost::nsPluginHost()
nsCOMPtr<nsIProtocolProxyService> proxyService = nsCOMPtr<nsIProtocolProxyService> proxyService =
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID); do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID);
} }
#endif
// check to see if pref is set at startup to let plugins take over in // check to see if pref is set at startup to let plugins take over in
// full page mode for certain image mime types that we handle internally // full page mode for certain image mime types that we handle internally
@@ -329,6 +343,7 @@ nsPluginHost::GetInst()
bool nsPluginHost::IsRunningPlugin(nsPluginTag * aPluginTag) bool nsPluginHost::IsRunningPlugin(nsPluginTag * aPluginTag)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!aPluginTag || !aPluginTag->mPlugin) { if (!aPluginTag || !aPluginTag->mPlugin) {
return false; return false;
} }
@@ -345,12 +360,14 @@ bool nsPluginHost::IsRunningPlugin(nsPluginTag * aPluginTag)
return true; return true;
} }
} }
#endif
return false; return false;
} }
nsresult nsPluginHost::ReloadPlugins() nsresult nsPluginHost::ReloadPlugins()
{ {
#ifdef MOZ_ENABLE_NPAPI
PLUGIN_LOG(PLUGIN_LOG_NORMAL, PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("nsPluginHost::ReloadPlugins Begin\n")); ("nsPluginHost::ReloadPlugins Begin\n"));
@@ -413,6 +430,9 @@ nsresult nsPluginHost::ReloadPlugins()
("nsPluginHost::ReloadPlugins End\n")); ("nsPluginHost::ReloadPlugins End\n"));
return rv; return rv;
#else
return NS_ERROR_FAILURE;
#endif
} }
#define NS_RETURN_UASTRING_SIZE 128 #define NS_RETURN_UASTRING_SIZE 128
@@ -455,7 +475,7 @@ nsresult nsPluginHost::UserAgent(const char **retstring)
return res; return res;
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsPluginHost::GetURL(nsISupports* pluginInst, nsresult nsPluginHost::GetURL(nsISupports* pluginInst,
const char* url, const char* url,
const char* target, const char* target,
@@ -581,7 +601,7 @@ nsresult nsPluginHost::PostURL(nsISupports* pluginInst,
} }
return rv; return rv;
} }
#endif
/* This method queries the prefs for proxy information. /* This method queries the prefs for proxy information.
* It has been tested and is known to work in the following three cases * It has been tested and is known to work in the following three cases
* when no proxy host or port is specified * when no proxy host or port is specified
@@ -707,6 +727,7 @@ nsresult nsPluginHost::UnloadPlugins()
void nsPluginHost::OnPluginInstanceDestroyed(nsPluginTag* aPluginTag) void nsPluginHost::OnPluginInstanceDestroyed(nsPluginTag* aPluginTag)
{ {
#ifdef MOZ_ENABLE_NPAPI
bool hasInstance = false; bool hasInstance = false;
for (uint32_t i = 0; i < mInstances.Length(); i++) { for (uint32_t i = 0; i < mInstances.Length(); i++) {
if (TagForPlugin(mInstances[i]->GetPlugin()) == aPluginTag) { if (TagForPlugin(mInstances[i]->GetPlugin()) == aPluginTag) {
@@ -747,6 +768,7 @@ void nsPluginHost::OnPluginInstanceDestroyed(nsPluginTag* aPluginTag)
nsITimer::TYPE_ONE_SHOT); nsITimer::TYPE_ONE_SHOT);
} }
} }
#endif // MOZ_ENABLE_NPAPI
} }
nsresult nsresult
@@ -770,6 +792,7 @@ nsPluginHost::GetPluginTempDir(nsIFile **aDir)
return sPluginTempDir->Clone(aDir); return sPluginTempDir->Clone(aDir);
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aURL, nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aURL,
nsObjectLoadingContent *aContent, nsObjectLoadingContent *aContent,
@@ -854,6 +877,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
return NS_OK; return NS_OK;
} }
#endif // MOZ_ENABLE_NPAPI
nsPluginTag* nsPluginTag*
nsPluginHost::FindTagForLibrary(PRLibrary* aLibrary) nsPluginHost::FindTagForLibrary(PRLibrary* aLibrary)
@@ -866,7 +890,7 @@ nsPluginHost::FindTagForLibrary(PRLibrary* aLibrary)
} }
return nullptr; return nullptr;
} }
#ifdef MOZ_ENABLE_NPAPI
nsPluginTag* nsPluginTag*
nsPluginHost::TagForPlugin(nsNPAPIPlugin* aPlugin) nsPluginHost::TagForPlugin(nsNPAPIPlugin* aPlugin)
{ {
@@ -986,6 +1010,7 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType,
return rv; return rv;
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
nsPluginHost::HavePluginForType(const nsACString & aMimeType, nsPluginHost::HavePluginForType(const nsACString & aMimeType,
@@ -1296,7 +1321,7 @@ nsPluginHost::FindNativePluginForExtension(const nsACString & aExtension,
preferredPlugin->HasExtension(aExtension, aMimeType); preferredPlugin->HasExtension(aExtension, aMimeType);
return preferredPlugin; return preferredPlugin;
} }
#ifdef MOZ_ENABLE_NPAPI
static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag, static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
nsNPAPIPlugin **aOutNPAPIPlugin) nsNPAPIPlugin **aOutNPAPIPlugin)
{ {
@@ -1320,9 +1345,11 @@ static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
return rv; return rv;
} }
#endif
nsresult nsPluginHost::EnsurePluginLoaded(nsPluginTag* aPluginTag) nsresult nsPluginHost::EnsurePluginLoaded(nsPluginTag* aPluginTag)
{ {
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsNPAPIPlugin> plugin = aPluginTag->mPlugin; RefPtr<nsNPAPIPlugin> plugin = aPluginTag->mPlugin;
if (!plugin) { if (!plugin) {
nsresult rv = CreateNPAPIPlugin(aPluginTag, getter_AddRefs(plugin)); nsresult rv = CreateNPAPIPlugin(aPluginTag, getter_AddRefs(plugin));
@@ -1365,7 +1392,7 @@ nsPluginHost::GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPl
NS_ADDREF(*aPlugin = pluginTag->mPlugin); NS_ADDREF(*aPlugin = pluginTag->mPlugin);
return NS_OK; return NS_OK;
} }
#endif // MOZ_ENABLE_NPAPI
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@@ -1411,7 +1438,7 @@ nsPluginHost::NotifyContentModuleDestroyed(uint32_t aPluginId)
new nsPluginUnloadRunnable(aPluginId); new nsPluginUnloadRunnable(aPluginId);
NS_DispatchToMainThread(runnable); NS_DispatchToMainThread(runnable);
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsPluginHost::GetPlugin(const nsACString &aMimeType, nsresult nsPluginHost::GetPlugin(const nsACString &aMimeType,
nsNPAPIPlugin** aPlugin) nsNPAPIPlugin** aPlugin)
{ {
@@ -1450,6 +1477,7 @@ nsresult nsPluginHost::GetPlugin(const nsACString &aMimeType,
return rv; return rv;
} }
#endif
// Normalize 'host' to ACE. // Normalize 'host' to ACE.
nsresult nsresult
@@ -1605,6 +1633,7 @@ nsPluginHost::GetFakePlugin(const nsACString & aMimeType,
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
#ifdef MOZ_ENABLE_NPAPI
#define ClearDataFromSitesClosure_CID {0x9fb21761, 0x2403, 0x41ad, {0x9e, 0xfd, 0x36, 0x7e, 0xc4, 0x4f, 0xa4, 0x5e}} #define ClearDataFromSitesClosure_CID {0x9fb21761, 0x2403, 0x41ad, {0x9e, 0xfd, 0x36, 0x7e, 0xc4, 0x4f, 0xa4, 0x5e}}
@@ -1670,12 +1699,14 @@ NS_INTERFACE_MAP_BEGIN(ClearDataFromSitesClosure)
NS_INTERFACE_MAP_ENTRY(nsIGetSitesWithDataCallback) NS_INTERFACE_MAP_ENTRY(nsIGetSitesWithDataCallback)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIClearSiteDataCallback) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIClearSiteDataCallback)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
#endif // MOZ_ENABLE_NPAPI
// FIXME-jsplugins what should this do for fake plugins? // FIXME-jsplugins what should this do for fake plugins?
NS_IMETHODIMP NS_IMETHODIMP
nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain, nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain,
uint64_t flags, int64_t maxAge, nsIClearSiteDataCallback* callbackFunc) uint64_t flags, int64_t maxAge, nsIClearSiteDataCallback* callbackFunc)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsIClearSiteDataCallback> callback(callbackFunc); nsCOMPtr<nsIClearSiteDataCallback> callback(callbackFunc);
// maxAge must be either a nonnegative integer or -1. // maxAge must be either a nonnegative integer or -1.
NS_ENSURE_ARG(maxAge >= 0 || maxAge == -1); NS_ENSURE_ARG(maxAge >= 0 || maxAge == -1);
@@ -1695,7 +1726,9 @@ nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain,
// We will also attempt to clear data for any plugin that happens // We will also attempt to clear data for any plugin that happens
// to be loaded already. // to be loaded already.
if (!tag->mIsFlashPlugin && !tag->mPlugin) { if (!tag->mIsFlashPlugin && !tag->mPlugin) {
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
} }
// Make sure the plugin is loaded. // Make sure the plugin is loaded.
@@ -1715,8 +1748,11 @@ nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain,
rv = library->NPP_GetSitesWithData(closure); rv = library->NPP_GetSitesWithData(closure);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return NS_OK; return NS_OK;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
#define GetSitesClosure_CID {0x4c9268ac, 0x2fd1, 0x4f2a, {0x9a, 0x10, 0x7a, 0x09, 0xf1, 0xb7, 0x60, 0x3a}} #define GetSitesClosure_CID {0x4c9268ac, 0x2fd1, 0x4f2a, {0x9a, 0x10, 0x7a, 0x09, 0xf1, 0xb7, 0x60, 0x3a}}
// Closure to contain the data needed to handle the callback from NPP_GetSitesWithData // Closure to contain the data needed to handle the callback from NPP_GetSitesWithData
@@ -1771,12 +1807,15 @@ NS_DEFINE_STATIC_IID_ACCESSOR(GetSitesClosure, GetSitesClosure_CID)
NS_IMPL_ISUPPORTS(GetSitesClosure, GetSitesClosure, nsIGetSitesWithDataCallback) NS_IMPL_ISUPPORTS(GetSitesClosure, GetSitesClosure, nsIGetSitesWithDataCallback)
#endif
// This will spin the event loop while waiting on an async // This will spin the event loop while waiting on an async
// call to GetSitesWithData // call to GetSitesWithData
NS_IMETHODIMP NS_IMETHODIMP
nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain, nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain,
bool* result) bool* result)
{ {
#ifdef MOZ_ENABLE_NPAPI
// Caller may give us a tag object that is no longer live. // Caller may give us a tag object that is no longer live.
if (!IsLiveTag(plugin)) { if (!IsLiveTag(plugin)) {
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
@@ -1789,7 +1828,9 @@ nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain,
// We will also attempt to clear data for any plugin that happens // We will also attempt to clear data for any plugin that happens
// to be loaded already. // to be loaded already.
if (!tag->mIsFlashPlugin && !tag->mPlugin) { if (!tag->mIsFlashPlugin && !tag->mPlugin) {
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
} }
// Make sure the plugin is loaded. // Make sure the plugin is loaded.
@@ -1810,6 +1851,7 @@ nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain,
} }
*result = closure->result; *result = closure->result;
return closure->retVal; return closure->retVal;
#endif
} }
nsPluginHost::SpecialType nsPluginHost::SpecialType
@@ -2022,12 +2064,15 @@ nsPluginHost::AddPluginTag(nsPluginTag* aPluginTag)
} }
} }
#ifdef MOZ_ENABLE_NPAPI
typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void); typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void);
#endif
nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
bool aCreatePluginList, bool aCreatePluginList,
bool *aPluginsChanged) bool *aPluginsChanged)
{ {
#ifdef MOZ_ENABLE_NPAPI
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
NS_ENSURE_ARG_POINTER(aPluginsChanged); NS_ENSURE_ARG_POINTER(aPluginsChanged);
@@ -2211,6 +2256,9 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum, nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
@@ -2296,6 +2344,7 @@ WatchRegKey(uint32_t aRoot, nsCOMPtr<nsIWindowsRegKey>& aKey)
nsresult nsPluginHost::LoadPlugins() nsresult nsPluginHost::LoadPlugins()
{ {
#ifdef MOZ_ENABLE_NPAPI
// do not do anything if it is already done // do not do anything if it is already done
// use ReloadPlugins() to enforce loading // use ReloadPlugins() to enforce loading
if (mPluginsLoaded) if (mPluginsLoaded)
@@ -2327,8 +2376,12 @@ nsresult nsPluginHost::LoadPlugins()
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsPluginHost::FindPluginsInContent(bool aCreatePluginList, bool* aPluginsChanged) nsPluginHost::FindPluginsInContent(bool aCreatePluginList, bool* aPluginsChanged)
{ {
@@ -2406,7 +2459,7 @@ nsresult nsPluginHost::FindPlugins(bool aCreatePluginList, bool * aPluginsChange
if (ReadPluginInfo() == NS_ERROR_NOT_AVAILABLE) if (ReadPluginInfo() == NS_ERROR_NOT_AVAILABLE)
return NS_OK; return NS_OK;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// Failure here is not a show-stopper so just warn. // Failure here is not a show-stopper so just warn.
rv = EnsurePrivateDirServiceProvider(); rv = EnsurePrivateDirServiceProvider();
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to register dir service provider."); NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to register dir service provider.");
@@ -2618,6 +2671,7 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch,
} }
return NS_OK; return NS_OK;
} }
#endif
void void
nsPluginHost::UpdateInMemoryPluginInfo(nsPluginTag* aPluginTag) nsPluginHost::UpdateInMemoryPluginInfo(nsPluginTag* aPluginTag)
@@ -3143,7 +3197,7 @@ nsPluginHost::RemoveCachedPluginsInfo(const char *filePath, nsPluginTag **result
} }
} }
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
nsresult nsresult
nsPluginHost::EnsurePrivateDirServiceProvider() nsPluginHost::EnsurePrivateDirServiceProvider()
{ {
@@ -3161,6 +3215,7 @@ nsPluginHost::EnsurePrivateDirServiceProvider()
} }
#endif /* XP_WIN */ #endif /* XP_WIN */
#ifdef MOZ_ENABLE_NPAPI
nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL, nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
nsNPAPIPluginInstance *aInstance, nsNPAPIPluginInstance *aInstance,
nsNPAPIPluginStreamListener* aListener, nsNPAPIPluginStreamListener* aListener,
@@ -3285,6 +3340,7 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
listenerPeer->TrackRequest(channel); listenerPeer->TrackRequest(channel);
return rv; return rv;
} }
#endif // MOZ_ENABLE_NPAPI
nsresult nsresult
nsPluginHost::AddHeadersToChannel(const char *aHeadersData, nsPluginHost::AddHeadersToChannel(const char *aHeadersData,
@@ -3342,6 +3398,7 @@ nsPluginHost::AddHeadersToChannel(const char *aHeadersData,
nsresult nsresult
nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance) nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance)
{ {
#ifdef MOZ_ENABLE_NPAPI
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
if (PluginDestructionGuard::DelayDestroy(aInstance)) { if (PluginDestructionGuard::DelayDestroy(aInstance)) {
return NS_OK; return NS_OK;
@@ -3386,12 +3443,16 @@ nsPluginHost::StopPluginInstance(nsNPAPIPluginInstance* aInstance)
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsPluginHost::NewPluginStreamListener(nsIURI* aURI, nsresult nsPluginHost::NewPluginStreamListener(nsIURI* aURI,
nsNPAPIPluginInstance* aInstance, nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener) nsIStreamListener **aStreamListener)
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ENSURE_ARG_POINTER(aURI); NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aStreamListener); NS_ENSURE_ARG_POINTER(aStreamListener);
@@ -3404,8 +3465,12 @@ nsresult nsPluginHost::NewPluginStreamListener(nsIURI* aURI,
listener.forget(aStreamListener); listener.forget(aStreamListener);
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
#ifdef MOZ_ENABLE_NPAPI
void nsPluginHost::CreateWidget(nsPluginInstanceOwner* aOwner) void nsPluginHost::CreateWidget(nsPluginInstanceOwner* aOwner)
{ {
aOwner->CreateWidget(); aOwner->CreateWidget();
@@ -3413,11 +3478,13 @@ void nsPluginHost::CreateWidget(nsPluginInstanceOwner* aOwner)
// If we've got a native window, the let the plugin know about it. // If we've got a native window, the let the plugin know about it.
aOwner->CallSetWindow(); aOwner->CallSetWindow();
} }
#endif
NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject, NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const char16_t *someData) const char16_t *someData)
{ {
#ifdef MOZ_ENABLE_NPAPI
if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) { if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) {
OnShutdown(); OnShutdown();
UnloadPlugins(); UnloadPlugins();
@@ -3441,6 +3508,9 @@ NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject,
} }
return NS_OK; return NS_OK;
#else
return NS_ERROR_FAILURE;
#endif
} }
nsresult nsresult
@@ -3696,20 +3766,24 @@ nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile)
return rv; return rv;
} }
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
nsPluginHost::NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow) nsPluginHost::NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
{ {
return PLUG_NewPluginNativeWindow(aPluginNativeWindow); return PLUG_NewPluginNativeWindow(aPluginNativeWindow);
} }
#endif
nsresult nsresult
nsPluginHost::GetPluginName(nsNPAPIPluginInstance *aPluginInstance, nsPluginHost::GetPluginName(nsNPAPIPluginInstance *aPluginInstance,
const char** aPluginName) const char** aPluginName)
{ {
#ifdef MOZ_ENABLE_NPAPI
nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(aPluginInstance); nsNPAPIPluginInstance *instance = static_cast<nsNPAPIPluginInstance*>(aPluginInstance);
if (!instance) if (!instance)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
nsNPAPIPlugin* plugin = instance->GetPlugin(); nsNPAPIPlugin* plugin = instance->GetPlugin();
if (!plugin) if (!plugin)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -3717,23 +3791,28 @@ nsPluginHost::GetPluginName(nsNPAPIPluginInstance *aPluginInstance,
*aPluginName = TagForPlugin(plugin)->Name().get(); *aPluginName = TagForPlugin(plugin)->Name().get();
return NS_OK; return NS_OK;
#endif
} }
nsresult nsresult
nsPluginHost::GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance, nsPluginHost::GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance,
nsIPluginTag **aPluginTag) nsIPluginTag **aPluginTag)
{ {
#ifdef MOZ_ENABLE_NPAPI
NS_ENSURE_ARG_POINTER(aPluginInstance); NS_ENSURE_ARG_POINTER(aPluginInstance);
NS_ENSURE_ARG_POINTER(aPluginTag); NS_ENSURE_ARG_POINTER(aPluginTag);
nsNPAPIPlugin *plugin = aPluginInstance->GetPlugin(); nsNPAPIPlugin *plugin = aPluginInstance->GetPlugin();
if (!plugin) if (!plugin)
#endif
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
#ifdef MOZ_ENABLE_NPAPI
*aPluginTag = TagForPlugin(plugin); *aPluginTag = TagForPlugin(plugin);
NS_ADDREF(*aPluginTag); NS_ADDREF(*aPluginTag);
return NS_OK; return NS_OK;
#endif
} }
NS_IMETHODIMP nsPluginHost::Notify(nsITimer* timer) NS_IMETHODIMP nsPluginHost::Notify(nsITimer* timer)
@@ -3800,6 +3879,7 @@ CheckForDisabledWindows()
} }
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
void void
nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin, nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin,
const nsAString& pluginDumpID, const nsAString& pluginDumpID,
@@ -3872,6 +3952,7 @@ nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin,
CheckForDisabledWindows(); CheckForDisabledWindows();
#endif #endif
} }
#endif // MOZ_ENABLE_NPAPI
nsNPAPIPluginInstance* nsNPAPIPluginInstance*
nsPluginHost::FindInstance(const char *mimetype) nsPluginHost::FindInstance(const char *mimetype)
@@ -3932,6 +4013,7 @@ nsPluginHost::InstanceArray()
void void
nsPluginHost::DestroyRunningInstances(nsPluginTag* aPluginTag) nsPluginHost::DestroyRunningInstances(nsPluginTag* aPluginTag)
{ {
#ifdef MOZ_ENABLE_NPAPI
for (int32_t i = mInstances.Length(); i > 0; i--) { for (int32_t i = mInstances.Length(); i > 0; i--) {
nsNPAPIPluginInstance *instance = mInstances[i - 1]; nsNPAPIPluginInstance *instance = mInstances[i - 1];
if (instance->IsRunning() && (!aPluginTag || aPluginTag == TagForPlugin(instance->GetPlugin()))) { if (instance->IsRunning() && (!aPluginTag || aPluginTag == TagForPlugin(instance->GetPlugin()))) {
@@ -3958,6 +4040,7 @@ nsPluginHost::DestroyRunningInstances(nsPluginTag* aPluginTag)
} }
} }
} }
#endif
} }
// Runnable that does an async destroy of a plugin. // Runnable that does an async destroy of a plugin.
@@ -4029,13 +4112,14 @@ PRCList nsPluginDestroyRunnable::sRunnableListHead =
PRCList PluginDestructionGuard::sListHead = PRCList PluginDestructionGuard::sListHead =
PR_INIT_STATIC_CLIST(&PluginDestructionGuard::sListHead); PR_INIT_STATIC_CLIST(&PluginDestructionGuard::sListHead);
#ifdef MOZ_ENABLE_NPAPI
PluginDestructionGuard::PluginDestructionGuard(nsNPAPIPluginInstance *aInstance) PluginDestructionGuard::PluginDestructionGuard(nsNPAPIPluginInstance *aInstance)
: mInstance(aInstance) : mInstance(aInstance)
{ {
Init(); Init();
} }
PluginDestructionGuard::PluginDestructionGuard(PluginAsyncSurrogate *aSurrogate) PluginDestructionGuard::PluginDestructionGuard(PluginAsyncSurrogate *aSurrogate)
: mInstance(static_cast<nsNPAPIPluginInstance*>(aSurrogate->GetNPP()->ndata)) : mInstance(static_cast<nsNPAPIPluginInstance*>(aSurrogate->GetNPP()->ndata))
{ {
@@ -4047,6 +4131,7 @@ PluginDestructionGuard::PluginDestructionGuard(NPP npp)
{ {
Init(); Init();
} }
#endif
PluginDestructionGuard::~PluginDestructionGuard() PluginDestructionGuard::~PluginDestructionGuard()
{ {
+42 -15
View File
@@ -12,7 +12,9 @@
#include "prlink.h" #include "prlink.h"
#include "prclist.h" #include "prclist.h"
#include "nsIPluginTag.h" #include "nsIPluginTag.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginsDir.h" #include "nsPluginsDir.h"
#endif
#include "nsPluginDirServiceProvider.h" #include "nsPluginDirServiceProvider.h"
#include "nsWeakPtr.h" #include "nsWeakPtr.h"
#include "nsIPrompt.h" #include "nsIPrompt.h"
@@ -38,16 +40,24 @@ class PluginTag;
} // namespace plugins } // namespace plugins
} // namespace mozilla } // namespace mozilla
#ifdef MOZ_ENABLE_NPAPI
class nsNPAPIPlugin; class nsNPAPIPlugin;
#endif
class nsIFile; class nsIFile;
class nsIChannel; class nsIChannel;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginNativeWindow; class nsPluginNativeWindow;
#endif
class nsObjectLoadingContent; class nsObjectLoadingContent;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginInstanceOwner; class nsPluginInstanceOwner;
#endif
class nsPluginUnloadRunnable; class nsPluginUnloadRunnable;
class nsNPAPIPluginInstance; class nsNPAPIPluginInstance;
#ifdef MOZ_ENABLE_NPAPI
class nsNPAPIPluginStreamListener; class nsNPAPIPluginStreamListener;
class nsIPluginInstanceOwner; class nsIPluginInstanceOwner;
#endif
class nsIInputStream; class nsIInputStream;
class nsIStreamListener; class nsIStreamListener;
#ifndef npapi_h_ #ifndef npapi_h_
@@ -82,8 +92,9 @@ class nsPluginHost final : public nsIPluginHost,
public: public:
nsPluginHost(); nsPluginHost();
#ifdef MOZ_ENABLE_NPAPI
static already_AddRefed<nsPluginHost> GetInst(); static already_AddRefed<nsPluginHost> GetInst();
#endif
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
@@ -94,11 +105,11 @@ public:
nsresult LoadPlugins(); nsresult LoadPlugins();
nsresult UnloadPlugins(); nsresult UnloadPlugins();
#ifdef MOZ_ENABLE_NPAPI
nsresult SetUpPluginInstance(const nsACString &aMimeType, nsresult SetUpPluginInstance(const nsACString &aMimeType,
nsIURI *aURL, nsIURI *aURL,
nsPluginInstanceOwner *aOwner); nsPluginInstanceOwner *aOwner);
#endif
// Acts like a bitfield // Acts like a bitfield
enum PluginFilter { enum PluginFilter {
eExcludeNone = nsIPluginHost::EXCLUDE_NONE, eExcludeNone = nsIPluginHost::EXCLUDE_NONE,
@@ -113,7 +124,7 @@ public:
bool HavePluginForExtension(const nsACString & aExtension, bool HavePluginForExtension(const nsACString & aExtension,
/* out */ nsACString & aMimeType, /* out */ nsACString & aMimeType,
PluginFilter aFilter = eExcludeDisabled); PluginFilter aFilter = eExcludeDisabled);
#ifdef MOZ_ENABLE_NPAPI
void GetPlugins(nsTArray<nsCOMPtr<nsIInternalPluginTag>>& aPluginArray, void GetPlugins(nsTArray<nsCOMPtr<nsIInternalPluginTag>>& aPluginArray,
bool aIncludeDisabled = false); bool aIncludeDisabled = false);
@@ -140,6 +151,7 @@ public:
bool forceJSEnabled, bool forceJSEnabled,
uint32_t postHeadersLength, uint32_t postHeadersLength,
const char* postHeaders); const char* postHeaders);
#endif
nsresult FindProxyForURL(const char* url, char* *result); nsresult FindProxyForURL(const char* url, char* *result);
nsresult UserAgent(const char **retstring); nsresult UserAgent(const char **retstring);
@@ -148,17 +160,18 @@ public:
char **outPostData, char **outPostData,
uint32_t *outPostDataLen); uint32_t *outPostDataLen);
nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile); nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile);
#ifdef MOZ_ENABLE_NPAPI
nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow); nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible); void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible);
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame); void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
#endif
nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance, nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance,
const char** aPluginName); const char** aPluginName);
nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance); nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance);
nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance, nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance,
nsIPluginTag **aPluginTag); nsIPluginTag **aPluginTag);
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
NewPluginURLStream(const nsString& aURL, NewPluginURLStream(const nsString& aURL,
nsNPAPIPluginInstance *aInstance, nsNPAPIPluginInstance *aInstance,
@@ -177,6 +190,7 @@ public:
bool forceJSEnabled = false, bool forceJSEnabled = false,
uint32_t getHeadersLength = 0, uint32_t getHeadersLength = 0,
const char* getHeaders = nullptr); const char* getHeaders = nullptr);
#endif
nsresult nsresult
AddHeadersToChannel(const char *aHeadersData, uint32_t aHeadersDataLen, AddHeadersToChannel(const char *aHeadersData, uint32_t aHeadersDataLen,
@@ -192,7 +206,7 @@ public:
// parent process. It checks the plugin.load_in_parent_process.<mime> pref. // parent process. It checks the plugin.load_in_parent_process.<mime> pref.
// Always returns false if plugin.load_in_parent_process.<mime> is not set. // Always returns false if plugin.load_in_parent_process.<mime> is not set.
static bool ShouldLoadTypeInParent(const nsACString& aMimeType); static bool ShouldLoadTypeInParent(const nsACString& aMimeType);
#ifdef MOZ_ENABLE_NPAPI
// checks whether aType is a type we recognize for potential special handling // checks whether aType is a type we recognize for potential special handling
enum SpecialType { eSpecialType_None, enum SpecialType { eSpecialType_None,
// Needed to whitelist for async init support // Needed to whitelist for async init support
@@ -211,12 +225,15 @@ public:
// Native widget quirks // Native widget quirks
eSpecialType_Unity }; eSpecialType_Unity };
static SpecialType GetSpecialType(const nsACString & aMIMEType); static SpecialType GetSpecialType(const nsACString & aMIMEType);
#endif
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary); static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
#ifdef MOZ_ENABLE_NPAPI
void PluginCrashed(nsNPAPIPlugin* plugin, void PluginCrashed(nsNPAPIPlugin* plugin,
const nsAString& pluginDumpID, const nsAString& pluginDumpID,
const nsAString& browserDumpID); const nsAString& browserDumpID);
#endif
nsNPAPIPluginInstance *FindInstance(const char *mimetype); nsNPAPIPluginInstance *FindInstance(const char *mimetype);
nsNPAPIPluginInstance *FindOldestStoppedInstance(); nsNPAPIPluginInstance *FindOldestStoppedInstance();
@@ -227,6 +244,7 @@ public:
// Return the tag for |aLibrary| if found, nullptr if not. // Return the tag for |aLibrary| if found, nullptr if not.
nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary); nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary);
#ifdef MOZ_ENABLE_NPAPI
// The last argument should be false if we already have an in-flight stream // The last argument should be false if we already have an in-flight stream
// and don't need to set up a new stream. // and don't need to set up a new stream.
nsresult InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aURL, nsresult InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aURL,
@@ -235,19 +253,22 @@ public:
// Does not accept nullptr and should never fail. // Does not accept nullptr and should never fail.
nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin); nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin);
#endif
nsPluginTag* PluginWithId(uint32_t aId); nsPluginTag* PluginWithId(uint32_t aId);
#ifdef MOZ_ENABLE_NPAPI
nsresult GetPlugin(const nsACString &aMimeType, nsNPAPIPlugin** aPlugin); nsresult GetPlugin(const nsACString &aMimeType, nsNPAPIPlugin** aPlugin);
nsresult GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPlugin); nsresult GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPlugin);
#endif
void NotifyContentModuleDestroyed(uint32_t aPluginId); void NotifyContentModuleDestroyed(uint32_t aPluginId);
nsresult NewPluginStreamListener(nsIURI* aURL, nsresult NewPluginStreamListener(nsIURI* aURL,
nsNPAPIPluginInstance* aInstance, nsNPAPIPluginInstance* aInstance,
nsIStreamListener **aStreamListener); nsIStreamListener **aStreamListener);
#ifdef MOZ_ENABLE_NPAPI
void CreateWidget(nsPluginInstanceOwner* aOwner); void CreateWidget(nsPluginInstanceOwner* aOwner);
#endif
nsresult EnumerateSiteData(const nsACString& domain, nsresult EnumerateSiteData(const nsACString& domain,
const InfallibleTArray<nsCString>& sites, const InfallibleTArray<nsCString>& sites,
InfallibleTArray<nsCString>& result, InfallibleTArray<nsCString>& result,
@@ -261,9 +282,10 @@ private:
// Writes updated plugins settings to disk and unloads the plugin // Writes updated plugins settings to disk and unloads the plugin
// if it is now disabled. Should only be called by the plugin tag in question // if it is now disabled. Should only be called by the plugin tag in question
void UpdatePluginInfo(nsPluginTag* aPluginTag); void UpdatePluginInfo(nsPluginTag* aPluginTag);
#ifdef MOZ_ENABLE_NPAPI
nsresult TrySetUpPluginInstance(const nsACString &aMimeType, nsIURI *aURL, nsresult TrySetUpPluginInstance(const nsACString &aMimeType, nsIURI *aURL,
nsPluginInstanceOwner *aOwner); nsPluginInstanceOwner *aOwner);
#endif
// FIXME-jsplugins comment here about when things may be fake // FIXME-jsplugins comment here about when things may be fake
nsPluginTag* nsPluginTag*
@@ -298,7 +320,7 @@ private:
nsPluginTag* FindNativePluginForExtension(const nsACString & aExtension, nsPluginTag* FindNativePluginForExtension(const nsACString & aExtension,
/* out */ nsACString & aMimeType, /* out */ nsACString & aMimeType,
bool aCheckEnabled); bool aCheckEnabled);
#ifdef MOZ_ENABLE_NPAPI
nsresult nsresult
FindStoppedPluginForURL(nsIURI* aURL, nsIPluginInstanceOwner *aOwner); FindStoppedPluginForURL(nsIURI* aURL, nsIPluginInstanceOwner *aOwner);
@@ -306,7 +328,7 @@ private:
nsresult nsresult
FindPlugins(bool aCreatePluginList, bool * aPluginsChanged); FindPlugins(bool aCreatePluginList, bool * aPluginsChanged);
#endif
// FIXME revisit, no ns prefix // FIXME revisit, no ns prefix
// Registers or unregisters the given mime type with the category manager // Registers or unregisters the given mime type with the category manager
enum nsRegisterType { ePluginRegister, enum nsRegisterType { ePluginRegister,
@@ -351,9 +373,9 @@ private:
// Returns the first plugin at |path| // Returns the first plugin at |path|
nsPluginTag* FirstPluginWithPath(const nsCString& path); nsPluginTag* FirstPluginWithPath(const nsCString& path);
#ifdef MOZ_ENABLE_NPAPI
nsresult EnsurePrivateDirServiceProvider(); nsresult EnsurePrivateDirServiceProvider();
#endif
void OnPluginInstanceDestroyed(nsPluginTag* aPluginTag); void OnPluginInstanceDestroyed(nsPluginTag* aPluginTag);
// To be used by the chrome process whenever the set of plugins changes. // To be used by the chrome process whenever the set of plugins changes.
@@ -425,8 +447,11 @@ private:
class PluginDestructionGuard : protected PRCList class PluginDestructionGuard : protected PRCList
{ {
public: public:
#ifdef MOZ_ENABLE_NPAPI
explicit PluginDestructionGuard(nsNPAPIPluginInstance *aInstance); explicit PluginDestructionGuard(nsNPAPIPluginInstance *aInstance);
explicit PluginDestructionGuard(mozilla::plugins::PluginAsyncSurrogate *aSurrogate); explicit PluginDestructionGuard(mozilla::plugins::PluginAsyncSurrogate *aSurrogate);
#endif
explicit PluginDestructionGuard(NPP npp); explicit PluginDestructionGuard(NPP npp);
~PluginDestructionGuard(); ~PluginDestructionGuard();
@@ -434,6 +459,7 @@ public:
static bool DelayDestroy(nsNPAPIPluginInstance *aInstance); static bool DelayDestroy(nsNPAPIPluginInstance *aInstance);
protected: protected:
#ifdef MOZ_ENABLE_NPAPI
void Init() void Init()
{ {
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread"); NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
@@ -455,11 +481,12 @@ protected:
// that they appear to be at the bottom of the stack // that they appear to be at the bottom of the stack
PR_INSERT_AFTER(this, &sListHead); PR_INSERT_AFTER(this, &sListHead);
} }
#endif
RefPtr<nsNPAPIPluginInstance> mInstance; RefPtr<nsNPAPIPluginInstance> mInstance;
bool mDelayedDestroy; bool mDelayedDestroy;
static PRCList sListHead; static PRCList sListHead;
}; };
#endif // nsPluginHost_h_ #endif // nsPluginHost_h_
@@ -2936,6 +2936,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
// Try to get a parent widget, on some platforms widget creation will fail without // Try to get a parent widget, on some platforms widget creation will fail without
// a parent. // a parent.
nsCOMPtr<nsIWidget> parentWidget; nsCOMPtr<nsIWidget> parentWidget;
#ifdef MOZ_ENABLE_NPAPI
nsIDocument *doc = nullptr; nsIDocument *doc = nullptr;
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent); nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
if (content) { if (content) {
@@ -2959,6 +2960,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
} }
#endif // XP_MACOSX #endif // XP_MACOSX
} }
#endif // MOZ_ENABLE_NPAPI
#ifndef XP_MACOSX #ifndef XP_MACOSX
// A failure here is terminal since we can't fall back on the non-e10s code // A failure here is terminal since we can't fall back on the non-e10s code
+9 -1
View File
@@ -7,15 +7,19 @@
#include "prlink.h" #include "prlink.h"
#include "plstr.h" #include "plstr.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginInstanceOwner.h" #include "nsIPluginInstanceOwner.h"
#include "nsPluginsDir.h" #include "nsPluginsDir.h"
#endif
#include "nsPluginHost.h" #include "nsPluginHost.h"
#include "nsIBlocklistService.h" #include "nsIBlocklistService.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsIPlatformCharset.h" #include "nsIPlatformCharset.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsPluginLogging.h" #include "nsPluginLogging.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPlugin.h" #include "nsNPAPIPlugin.h"
#endif
#include "nsCharSeparatedTokenizer.h" #include "nsCharSeparatedTokenizer.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
@@ -30,6 +34,7 @@ using mozilla::dom::FakePluginTagInit;
using mozilla::dom::FakePluginMimeEntry; using mozilla::dom::FakePluginMimeEntry;
using namespace mozilla; using namespace mozilla;
#ifdef MOZ_ENABLE_NPAPI
// These legacy flags are used in the plugin registry. The states are now // These legacy flags are used in the plugin registry. The states are now
// stored in prefs, but we still need to be able to import them. // stored in prefs, but we still need to be able to import them.
#define NS_PLUGIN_FLAG_ENABLED 0x0001 // is this plugin enabled? #define NS_PLUGIN_FLAG_ENABLED 0x0001 // is this plugin enabled?
@@ -40,6 +45,7 @@ using namespace mozilla;
static const char kPrefDefaultEnabledState[] = "plugin.default.state"; static const char kPrefDefaultEnabledState[] = "plugin.default.state";
static const char kPrefDefaultEnabledStateXpi[] = "plugin.defaultXpi.state"; static const char kPrefDefaultEnabledStateXpi[] = "plugin.defaultXpi.state";
#endif // MOZ_ENABLE_NPAPI
// check comma delimited extensions // check comma delimited extensions
static bool ExtensionInList(const nsCString& aExtensionList, static bool ExtensionInList(const nsCString& aExtensionList,
@@ -225,7 +231,7 @@ nsIInternalPluginTag::HasMimeType(const nsACString& aMimeType) const
/* nsPluginTag */ /* nsPluginTag */
uint32_t nsPluginTag::sNextId; uint32_t nsPluginTag::sNextId;
#ifdef MOZ_ENABLE_NPAPI
nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo, nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo,
int64_t aLastModifiedTime, int64_t aLastModifiedTime,
bool fromExtension) bool fromExtension)
@@ -791,6 +797,8 @@ bool nsPluginTag::IsFromExtension() const
return mIsFromExtension; return mIsFromExtension;
} }
#endif // MOZ_ENABLE_NPAPI
/* nsFakePluginTag */ /* nsFakePluginTag */
nsFakePluginTag::nsFakePluginTag() nsFakePluginTag::nsFakePluginTag()
+6
View File
@@ -16,8 +16,10 @@
class nsIURI; class nsIURI;
struct PRLibrary; struct PRLibrary;
#ifdef MOZ_ENABLE_NPAPI
struct nsPluginInfo; struct nsPluginInfo;
class nsNPAPIPlugin; class nsNPAPIPlugin;
#endif
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@@ -106,9 +108,11 @@ public:
ePluginState_MaxValue = 3, ePluginState_MaxValue = 3,
}; };
#ifdef MOZ_ENABLE_NPAPI
nsPluginTag(nsPluginInfo* aPluginInfo, nsPluginTag(nsPluginInfo* aPluginInfo,
int64_t aLastModifiedTime, int64_t aLastModifiedTime,
bool fromExtension); bool fromExtension);
#endif
nsPluginTag(const char* aName, nsPluginTag(const char* aName,
const char* aDescription, const char* aDescription,
const char* aFileName, const char* aFileName,
@@ -166,7 +170,9 @@ public:
bool mHadLocalInstance; bool mHadLocalInstance;
PRLibrary *mLibrary; PRLibrary *mLibrary;
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsNPAPIPlugin> mPlugin; RefPtr<nsNPAPIPlugin> mPlugin;
#endif
bool mIsJavaPlugin; bool mIsJavaPlugin;
bool mIsFlashPlugin; bool mIsFlashPlugin;
bool mSupportsAsyncInit; bool mSupportsAsyncInit;
+14 -3
View File
@@ -9,7 +9,9 @@ include protocol PPluginScriptableObject;
include protocol PBrowserStream; include protocol PBrowserStream;
include protocol PPluginStream; include protocol PPluginStream;
include protocol PStreamNotify; include protocol PStreamNotify;
#ifdef MOZ_ENABLE_NPAPI
include protocol PPluginSurface; include protocol PPluginSurface;
#endif
include "mozilla/GfxMessageUtils.h"; include "mozilla/GfxMessageUtils.h";
@@ -45,7 +47,9 @@ struct IOSurfaceDescriptor {
union SurfaceDescriptor { union SurfaceDescriptor {
Shmem; Shmem;
SurfaceDescriptorX11; SurfaceDescriptorX11;
#ifdef MOZ_ENABLE_NPAPI
PPluginSurface; // used on Windows PPluginSurface; // used on Windows
#endif
IOSurfaceDescriptor; // used on OSX 10.5+ IOSurfaceDescriptor; // used on OSX 10.5+
// Descriptor can be null here in case // Descriptor can be null here in case
// 1) of first Show call (prevSurface is null) // 1) of first Show call (prevSurface is null)
@@ -69,7 +73,9 @@ intr protocol PPluginInstance
manages PBrowserStream; manages PBrowserStream;
manages PPluginStream; manages PPluginStream;
manages PStreamNotify; manages PStreamNotify;
#ifdef MOZ_ENABLE_NPAPI
manages PPluginSurface; manages PPluginSurface;
#endif
child: child:
intr __delete__(); intr __delete__();
@@ -164,12 +170,14 @@ parent:
returns (nsCString value, NPError result); returns (nsCString value, NPError result);
intr NPN_GetValue_DrawingModelSupport(NPNVariable model) intr NPN_GetValue_DrawingModelSupport(NPNVariable model)
returns (bool value); returns (bool value);
#ifdef MOZ_ENABLE_NPAPI
intr NPN_GetValue_SupportsAsyncBitmapSurface() intr NPN_GetValue_SupportsAsyncBitmapSurface()
returns (bool value); returns (bool value);
intr NPN_GetValue_SupportsAsyncDXGISurface() intr NPN_GetValue_SupportsAsyncDXGISurface()
returns (bool value); returns (bool value);
intr NPN_GetValue_PreferredDXGIAdapter() intr NPN_GetValue_PreferredDXGIAdapter()
returns (DxgiAdapterDesc desc); returns (DxgiAdapterDesc desc);
#endif
intr NPN_SetValue_NPPVpluginWindow(bool windowed) intr NPN_SetValue_NPPVpluginWindow(bool windowed)
returns (NPError result); returns (NPError result);
@@ -206,11 +214,13 @@ parent:
// Create a new DXGI shared surface with the given format and size. The // Create a new DXGI shared surface with the given format and size. The
// returned handle, on success, can be opened as an ID3D10Texture2D or // returned handle, on success, can be opened as an ID3D10Texture2D or
// ID3D11Texture2D on a corresponding device. // ID3D11Texture2D on a corresponding device.
#ifdef MOZ_ENABLE_NPAPI
sync InitDXGISurface(SurfaceFormat format, IntSize size) sync InitDXGISurface(SurfaceFormat format, IntSize size)
returns (WindowsHandle handle, NPError result); returns (WindowsHandle handle, NPError result);
// Destroy a surface previously allocated with InitDXGISurface(). // Destroy a surface previously allocated with InitDXGISurface().
sync FinalizeDXGISurface(WindowsHandle handle); sync FinalizeDXGISurface(WindowsHandle handle);
#endif
// Set the current plugin image to the bitmap in the given shmem buffer. The // Set the current plugin image to the bitmap in the given shmem buffer. The
// format must be B8G8R8A8 or B8G8R8X8. // format must be B8G8R8A8 or B8G8R8X8.
@@ -219,11 +229,11 @@ parent:
uint32_t stride, uint32_t stride,
IntSize size, IntSize size,
IntRect dirty); IntRect dirty);
#ifdef MOZ_ENABLE_NPAPI
// Set the current plugin image to the DXGI surface in |handle|. // Set the current plugin image to the DXGI surface in |handle|.
sync ShowDirectDXGISurface(WindowsHandle handle, sync ShowDirectDXGISurface(WindowsHandle handle,
IntRect dirty); IntRect dirty);
#endif
// Give |newSurface|, containing this instance's updated pixels, to // Give |newSurface|, containing this instance's updated pixels, to
// the browser for compositing. When this method returns, any surface // the browser for compositing. When this method returns, any surface
// previously passed to Show may be destroyed. // previously passed to Show may be destroyed.
@@ -235,10 +245,11 @@ parent:
// the shmem for reuse // the shmem for reuse
sync Show(NPRect updatedRect, SurfaceDescriptor newSurface) sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
returns (SurfaceDescriptor prevSurface); returns (SurfaceDescriptor prevSurface);
#ifdef MOZ_ENABLE_NPAPI
async PPluginSurface(WindowsSharedMemoryHandle handle, async PPluginSurface(WindowsSharedMemoryHandle handle,
IntSize size, IntSize size,
bool transparent); bool transparent);
#endif
intr NPN_PushPopupsEnabledState(bool aState); intr NPN_PushPopupsEnabledState(bool aState);
+10 -2
View File
@@ -11,9 +11,13 @@ include ProfilerTypes;
using NPError from "npapi.h"; using NPError from "npapi.h";
using NPNVariable from "npapi.h"; using NPNVariable from "npapi.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h"; using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
#ifdef MOZ_ENABLE_NPAPI
using class mac_plugin_interposing::NSCursorInfo from "mozilla/plugins/PluginMessageUtils.h"; using class mac_plugin_interposing::NSCursorInfo from "mozilla/plugins/PluginMessageUtils.h";
#endif
using struct nsID from "nsID.h"; using struct nsID from "nsID.h";
#ifdef MOZ_ENABLE_NPAPI
using struct mozilla::plugins::NPAudioDeviceChangeDetailsIPC from "mozilla/plugins/PluginMessageUtils.h"; using struct mozilla::plugins::NPAudioDeviceChangeDetailsIPC from "mozilla/plugins/PluginMessageUtils.h";
#endif
namespace mozilla { namespace mozilla {
namespace plugins { namespace plugins {
@@ -93,8 +97,9 @@ child:
async SetParentHangTimeout(uint32_t seconds); async SetParentHangTimeout(uint32_t seconds);
async SettingChanged(PluginSettings settings); async SettingChanged(PluginSettings settings);
#ifdef MOZ_ENABLE_NPAPI
async NPP_SetValue_NPNVaudioDeviceChangeDetails(NPAudioDeviceChangeDetailsIPC changeDetails); async NPP_SetValue_NPNVaudioDeviceChangeDetails(NPAudioDeviceChangeDetailsIPC changeDetails);
#endif
parent: parent:
async NP_InitializeResult(NPError aError); async NP_InitializeResult(NPError aError);
@@ -124,12 +129,13 @@ parent:
int32_t aX, int32_t aY, int32_t aX, int32_t aY,
size_t aWidth, size_t aHeight); size_t aWidth, size_t aHeight);
async PluginHideWindow(uint32_t aWindowId); async PluginHideWindow(uint32_t aWindowId);
#ifdef MOZ_ENABLE_NPAPI
// OS X Specific calls to allow the plugin to manage the cursor. // OS X Specific calls to allow the plugin to manage the cursor.
async SetCursor(NSCursorInfo cursorInfo); async SetCursor(NSCursorInfo cursorInfo);
async ShowCursor(bool show); async ShowCursor(bool show);
async PushCursor(NSCursorInfo cursorInfo); async PushCursor(NSCursorInfo cursorInfo);
async PopCursor(); async PopCursor();
#endif
sync NPN_SetException(nsCString message); sync NPN_SetException(nsCString message);
@@ -148,8 +154,10 @@ parent:
intr GetKeyState(int32_t aVirtKey) intr GetKeyState(int32_t aVirtKey)
returns (int16_t aState); returns (int16_t aState);
#ifdef MOZ_ENABLE_NPAPI
intr NPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(bool shouldRegister) intr NPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(bool shouldRegister)
returns (NPError result); returns (NPError result);
#endif
}; };
} // namespace plugins } // namespace plugins
+34 -24
View File
@@ -20,12 +20,16 @@
#endif #endif
#ifdef XP_WIN #ifdef XP_WIN
#include "mozilla/D3DMessageUtils.h" #include "mozilla/D3DMessageUtils.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/gfx/SharedDIBSurface.h" #include "mozilla/gfx/SharedDIBSurface.h"
#endif
#include "nsCrashOnException.h" #include "nsCrashOnException.h"
#include "gfxWindowsPlatform.h" #include "gfxWindowsPlatform.h"
extern const wchar_t* kFlashFullscreenClass; extern const wchar_t* kFlashFullscreenClass;
#ifdef MOZ_ENABLE_NPAPI
using mozilla::gfx::SharedDIBSurface; using mozilla::gfx::SharedDIBSurface;
#endif #endif
#endif
#include "gfxSharedImageSurface.h" #include "gfxSharedImageSurface.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "gfxAlphaRecovery.h" #include "gfxAlphaRecovery.h"
@@ -94,7 +98,9 @@ static Imm32ImmNotifyIME sImm32ImmNotifyIME = nullptr;
static PluginInstanceChild* sCurrentPluginInstance = nullptr; static PluginInstanceChild* sCurrentPluginInstance = nullptr;
static const HIMC sHookIMC = (const HIMC)0xefefefef; static const HIMC sHookIMC = (const HIMC)0xefefefef;
#ifdef MOZ_ENABLE_NPAPI
using mozilla::gfx::SharedDIB; using mozilla::gfx::SharedDIB;
#endif
// Flash WM_USER message delay time for PostDelayedTask. Borrowed // Flash WM_USER message delay time for PostDelayedTask. Borrowed
// from Chromium's web plugin delegate src. See 'flash msg throttling // from Chromium's web plugin delegate src. See 'flash msg throttling
@@ -176,7 +182,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
, mCurrentEvent(nullptr) , mCurrentEvent(nullptr)
#endif #endif
, mLayersRendering(false) , mLayersRendering(false)
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
, mCurrentSurfaceActor(nullptr) , mCurrentSurfaceActor(nullptr)
, mBackSurfaceActor(nullptr) , mBackSurfaceActor(nullptr)
#endif #endif
@@ -224,11 +230,13 @@ PluginInstanceChild::~PluginInstanceChild()
ClearUnityHooks(); ClearUnityHooks();
} }
// In the event that we registered for audio device changes, stop. // In the event that we registered for audio device changes, stop.
PluginModuleChild* chromeInstance = PluginModuleChild::GetChrome(); #ifdef MOZ_ENABLE_NPAPI
if (chromeInstance) { PluginModuleChild* chromeInstance = PluginModuleChild::GetChrome();
if (chromeInstance) {
NPError rv = chromeInstance->PluginRequiresAudioDeviceChanges(this, false); NPError rv = chromeInstance->PluginRequiresAudioDeviceChanges(this, false);
} }
#endif #endif // MOZ_ENABLE_NPAPI
#endif // OS_WIN
#if defined(MOZ_WIDGET_COCOA) #if defined(MOZ_WIDGET_COCOA)
if (mShColorSpace) { if (mShColorSpace) {
::CGColorSpaceRelease(mShColorSpace); ::CGColorSpaceRelease(mShColorSpace);
@@ -469,7 +477,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
#endif #endif
} }
#ifdef MOZ_ENABLE_NPAPI
case NPNVsupportsAsyncBitmapSurfaceBool: { case NPNVsupportsAsyncBitmapSurfaceBool: {
bool value = false; bool value = false;
CallNPN_GetValue_SupportsAsyncBitmapSurface(&value); CallNPN_GetValue_SupportsAsyncBitmapSurface(&value);
@@ -495,7 +503,8 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
*reinterpret_cast<DXGI_ADAPTER_DESC*>(aValue) = desc.ToDesc(); *reinterpret_cast<DXGI_ADAPTER_DESC*>(aValue) = desc.ToDesc();
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
#endif #endif // XP_WIN
#endif // MOZ_ENABLE_NPAPI
#ifdef XP_MACOSX #ifdef XP_MACOSX
case NPNVsupportsCoreGraphicsBool: { case NPNVsupportsCoreGraphicsBool: {
@@ -691,7 +700,7 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
return rv; return rv;
} }
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
case NPPVpluginRequiresAudioDeviceChanges: { case NPPVpluginRequiresAudioDeviceChanges: {
// Many other NPN_SetValue variables are forwarded to our // Many other NPN_SetValue variables are forwarded to our
// PluginInstanceParent, which runs on a content process. We // PluginInstanceParent, which runs on a content process. We
@@ -880,7 +889,7 @@ PluginInstanceChild::AnswerNPP_SetValue_NPNVmuteAudioBool(const bool& value,
return true; return true;
} }
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
NPError NPError
PluginInstanceChild::DefaultAudioDeviceChanged(NPAudioDeviceChangeDetails& details) PluginInstanceChild::DefaultAudioDeviceChanged(NPAudioDeviceChangeDetails& details)
{ {
@@ -3163,7 +3172,7 @@ PluginInstanceChild::NPN_InitAsyncSurface(NPSize *size, NPImageFormat format,
mDirectBitmaps.Put(surface, holder); mDirectBitmaps.Put(surface, holder);
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
case NPDrawingModelAsyncWindowsDXGISurface: { case NPDrawingModelAsyncWindowsDXGISurface: {
// Validate that the caller does not expect initial data to be set. // Validate that the caller does not expect initial data to be set.
if (initData) { if (initData) {
@@ -3229,7 +3238,7 @@ PluginInstanceChild::NPN_FinalizeAsyncSurface(NPAsyncSurface *surface)
mDirectBitmaps.Remove(surface); mDirectBitmaps.Remove(surface);
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
case NPDrawingModelAsyncWindowsDXGISurface: { case NPDrawingModelAsyncWindowsDXGISurface: {
WindowsHandle handle; WindowsHandle handle;
if (!mDxgiSurfaces.Get(surface, &handle)) { if (!mDxgiSurfaces.Get(surface, &handle)) {
@@ -3280,7 +3289,7 @@ PluginInstanceChild::NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect
SendShowDirectBitmap(shmemHolder, bitmap->mFormat, bitmap->mStride, bitmap->mSize, dirty); SendShowDirectBitmap(shmemHolder, bitmap->mFormat, bitmap->mStride, bitmap->mSize, dirty);
break; break;
} }
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
case NPDrawingModelAsyncWindowsDXGISurface: { case NPDrawingModelAsyncWindowsDXGISurface: {
WindowsHandle handle; WindowsHandle handle;
if (!mDxgiSurfaces.Get(surface, &handle)) { if (!mDxgiSurfaces.Get(surface, &handle)) {
@@ -3435,6 +3444,7 @@ PluginInstanceChild::CreateOptSurface(void)
#endif #endif
#ifdef XP_WIN #ifdef XP_WIN
#ifdef MOZ_ENABLE_NPAPI
if (mSurfaceType == gfxSurfaceType::Win32) { if (mSurfaceType == gfxSurfaceType::Win32) {
bool willHaveTransparentPixels = mIsTransparent && !mBackground; bool willHaveTransparentPixels = mIsTransparent && !mBackground;
@@ -3447,9 +3457,9 @@ PluginInstanceChild::CreateOptSurface(void)
mCurrentSurface = s; mCurrentSurface = s;
return true; return true;
} }
#endif // MOZ_ENABLE_NPAPI
NS_RUNTIMEABORT("Shared-memory drawing not expected on Windows."); NS_RUNTIMEABORT("Shared-memory drawing not expected on Windows.");
#endif #endif // XP_WIN
// Make common shmem implementation working for any platform // Make common shmem implementation working for any platform
mCurrentSurface = mCurrentSurface =
@@ -3641,7 +3651,7 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
} }
} }
#endif // MOZ_X11 #endif // MOZ_X11
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
HDC dc = nullptr; HDC dc = nullptr;
if (curSurface) { if (curSurface) {
@@ -3746,7 +3756,7 @@ PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
exposeEvent.minor_code = 0; exposeEvent.minor_code = 0;
mPluginIface->event(&mData, reinterpret_cast<void*>(&exposeEvent)); mPluginIface->event(&mData, reinterpret_cast<void*>(&exposeEvent));
} }
#elif defined(XP_WIN) #elif defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
NS_ASSERTION(SharedDIBSurface::IsSharedDIBSurface(aSurface), NS_ASSERTION(SharedDIBSurface::IsSharedDIBSurface(aSurface),
"Expected (SharedDIB) image surface."); "Expected (SharedDIB) image surface.");
@@ -3880,7 +3890,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
return; return;
} }
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// On windows, we need an HDC and so can't paint directly to // On windows, we need an HDC and so can't paint directly to
// vanilla image surfaces. Bifurcate this painting code so that // vanilla image surfaces. Bifurcate this painting code so that
// we don't accidentally attempt that. // we don't accidentally attempt that.
@@ -4139,7 +4149,7 @@ PluginInstanceChild::ShowPluginFrame()
XSync(mWsInfo.display, False); XSync(mWsInfo.display, False);
} else } else
#endif #endif
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
if (SharedDIBSurface::IsSharedDIBSurface(mCurrentSurface)) { if (SharedDIBSurface::IsSharedDIBSurface(mCurrentSurface)) {
SharedDIBSurface* s = static_cast<SharedDIBSurface*>(mCurrentSurface.get()); SharedDIBSurface* s = static_cast<SharedDIBSurface*>(mCurrentSurface.get());
if (!mCurrentSurfaceActor) { if (!mCurrentSurfaceActor) {
@@ -4186,7 +4196,7 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
if (mBackSurface->GetType() != gfxSurfaceType::Xlib && if (mBackSurface->GetType() != gfxSurfaceType::Xlib &&
!gfxSharedImageSurface::IsSharedImage(mBackSurface)) !gfxSharedImageSurface::IsSharedImage(mBackSurface))
return false; return false;
#elif defined(XP_WIN) #elif defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
if (!SharedDIBSurface::IsSharedDIBSurface(mBackSurface)) if (!SharedDIBSurface::IsSharedDIBSurface(mBackSurface))
return false; return false;
#endif #endif
@@ -4431,17 +4441,17 @@ void
PluginInstanceChild::SwapSurfaces() PluginInstanceChild::SwapSurfaces()
{ {
RefPtr<gfxASurface> tmpsurf = mCurrentSurface; RefPtr<gfxASurface> tmpsurf = mCurrentSurface;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
PPluginSurfaceChild* tmpactor = mCurrentSurfaceActor; PPluginSurfaceChild* tmpactor = mCurrentSurfaceActor;
#endif #endif
mCurrentSurface = mBackSurface; mCurrentSurface = mBackSurface;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
mCurrentSurfaceActor = mBackSurfaceActor; mCurrentSurfaceActor = mBackSurfaceActor;
#endif #endif
mBackSurface = tmpsurf; mBackSurface = tmpsurf;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
mBackSurfaceActor = tmpactor; mBackSurfaceActor = tmpactor;
#endif #endif
@@ -4479,7 +4489,7 @@ PluginInstanceChild::ClearCurrentSurface()
mDoubleBufferCARenderer.ClearFrontSurface(); mDoubleBufferCARenderer.ClearFrontSurface();
} }
#endif #endif
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
if (mCurrentSurfaceActor) { if (mCurrentSurfaceActor) {
PPluginSurfaceChild::Send__delete__(mCurrentSurfaceActor); PPluginSurfaceChild::Send__delete__(mCurrentSurfaceActor);
mCurrentSurfaceActor = nullptr; mCurrentSurfaceActor = nullptr;
@@ -4505,7 +4515,7 @@ PluginInstanceChild::ClearAllSurfaces()
mCurrentSurface = nullptr; mCurrentSurface = nullptr;
mBackSurface = nullptr; mBackSurface = nullptr;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
if (mCurrentSurfaceActor) { if (mCurrentSurfaceActor) {
PPluginSurfaceChild::Send__delete__(mCurrentSurfaceActor); PPluginSurfaceChild::Send__delete__(mCurrentSurfaceActor);
mCurrentSurfaceActor = nullptr; mCurrentSurfaceActor = nullptr;
@@ -4674,7 +4684,7 @@ PluginInstanceChild::AnswerNPP_Destroy(NPError* aResult)
void void
PluginInstanceChild::ActorDestroy(ActorDestroyReason why) PluginInstanceChild::ActorDestroy(ActorDestroyReason why)
{ {
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// ClearAllSurfaces() should not try to send anything after ActorDestroy. // ClearAllSurfaces() should not try to send anything after ActorDestroy.
mCurrentSurfaceActor = nullptr; mCurrentSurfaceActor = nullptr;
mBackSurfaceActor = nullptr; mBackSurfaceActor = nullptr;
+7 -4
View File
@@ -10,10 +10,12 @@
#include "mozilla/plugins/PPluginInstanceChild.h" #include "mozilla/plugins/PPluginInstanceChild.h"
#include "mozilla/plugins/PluginScriptableObjectChild.h" #include "mozilla/plugins/PluginScriptableObjectChild.h"
#include "mozilla/plugins/StreamNotifyChild.h" #include "mozilla/plugins/StreamNotifyChild.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PPluginSurfaceChild.h" #include "mozilla/plugins/PPluginSurfaceChild.h"
#endif
#include "mozilla/ipc/CrossProcessMutex.h" #include "mozilla/ipc/CrossProcessMutex.h"
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
#if defined(OS_WIN) #if defined(OS_WIN) && defined (MOZ_ENABLE_NPAPI)
#include "mozilla/gfx/SharedDIBWin.h" #include "mozilla/gfx/SharedDIBWin.h"
#elif defined(MOZ_WIDGET_COCOA) #elif defined(MOZ_WIDGET_COCOA)
#include "PluginUtilsOSX.h" #include "PluginUtilsOSX.h"
@@ -113,7 +115,7 @@ protected:
DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
const NPRemoteWindow& aWindow, const NPRemoteWindow& aWindow,
bool aIsAsync); bool aIsAsync);
#ifdef MOZ_ENABLE_NPAPI
virtual PPluginSurfaceChild* virtual PPluginSurfaceChild*
AllocPPluginSurfaceChild(const WindowsSharedMemoryHandle&, AllocPPluginSurfaceChild(const WindowsSharedMemoryHandle&,
const gfx::IntSize&, const bool&) override { const gfx::IntSize&, const bool&) override {
@@ -124,6 +126,7 @@ protected:
delete s; delete s;
return true; return true;
} }
#endif
virtual bool virtual bool
AnswerPaint(const NPRemoteEvent& event, int16_t* handled) override AnswerPaint(const NPRemoteEvent& event, int16_t* handled) override
@@ -277,7 +280,7 @@ public:
const NativeEventData& aKeyEventData, const NativeEventData& aKeyEventData,
const bool& aIsConsumed) override; const bool& aIsConsumed) override;
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
NPError DefaultAudioDeviceChanged(NPAudioDeviceChangeDetails& details); NPError DefaultAudioDeviceChanged(NPAudioDeviceChangeDetails& details);
#endif #endif
@@ -621,7 +624,7 @@ private:
// alpha recovery otherwise. // alpha recovery otherwise.
RefPtr<gfxASurface> mBackground; RefPtr<gfxASurface> mBackground;
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// These actors mirror mCurrentSurface/mBackSurface // These actors mirror mCurrentSurface/mBackSurface
PPluginSurfaceChild* mCurrentSurfaceActor; PPluginSurfaceChild* mCurrentSurfaceActor;
PPluginSurfaceChild* mBackSurfaceActor; PPluginSurfaceChild* mBackSurfaceActor;
+24 -9
View File
@@ -43,7 +43,7 @@
#include "mozilla/layers/TextureWrapperImage.h" #include "mozilla/layers/TextureWrapperImage.h"
#include "mozilla/layers/TextureClientRecycleAllocator.h" #include "mozilla/layers/TextureClientRecycleAllocator.h"
#include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/ImageBridgeChild.h"
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
# include "mozilla/layers/D3D11ShareHandleImage.h" # include "mozilla/layers/D3D11ShareHandleImage.h"
# include "mozilla/gfx/DeviceManagerDx.h" # include "mozilla/gfx/DeviceManagerDx.h"
# include "mozilla/layers/TextureD3D11.h" # include "mozilla/layers/TextureD3D11.h"
@@ -56,7 +56,9 @@
#if defined(OS_WIN) #if defined(OS_WIN)
#include <windowsx.h> #include <windowsx.h>
#include "gfxWindowsPlatform.h" #include "gfxWindowsPlatform.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginSurfaceParent.h" #include "mozilla/plugins/PluginSurfaceParent.h"
#endif
#include "nsClassHashtable.h" #include "nsClassHashtable.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include "nsIWidget.h" #include "nsIWidget.h"
@@ -349,7 +351,7 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVdocumentOrigin(nsCString* value,
} }
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
static inline bool static inline bool
AllowDirectBitmapSurfaceDrawing() AllowDirectBitmapSurfaceDrawing()
{ {
@@ -418,6 +420,7 @@ PluginInstanceParent::AnswerNPN_GetValue_PreferredDXGIAdapter(DxgiAdapterDesc* a
#endif #endif
return true; return true;
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginWindow( PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginWindow(
@@ -467,17 +470,21 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
case NPDrawingModelSyncWin: case NPDrawingModelSyncWin:
allowed = true; allowed = true;
break; break;
#ifdef MOZ_ENABLE_NPAPI
case NPDrawingModelAsyncWindowsDXGISurface: case NPDrawingModelAsyncWindowsDXGISurface:
allowed = AllowDirectDXGISurfaceDrawing(); allowed = AllowDirectDXGISurfaceDrawing();
break; break;
#endif // MOZ_ENABLE_NPAPI
#elif defined(MOZ_X11) #elif defined(MOZ_X11)
case NPDrawingModelSyncX: case NPDrawingModelSyncX:
allowed = true; allowed = true;
break; break;
#endif #endif // MOZ_X11
#ifdef MOZ_ENABLE_NPAPI
case NPDrawingModelAsyncBitmapSurface: case NPDrawingModelAsyncBitmapSurface:
allowed = AllowDirectBitmapSurfaceDrawing(); allowed = AllowDirectBitmapSurfaceDrawing();
break; break;
#endif // MOZ_ENABLE_NPAPI
default: default:
allowed = false; allowed = false;
break; break;
@@ -647,6 +654,7 @@ PluginInstanceParent::RecvRevokeCurrentDirectSurface()
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::RecvInitDXGISurface(const gfx::SurfaceFormat& format, PluginInstanceParent::RecvInitDXGISurface(const gfx::SurfaceFormat& format,
const gfx::IntSize& size, const gfx::IntSize& size,
@@ -706,19 +714,22 @@ PluginInstanceParent::RecvInitDXGISurface(const gfx::SurfaceFormat& format,
*outHandle = reinterpret_cast<uintptr_t>(sharedHandle); *outHandle = reinterpret_cast<uintptr_t>(sharedHandle);
*outError = NPERR_NO_ERROR; *outError = NPERR_NO_ERROR;
#endif #endif // XP_WIN
return true; return true;
} }
bool bool
PluginInstanceParent::RecvFinalizeDXGISurface(const WindowsHandle& handle) PluginInstanceParent::RecvFinalizeDXGISurface(const WindowsHandle& handle)
{ {
#if defined(XP_WIN) #if defined(XP_WIN)
mD3D11Surfaces.Remove(reinterpret_cast<void*>(handle)); mD3D11Surfaces.Remove(reinterpret_cast<void*>(handle));
#endif #endif // XP_WIN
return true; return true;
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::RecvShowDirectBitmap(Shmem&& buffer, PluginInstanceParent::RecvShowDirectBitmap(Shmem&& buffer,
const SurfaceFormat& format, const SurfaceFormat& format,
@@ -805,6 +816,7 @@ PluginInstanceParent::SetCurrentImage(Image* aImage)
RecvNPN_InvalidateRect(nprect); RecvNPN_InvalidateRect(nprect);
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::RecvShowDirectDXGISurface(const WindowsHandle& handle, PluginInstanceParent::RecvShowDirectDXGISurface(const WindowsHandle& handle,
const gfx::IntRect& dirty) const gfx::IntRect& dirty)
@@ -848,8 +860,9 @@ PluginInstanceParent::RecvShowDirectDXGISurface(const WindowsHandle& handle,
return true; return true;
#else #else
return false; return false;
#endif #endif // XP_WIN
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::RecvShow(const NPRect& updatedRect, PluginInstanceParent::RecvShow(const NPRect& updatedRect,
@@ -907,7 +920,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
surface = newSurface.get_SurfaceDescriptorX11().OpenForeign(); surface = newSurface.get_SurfaceDescriptorX11().OpenForeign();
} }
#endif #endif
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
else if (newSurface.type() == SurfaceDescriptor::TPPluginSurfaceParent) { else if (newSurface.type() == SurfaceDescriptor::TPPluginSurfaceParent) {
PluginSurfaceParent* s = PluginSurfaceParent* s =
static_cast<PluginSurfaceParent*>(newSurface.get_PPluginSurfaceParent()); static_cast<PluginSurfaceParent*>(newSurface.get_PPluginSurfaceParent());
@@ -1945,6 +1958,7 @@ PluginInstanceParent::GetActorForNPObject(NPObject* aObject)
return actor; return actor;
} }
#ifdef MOZ_ENABLE_NPAPI
PPluginSurfaceParent* PPluginSurfaceParent*
PluginInstanceParent::AllocPPluginSurfaceParent(const WindowsSharedMemoryHandle& handle, PluginInstanceParent::AllocPPluginSurfaceParent(const WindowsSharedMemoryHandle& handle,
const mozilla::gfx::IntSize& size, const mozilla::gfx::IntSize& size,
@@ -1955,7 +1969,7 @@ PluginInstanceParent::AllocPPluginSurfaceParent(const WindowsSharedMemoryHandle&
#else #else
NS_ERROR("This shouldn't be called!"); NS_ERROR("This shouldn't be called!");
return nullptr; return nullptr;
#endif #endif // XP_WIN
} }
bool bool
@@ -1966,8 +1980,9 @@ PluginInstanceParent::DeallocPPluginSurfaceParent(PPluginSurfaceParent* s)
return true; return true;
#else #else
return false; return false;
#endif #endif // XP_WIN
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginInstanceParent::AnswerNPN_PushPopupsEnabledState(const bool& aState) PluginInstanceParent::AnswerNPN_PushPopupsEnabledState(const bool& aState)
+11 -7
View File
@@ -9,7 +9,9 @@
#include "mozilla/plugins/PPluginInstanceParent.h" #include "mozilla/plugins/PPluginInstanceParent.h"
#include "mozilla/plugins/PluginScriptableObjectParent.h" #include "mozilla/plugins/PluginScriptableObjectParent.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/gfx/SharedDIBWin.h" #include "mozilla/gfx/SharedDIBWin.h"
#endif // MOZ_ENABLE_NPAPI
#include <d3d10_1.h> #include <d3d10_1.h>
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
#elif defined(MOZ_WIDGET_COCOA) #elif defined(MOZ_WIDGET_COCOA)
@@ -117,7 +119,7 @@ public:
virtual bool virtual bool
AnswerNPN_GetValue_NPNVdocumentOrigin(nsCString* value, NPError* result) override; AnswerNPN_GetValue_NPNVdocumentOrigin(nsCString* value, NPError* result) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
AnswerNPN_GetValue_SupportsAsyncBitmapSurface(bool* value) override; AnswerNPN_GetValue_SupportsAsyncBitmapSurface(bool* value) override;
@@ -126,7 +128,7 @@ public:
virtual bool virtual bool
AnswerNPN_GetValue_PreferredDXGIAdapter(DxgiAdapterDesc* desc) override; AnswerNPN_GetValue_PreferredDXGIAdapter(DxgiAdapterDesc* desc) override;
#endif
virtual bool virtual bool
AnswerNPN_SetValue_NPPVpluginWindow(const bool& windowed, NPError* result) override; AnswerNPN_SetValue_NPPVpluginWindow(const bool& windowed, NPError* result) override;
virtual bool virtual bool
@@ -176,7 +178,7 @@ public:
virtual bool virtual bool
RecvRevokeCurrentDirectSurface() override; RecvRevokeCurrentDirectSurface() override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
RecvInitDXGISurface(const gfx::SurfaceFormat& format, RecvInitDXGISurface(const gfx::SurfaceFormat& format,
const gfx::IntSize& size, const gfx::IntSize& size,
@@ -184,6 +186,7 @@ public:
NPError* outError) override; NPError* outError) override;
virtual bool virtual bool
RecvFinalizeDXGISurface(const WindowsHandle& handle) override; RecvFinalizeDXGISurface(const WindowsHandle& handle) override;
#endif
virtual bool virtual bool
RecvShowDirectBitmap(Shmem&& buffer, RecvShowDirectBitmap(Shmem&& buffer,
@@ -191,17 +194,18 @@ public:
const uint32_t& stride, const uint32_t& stride,
const gfx::IntSize& size, const gfx::IntSize& size,
const gfx::IntRect& dirty) override; const gfx::IntRect& dirty) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
RecvShowDirectDXGISurface(const WindowsHandle& handle, RecvShowDirectDXGISurface(const WindowsHandle& handle,
const gfx::IntRect& rect) override; const gfx::IntRect& rect) override;
#endif
// Async rendering // Async rendering
virtual bool virtual bool
RecvShow(const NPRect& updatedRect, RecvShow(const NPRect& updatedRect,
const SurfaceDescriptor& newSurface, const SurfaceDescriptor& newSurface,
SurfaceDescriptor* prevSurface) override; SurfaceDescriptor* prevSurface) override;
#ifdef MOZ_ENABLE_NPAPI
virtual PPluginSurfaceParent* virtual PPluginSurfaceParent*
AllocPPluginSurfaceParent(const WindowsSharedMemoryHandle& handle, AllocPPluginSurfaceParent(const WindowsSharedMemoryHandle& handle,
const mozilla::gfx::IntSize& size, const mozilla::gfx::IntSize& size,
@@ -209,7 +213,7 @@ public:
virtual bool virtual bool
DeallocPPluginSurfaceParent(PPluginSurfaceParent* s) override; DeallocPPluginSurfaceParent(PPluginSurfaceParent* s) override;
#endif
virtual bool virtual bool
AnswerNPN_PushPopupsEnabledState(const bool& aState) override; AnswerNPN_PushPopupsEnabledState(const bool& aState) override;
@@ -404,7 +408,7 @@ private:
// This is used to tell the compositor that it should invalidate the ImageLayer. // This is used to tell the compositor that it should invalidate the ImageLayer.
uint32_t mFrameID; uint32_t mFrameID;
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// Note: DXGI 1.1 surface handles are global across all processes, and are not // Note: DXGI 1.1 surface handles are global across all processes, and are not
// marshaled. As long as we haven't freed a texture its handle should be valid // marshaled. As long as we haven't freed a texture its handle should be valid
// as a unique cross-process identifier for the texture. // as a unique cross-process identifier for the texture.
+20 -13
View File
@@ -22,12 +22,14 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#ifdef MOZ_ENABLE_NPAPI
#ifdef XP_MACOSX #ifdef XP_MACOSX
#include "PluginInterposeOSX.h" #include "PluginInterposeOSX.h"
#else #else
namespace mac_plugin_interposing { class NSCursorInfo { }; } namespace mac_plugin_interposing { class NSCursorInfo { }; }
#endif #endif
using mac_plugin_interposing::NSCursorInfo; using mac_plugin_interposing::NSCursorInfo;
#endif // MOZ_ENABLE_NPAPI
namespace mozilla { namespace mozilla {
namespace plugins { namespace plugins {
@@ -95,16 +97,19 @@ struct NPRemoteWindow
#endif #endif
}; };
// This struct is like NPAudioDeviceChangeDetails, only it uses a
// std::wstring instead of a const wchar_t* for the defaultDevice. // This struct is like NPAudioDeviceChangeDetails, only it uses a
// This gives us the necessary memory-ownership semantics without // std::wstring instead of a const wchar_t* for the defaultDevice.
// requiring C++ objects in npapi.h. // This gives us the necessary memory-ownership semantics without
struct NPAudioDeviceChangeDetailsIPC // requiring C++ objects in npapi.h.
{ #ifdef MOZ_ENABLE_NPAPI
int32_t flow; struct NPAudioDeviceChangeDetailsIPC
int32_t role; {
std::wstring defaultDevice; int32_t flow;
int32_t role;
std::wstring defaultDevice;
}; };
#endif
#ifdef XP_WIN #ifdef XP_WIN
typedef HWND NativeWindowHandle; typedef HWND NativeWindowHandle;
@@ -160,7 +165,7 @@ NPPVariableToString(NPPVariable aVar)
VARSTR(NPPVpluginEventModel); VARSTR(NPPVpluginEventModel);
#endif #endif
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
VARSTR(NPPVpluginRequiresAudioDeviceChanges); VARSTR(NPPVpluginRequiresAudioDeviceChanges);
#endif #endif
@@ -421,7 +426,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
} }
}; };
#ifdef XP_MACOSX #if defined(XP_MACOSX)
template <> template <>
struct ParamTraits<NPNSString*> struct ParamTraits<NPNSString*>
{ {
@@ -496,7 +501,7 @@ struct ParamTraits<NPNSString*>
}; };
#endif #endif
#ifdef XP_MACOSX #if defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
template <> template <>
struct ParamTraits<NSCursorInfo> struct ParamTraits<NSCursorInfo>
{ {
@@ -575,7 +580,7 @@ struct ParamTraits<NSCursorInfo>
typeName, hotSpotX, hotSpotY, dataLength, data)); typeName, hotSpotX, hotSpotY, dataLength, data));
} }
}; };
#else #elif defined(MOZ_ENABLE_NPAPI)
template<> template<>
struct ParamTraits<NSCursorInfo> struct ParamTraits<NSCursorInfo>
{ {
@@ -688,6 +693,7 @@ struct ParamTraits<NPCoordinateSpace>
} }
}; };
#ifdef MOZ_ENABLE_NPAPI
template <> template <>
struct ParamTraits<mozilla::plugins::NPAudioDeviceChangeDetailsIPC> struct ParamTraits<mozilla::plugins::NPAudioDeviceChangeDetailsIPC>
{ {
@@ -721,6 +727,7 @@ struct ParamTraits<mozilla::plugins::NPAudioDeviceChangeDetailsIPC>
aParam.defaultDevice.c_str())); aParam.defaultDevice.c_str()));
} }
}; };
#endif
} /* namespace IPC */ } /* namespace IPC */
+5 -1
View File
@@ -44,7 +44,9 @@
#endif #endif
#ifdef MOZ_WIDGET_COCOA #ifdef MOZ_WIDGET_COCOA
#ifdef MOZ_ENABLE_NPAPI
#include "PluginInterposeOSX.h" #include "PluginInterposeOSX.h"
#endif // MOZ_ENABLE_NPAPI
#include "PluginUtilsOSX.h" #include "PluginUtilsOSX.h"
#endif #endif
@@ -133,7 +135,7 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
gChromeInstance = this; gChromeInstance = this;
} }
#ifdef XP_MACOSX #if defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
if (aIsChrome) { if (aIsChrome) {
mac_plugin_interposing::child::SetUpCocoaInterposing(); mac_plugin_interposing::child::SetUpCocoaInterposing();
} }
@@ -2548,6 +2550,7 @@ PluginModuleChild::ProcessNativeEvents() {
} }
#endif #endif
#ifdef MOZ_ENABLE_NPAPI
NPError NPError
PluginModuleChild::PluginRequiresAudioDeviceChanges( PluginModuleChild::PluginRequiresAudioDeviceChanges(
PluginInstanceChild* aInstance, PluginInstanceChild* aInstance,
@@ -2606,3 +2609,4 @@ PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceChangeDetails(
return false; return false;
#endif #endif
} }
#endif // MOZ_ENABLE_NPAPI
+6 -2
View File
@@ -22,7 +22,7 @@
#include "nsTHashtable.h" #include "nsTHashtable.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#ifdef MOZ_WIDGET_COCOA #if defined(MOZ_WIDGET_COCOA) && defined(MOZ_ENABLE_NPAPI)
#include "PluginInterposeOSX.h" #include "PluginInterposeOSX.h"
#endif #endif
@@ -194,6 +194,7 @@ public:
SendPluginHideWindow(window_id); SendPluginHideWindow(window_id);
} }
#ifdef MOZ_ENABLE_NPAPI
void SetCursor(NSCursorInfo& cursorInfo) { void SetCursor(NSCursorInfo& cursorInfo) {
SendSetCursor(cursorInfo); SendSetCursor(cursorInfo);
} }
@@ -209,6 +210,7 @@ public:
void PopCursor() { void PopCursor() {
SendPopCursor(); SendPopCursor();
} }
#endif
bool GetNativeCursorsSupported() { bool GetNativeCursorsSupported() {
return Settings().nativeCursorsSupported(); return Settings().nativeCursorsSupported();
@@ -219,10 +221,12 @@ public:
const PluginSettings& Settings() const { return mCachedSettings; } const PluginSettings& Settings() const { return mCachedSettings; }
#ifdef MOZ_ENABLE_NPAPI
NPError PluginRequiresAudioDeviceChanges(PluginInstanceChild* aInstance, NPError PluginRequiresAudioDeviceChanges(PluginInstanceChild* aInstance,
NPBool aShouldRegister); NPBool aShouldRegister);
bool RecvNPP_SetValue_NPNVaudioDeviceChangeDetails( bool RecvNPP_SetValue_NPNVaudioDeviceChangeDetails(
const NPAudioDeviceChangeDetailsIPC& detailsIPC) override; const NPAudioDeviceChangeDetailsIPC& detailsIPC) override;
#endif
private: private:
NPError DoNP_Initialize(const PluginSettings& aSettings); NPError DoNP_Initialize(const PluginSettings& aSettings);
@@ -308,7 +312,7 @@ private:
# endif # endif
#endif #endif
#if defined(XP_WIN) #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
typedef nsTHashtable<nsPtrHashKey<PluginInstanceChild>> PluginInstanceSet; typedef nsTHashtable<nsPtrHashKey<PluginInstanceChild>> PluginInstanceSet;
// Set of plugins that have registered to be notified when the audio device // Set of plugins that have registered to be notified when the audio device
// changes. // changes.
+17 -6
View File
@@ -39,16 +39,22 @@
#include "mozilla/layers/TextureClientRecycleAllocator.h" #include "mozilla/layers/TextureClientRecycleAllocator.h"
#ifdef XP_WIN #ifdef XP_WIN
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginSurfaceParent.h" #include "mozilla/plugins/PluginSurfaceParent.h"
#endif // MOZ_ENABLE_NPAPI
#include "mozilla/widget/AudioSession.h" #include "mozilla/widget/AudioSession.h"
#include "PluginHangUIParent.h" #include "PluginHangUIParent.h"
#ifdef MOZ_ENABLE_NPAPI
#include "PluginUtilsWin.h" #include "PluginUtilsWin.h"
#endif #endif // MOZ_ENABLE_NPAPI
#endif // XP_WIN
#ifdef MOZ_WIDGET_GTK #ifdef MOZ_WIDGET_GTK
#include <glib.h> #include <glib.h>
#elif XP_MACOSX #elif XP_MACOSX
#ifdef MOZ_ENABLE_NPAPI
#include "PluginInterposeOSX.h" #include "PluginInterposeOSX.h"
#endif
#include "PluginUtilsOSX.h" #include "PluginUtilsOSX.h"
#endif #endif
@@ -618,7 +624,7 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
NS_RUNTIMEABORT("unsafe destruction"); NS_RUNTIMEABORT("unsafe destruction");
} }
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// If we registered for audio notifications, stop. // If we registered for audio notifications, stop.
mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this, mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this,
false); false);
@@ -856,7 +862,7 @@ PluginModuleChromeParent::GetManagingInstance(mozilla::ipc::IProtocol* aProtocol
static_cast<PStreamNotifyParent*>(aProtocol); static_cast<PStreamNotifyParent*>(aProtocol);
return static_cast<PluginInstanceParent*>(actor->Manager()); return static_cast<PluginInstanceParent*>(actor->Manager());
} }
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
case PPluginSurfaceMsgStart: { case PPluginSurfaceMsgStart: {
PPluginSurfaceParent* actor = PPluginSurfaceParent* actor =
static_cast<PPluginSurfaceParent*>(aProtocol); static_cast<PPluginSurfaceParent*>(aProtocol);
@@ -1408,6 +1414,7 @@ PluginModuleParent::NPP_SetValue(NPP instance, NPNVariable variable,
RESOLVE_AND_CALL(instance, NPP_SetValue(variable, value)); RESOLVE_AND_CALL(instance, NPP_SetValue(variable, value));
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
PluginModuleChromeParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( PluginModuleChromeParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
const bool& shouldRegister, NPError* result) const bool& shouldRegister, NPError* result)
@@ -1427,6 +1434,7 @@ PluginModuleChromeParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChange
return true; return true;
#endif #endif
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd) PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
@@ -2416,7 +2424,7 @@ PluginModuleParent::RecvPluginShowWindow(const uint32_t& aWindowId, const bool&
const size_t& aWidth, const size_t& aHeight) const size_t& aWidth, const size_t& aHeight)
{ {
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
#if defined(XP_MACOSX) #if defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
CGRect windowBound = ::CGRectMake(aX, aY, aWidth, aHeight); CGRect windowBound = ::CGRectMake(aX, aY, aWidth, aHeight);
mac_plugin_interposing::parent::OnPluginShowWindow(aWindowId, windowBound, aModal); mac_plugin_interposing::parent::OnPluginShowWindow(aWindowId, windowBound, aModal);
return true; return true;
@@ -2431,7 +2439,7 @@ bool
PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId) PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId)
{ {
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
#if defined(XP_MACOSX) #if defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
mac_plugin_interposing::parent::OnPluginHideWindow(aWindowId, OtherPid()); mac_plugin_interposing::parent::OnPluginHideWindow(aWindowId, OtherPid());
return true; return true;
#else #else
@@ -2441,6 +2449,7 @@ PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId)
#endif #endif
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo) PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo)
{ {
@@ -2496,6 +2505,7 @@ PluginModuleParent::RecvPopCursor()
return false; return false;
#endif #endif
} }
#endif // MOZ_ENABLE_NPAPI
bool bool
PluginModuleParent::RecvNPN_SetException(const nsCString& aMessage) PluginModuleParent::RecvNPN_SetException(const nsCString& aMessage)
@@ -2587,7 +2597,7 @@ PluginModuleParent::EnsureTextureAllocatorForDXGISurface()
return mTextureAllocatorForDXGISurface; return mTextureAllocatorForDXGISurface;
} }
#ifdef MOZ_ENABLE_NPAPI
bool bool
PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
const bool& shouldRegister, const bool& shouldRegister,
@@ -2597,6 +2607,7 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
*result = NPERR_GENERIC_ERROR; *result = NPERR_GENERIC_ERROR;
return true; return true;
} }
#endif
bool bool
PluginModuleParent::AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet) PluginModuleParent::AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet)
+6
View File
@@ -145,6 +145,7 @@ protected:
virtual bool virtual bool
RecvPluginHideWindow(const uint32_t& aWindowId) override; RecvPluginHideWindow(const uint32_t& aWindowId) override;
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
RecvSetCursor(const NSCursorInfo& aCursorInfo) override; RecvSetCursor(const NSCursorInfo& aCursorInfo) override;
@@ -156,6 +157,7 @@ protected:
virtual bool virtual bool
RecvPopCursor() override; RecvPopCursor() override;
#endif
virtual bool virtual bool
RecvNPN_SetException(const nsCString& aMessage) override; RecvNPN_SetException(const nsCString& aMessage) override;
@@ -169,10 +171,12 @@ protected:
static BrowserStreamParent* StreamCast(NPP instance, NPStream* s, static BrowserStreamParent* StreamCast(NPP instance, NPStream* s,
PluginAsyncSurrogate** aSurrogate = nullptr); PluginAsyncSurrogate** aSurrogate = nullptr);
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
const bool& shouldRegister, const bool& shouldRegister,
NPError* result) override; NPError* result) override;
#endif
protected: protected:
void SetChildTimeout(const int32_t aChildTimeout); void SetChildTimeout(const int32_t aChildTimeout);
@@ -506,10 +510,12 @@ private:
static void CachedSettingChanged(const char* aPref, void* aModule); static void CachedSettingChanged(const char* aPref, void* aModule);
#ifdef MOZ_ENABLE_NPAPI
virtual bool virtual bool
AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
const bool& shouldRegister, const bool& shouldRegister,
NPError* result) override; NPError* result) override;
#endif
PluginProcessParent* mSubprocess; PluginProcessParent* mSubprocess;
uint32_t mPluginId; uint32_t mPluginId;
+33 -15
View File
@@ -3,7 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['MOZ_ENABLE_NPAPI']:
DIRS += ['interpose'] DIRS += ['interpose']
EXPORTS.mozilla += [ EXPORTS.mozilla += [
@@ -37,19 +37,13 @@ EXPORTS.mozilla.plugins += [
'PluginStreamChild.h', 'PluginStreamChild.h',
'PluginStreamParent.h', 'PluginStreamParent.h',
'PluginUtilsOSX.h', 'PluginUtilsOSX.h',
'PluginWidgetChild.h',
'PluginWidgetParent.h',
'StreamNotifyChild.h', 'StreamNotifyChild.h',
'StreamNotifyParent.h', 'StreamNotifyParent.h',
] ]
if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['OS_ARCH'] == 'WINNT':
EXPORTS.mozilla.plugins += [
'PluginSurfaceParent.h',
]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'PluginHangUIParent.cpp', 'PluginHangUIParent.cpp',
'PluginSurfaceParent.cpp',
] ]
SOURCES += [ SOURCES += [
'MiniShmParent.cpp', # Issues with CreateEvent 'MiniShmParent.cpp', # Issues with CreateEvent
@@ -59,8 +53,17 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'/widget', '/widget',
'hangui', 'hangui',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
EXPORTS.mozilla.plugins += [
'PluginSurfaceParent.h',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': UNIFIED_SOURCES += [
'PluginSurfaceParent.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['MOZ_ENABLE_NPAPI']:
EXPORTS.mozilla.plugins += [ EXPORTS.mozilla.plugins += [
'PluginInterposeOSX.h', 'PluginInterposeOSX.h',
] ]
@@ -87,17 +90,15 @@ UNIFIED_SOURCES += [
SOURCES += [ SOURCES += [
'PluginInstanceChild.cpp', # 'PluginThreadCallback' : ambiguous symbol 'PluginInstanceChild.cpp', # 'PluginThreadCallback' : ambiguous symbol
'PluginModuleChild.cpp', # Redefinition of mozilla::WindowsDllInterceptor sUser32Intercept 'PluginModuleChild.cpp', # Redefinition of mozilla::WindowsDllInterceptor sUser32Intercept
'PluginWidgetChild.cpp',
'PluginWidgetParent.cpp',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and CONFIG['MOZ_ENABLE_NPAPI']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'PluginInterposeOSX.mm', 'PluginInterposeOSX.mm',
'PluginUtilsOSX.mm', 'PluginUtilsOSX.mm',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows' and CONFIG['MOZ_ENABLE_NPAPI']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'D3D11SurfaceHolder.cpp', 'D3D11SurfaceHolder.cpp',
'PluginUtilsWin.cpp' 'PluginUtilsWin.cpp'
@@ -107,14 +108,31 @@ IPDL_SOURCES += [
'PBrowserStream.ipdl', 'PBrowserStream.ipdl',
'PluginTypes.ipdlh', 'PluginTypes.ipdlh',
'PPluginBackgroundDestroyer.ipdl', 'PPluginBackgroundDestroyer.ipdl',
'PPluginInstance.ipdl',
'PPluginModule.ipdl',
'PPluginScriptableObject.ipdl', 'PPluginScriptableObject.ipdl',
'PPluginStream.ipdl', 'PPluginStream.ipdl',
'PPluginSurface.ipdl',
'PStreamNotify.ipdl', 'PStreamNotify.ipdl',
] ]
PREPROCESSED_IPDL_SOURCES += [
'PPluginInstance.ipdl',
'PPluginModule.ipdl',
]
if CONFIG['MOZ_ENABLE_NPAPI']:
IPDL_SOURCES += [
'PPluginSurface.ipdl',
]
EXPORTS.mozilla.plugins += [
'PluginWidgetChild.h',
'PluginWidgetParent.h',
]
SOURCES += [
'PluginWidgetChild.cpp',
'PluginWidgetParent.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'
+2
View File
@@ -200,12 +200,14 @@ interface MozObjectLoadingContent {
[ChromeOnly] [ChromeOnly]
readonly attribute unsigned long pluginFallbackType; readonly attribute unsigned long pluginFallbackType;
#ifdef MOZ_ENABLE_NPAPI
/** /**
* If this object currently owns a running plugin, regardless of whether or * If this object currently owns a running plugin, regardless of whether or
* not one is pending spawn/despawn. * not one is pending spawn/despawn.
*/ */
[ChromeOnly] [ChromeOnly]
readonly attribute boolean hasRunningPlugin; readonly attribute boolean hasRunningPlugin;
#endif
[ChromeOnly, Throws] [ChromeOnly, Throws]
readonly attribute unsigned long runID; readonly attribute unsigned long runID;
+2
View File
@@ -53,8 +53,10 @@ OfflineResourceList implements LegacyQueryInterface;
PaintRequest implements LegacyQueryInterface; PaintRequest implements LegacyQueryInterface;
PaintRequestList implements LegacyQueryInterface; PaintRequestList implements LegacyQueryInterface;
Performance implements LegacyQueryInterface; Performance implements LegacyQueryInterface;
#ifdef MOZ_ENABLE_NPAPI
Plugin implements LegacyQueryInterface; Plugin implements LegacyQueryInterface;
PluginArray implements LegacyQueryInterface; PluginArray implements LegacyQueryInterface;
#endif
ProcessingInstruction implements LegacyQueryInterface; ProcessingInstruction implements LegacyQueryInterface;
Range implements LegacyQueryInterface; Range implements LegacyQueryInterface;
Rect implements LegacyQueryInterface; Rect implements LegacyQueryInterface;
+2
View File
@@ -6,7 +6,9 @@
interface MimeType { interface MimeType {
readonly attribute DOMString description; readonly attribute DOMString description;
#ifdef MOZ_ENABLE_NPAPI
readonly attribute Plugin? enabledPlugin; readonly attribute Plugin? enabledPlugin;
#endif
readonly attribute DOMString suffixes; readonly attribute DOMString suffixes;
readonly attribute DOMString type; readonly attribute DOMString type;
}; };
+2
View File
@@ -108,8 +108,10 @@ partial interface Navigator {
partial interface Navigator { partial interface Navigator {
[Throws] [Throws]
readonly attribute MimeTypeArray mimeTypes; readonly attribute MimeTypeArray mimeTypes;
#ifdef MOZ_ENABLE_NPAPI
[Throws] [Throws]
readonly attribute PluginArray plugins; readonly attribute PluginArray plugins;
#endif
}; };
// https://globalprivacycontrol.github.io/gpc-spec/ // https://globalprivacycontrol.github.io/gpc-spec/
+9 -5
View File
@@ -9,6 +9,9 @@ GENERATED_WEBIDL_FILES = [
PREPROCESSED_WEBIDL_FILES = [ PREPROCESSED_WEBIDL_FILES = [
'HTMLMediaElement.webidl', 'HTMLMediaElement.webidl',
'HTMLObjectElement.webidl',
'LegacyQueryInterface.webidl',
'MimeType.webidl',
'Navigator.webidl', 'Navigator.webidl',
'Node.webidl', 'Node.webidl',
'Performance.webidl', 'Performance.webidl',
@@ -212,7 +215,6 @@ WEBIDL_FILES = [
'HTMLMetaElement.webidl', 'HTMLMetaElement.webidl',
'HTMLMeterElement.webidl', 'HTMLMeterElement.webidl',
'HTMLModElement.webidl', 'HTMLModElement.webidl',
'HTMLObjectElement.webidl',
'HTMLOListElement.webidl', 'HTMLOListElement.webidl',
'HTMLOptGroupElement.webidl', 'HTMLOptGroupElement.webidl',
'HTMLOptionElement.webidl', 'HTMLOptionElement.webidl',
@@ -274,7 +276,6 @@ WEBIDL_FILES = [
'KeyframeAnimationOptions.webidl', 'KeyframeAnimationOptions.webidl',
'KeyframeEffect.webidl', 'KeyframeEffect.webidl',
'KeyIdsInitData.webidl', 'KeyIdsInitData.webidl',
'LegacyQueryInterface.webidl',
'LinkStyle.webidl', 'LinkStyle.webidl',
'ListBoxObject.webidl', 'ListBoxObject.webidl',
'LocalMediaStream.webidl', 'LocalMediaStream.webidl',
@@ -299,7 +300,6 @@ WEBIDL_FILES = [
'MessageChannel.webidl', 'MessageChannel.webidl',
'MessageEvent.webidl', 'MessageEvent.webidl',
'MessagePort.webidl', 'MessagePort.webidl',
'MimeType.webidl',
'MimeTypeArray.webidl', 'MimeTypeArray.webidl',
'MouseEvent.webidl', 'MouseEvent.webidl',
'MouseScrollEvent.webidl', 'MouseScrollEvent.webidl',
@@ -343,8 +343,6 @@ WEBIDL_FILES = [
'Permissions.webidl', 'Permissions.webidl',
'PermissionSettings.webidl', 'PermissionSettings.webidl',
'PermissionStatus.webidl', 'PermissionStatus.webidl',
'Plugin.webidl',
'PluginArray.webidl',
'PointerEvent.webidl', 'PointerEvent.webidl',
'PopupBoxObject.webidl', 'PopupBoxObject.webidl',
'Position.webidl', 'Position.webidl',
@@ -647,6 +645,12 @@ if CONFIG['MOZ_SECUREELEMENT']:
'SecureElementManager.webidl', 'SecureElementManager.webidl',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
WEBIDL_FILES += [
'Plugin.webidl',
'PluginArray.webidl',
]
WEBIDL_FILES += [ WEBIDL_FILES += [
'InstallTrigger.webidl', 'InstallTrigger.webidl',
] ]
+10 -3
View File
@@ -15,12 +15,20 @@ EXPORTS.mozilla.gfx += [
'GPUProcessImpl.h', 'GPUProcessImpl.h',
'GPUProcessListener.h', 'GPUProcessListener.h',
'GPUProcessManager.h', 'GPUProcessManager.h',
'SharedDIB.h',
'VsyncBridgeChild.h', 'VsyncBridgeChild.h',
'VsyncBridgeParent.h', 'VsyncBridgeParent.h',
'VsyncIOThreadHolder.h', 'VsyncIOThreadHolder.h',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
EXPORTS.mozilla.gfx += [
'SharedDIB.h'
]
UNIFIED_SOURCES += [
'SharedDIB.cpp'
]
EXPORTS.mozilla.layers += [ EXPORTS.mozilla.layers += [
'CompositorSession.h', 'CompositorSession.h',
'InProcessCompositorSession.h', 'InProcessCompositorSession.h',
@@ -31,7 +39,7 @@ EXPORTS.mozilla.widget += [
'CompositorWidgetVsyncObserver.h', 'CompositorWidgetVsyncObserver.h',
] ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': if CONFIG['MOZ_ENABLE_NPAPI'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXPORTS.mozilla.gfx += [ EXPORTS.mozilla.gfx += [
'SharedDIBSurface.h', 'SharedDIBSurface.h',
'SharedDIBWin.h', 'SharedDIBWin.h',
@@ -51,7 +59,6 @@ UNIFIED_SOURCES += [
'GPUProcessManager.cpp', 'GPUProcessManager.cpp',
'InProcessCompositorSession.cpp', 'InProcessCompositorSession.cpp',
'RemoteCompositorSession.cpp', 'RemoteCompositorSession.cpp',
'SharedDIB.cpp',
'VsyncBridgeChild.cpp', 'VsyncBridgeChild.cpp',
'VsyncBridgeParent.cpp', 'VsyncBridgeParent.cpp',
'VsyncIOThreadHolder.cpp', 'VsyncIOThreadHolder.cpp',
+7
View File
@@ -627,6 +627,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// plugin process (ones that don't work correctly in a background // plugin process (ones that don't work correctly in a background
// process). Don't break any other "dyld interposing" that has already // process). Don't break any other "dyld interposing" that has already
// been set up by whatever may have launched the browser. // been set up by whatever may have launched the browser.
#ifdef MOZ_ENABLE_NPAPI
const char* prevInterpose = PR_GetEnv("DYLD_INSERT_LIBRARIES"); const char* prevInterpose = PR_GetEnv("DYLD_INSERT_LIBRARIES");
nsCString interpose; nsCString interpose;
if (prevInterpose && strlen(prevInterpose) > 0) { if (prevInterpose && strlen(prevInterpose) > 0) {
@@ -636,6 +637,12 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
interpose.Append(path.get()); interpose.Append(path.get());
interpose.AppendLiteral("/libplugin_child_interpose.dylib"); interpose.AppendLiteral("/libplugin_child_interpose.dylib");
newEnvVars["DYLD_INSERT_LIBRARIES"] = interpose.get(); newEnvVars["DYLD_INSERT_LIBRARIES"] = interpose.get();
#else
const char* interpose = PR_GetEnv("DYLD_INSERT_LIBRARIES");
if (interpose && strlen(interpose) > 0) {
mLaunchOptions->env_map["DYLD_INSERT_LIBRARIES"] = interpose;
#endif // MOZ_ENABLE_NPAPI
# endif // OS_LINUX # endif // OS_LINUX
} }
#endif // OS_LINUX || OS_MACOSX #endif // OS_LINUX || OS_MACOSX
+2
View File
@@ -3709,8 +3709,10 @@ nsCSSFrameConstructor::FindObjectData(Element* aElement,
static const FrameConstructionDataByInt sObjectData[] = { static const FrameConstructionDataByInt sObjectData[] = {
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_LOADING, SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_LOADING,
NS_NewEmptyFrame), NS_NewEmptyFrame),
#ifdef MOZ_ENABLE_NPAPI
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_PLUGIN, SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_PLUGIN,
NS_NewObjectFrame), NS_NewObjectFrame),
#endif
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_IMAGE, SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_IMAGE,
NS_NewImageFrame), NS_NewImageFrame),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_DOCUMENT, SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_DOCUMENT,
+12 -4
View File
@@ -76,7 +76,9 @@
#include "nsDOMTokenList.h" #include "nsDOMTokenList.h"
#include "mozilla/RuleNodeCacheConditions.h" #include "mozilla/RuleNodeCacheConditions.h"
#include "nsCSSProps.h" #include "nsCSSProps.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "DisplayItemScrollClip.h" #include "DisplayItemScrollClip.h"
#include "nsSVGMaskFrame.h" #include "nsSVGMaskFrame.h"
#include "nsTableCellFrame.h" #include "nsTableCellFrame.h"
@@ -1648,6 +1650,7 @@ TreatAsOpaque(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
{ {
bool snap; bool snap;
nsRegion opaque = aItem->GetOpaqueRegion(aBuilder, &snap); nsRegion opaque = aItem->GetOpaqueRegion(aBuilder, &snap);
#ifdef MOZ_ENABLE_NPAPI
if (aBuilder->IsForPluginGeometry() && if (aBuilder->IsForPluginGeometry() &&
aItem->GetType() != nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) aItem->GetType() != nsDisplayItem::TYPE_LAYER_EVENT_REGIONS)
{ {
@@ -1666,6 +1669,7 @@ TreatAsOpaque(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
opaque = aItem->GetBounds(aBuilder, &snap); opaque = aItem->GetBounds(aBuilder, &snap);
} }
} }
#endif
if (opaque.IsEmpty()) { if (opaque.IsEmpty()) {
return opaque; return opaque;
} }
@@ -1961,14 +1965,15 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
if (aFlags & PAINT_NO_COMPOSITE) { if (aFlags & PAINT_NO_COMPOSITE) {
flags = LayerManager::END_NO_COMPOSITE; flags = LayerManager::END_NO_COMPOSITE;
} }
} else { }
#ifdef MOZ_ENABLE_NPAPI
else {
// Client layer managers never composite directly, so // Client layer managers never composite directly, so
// we don't need to worry about END_NO_COMPOSITE. // we don't need to worry about END_NO_COMPOSITE.
if (aBuilder->WillComputePluginGeometry()) { if (aBuilder->WillComputePluginGeometry()) {
flags = LayerManager::END_NO_REMOTE_COMPOSITE; flags = LayerManager::END_NO_REMOTE_COMPOSITE;
} }
} }
// If this is the content process, we ship plugin geometry updates over with layer // If this is the content process, we ship plugin geometry updates over with layer
// updates, so calculate that now before we call EndTransaction. // updates, so calculate that now before we call EndTransaction.
if (rootPresContext && XRE_IsContentProcess()) { if (rootPresContext && XRE_IsContentProcess()) {
@@ -1980,7 +1985,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
// called even if there are no windowed plugins in the page. // called even if there are no windowed plugins in the page.
rootPresContext->CollectPluginGeometryUpdates(layerManager); rootPresContext->CollectPluginGeometryUpdates(layerManager);
} }
#endif
MaybeSetupTransactionIdAllocator(layerManager, view); MaybeSetupTransactionIdAllocator(layerManager, view);
layerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, layerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer,
@@ -3872,7 +3877,9 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
// bug 1213324 for details. // bug 1213324 for details.
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox); mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
mDispatchToContentHitRegion.SimplifyOutward(8); mDispatchToContentHitRegion.SimplifyOutward(8);
} else if (aFrame->GetType() == nsGkAtoms::objectFrame) { }
#ifdef MOZ_ENABLE_NPAPI
else if (aFrame->GetType() == nsGkAtoms::objectFrame) {
// If the frame is a plugin frame and wants to handle wheel events as // If the frame is a plugin frame and wants to handle wheel events as
// default action, we should add the frame to dispatch-to-content region. // default action, we should add the frame to dispatch-to-content region.
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame); nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
@@ -3881,6 +3888,7 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
mDispatchToContentHitRegion.SimplifyOutward(8); mDispatchToContentHitRegion.SimplifyOutward(8);
} }
} }
#endif
// Touch action region // Touch action region
+9 -3
View File
@@ -236,6 +236,7 @@ public:
bool aBuildCaret); bool aBuildCaret);
~nsDisplayListBuilder(); ~nsDisplayListBuilder();
#ifdef MOZ_ENABLE_NPAPI
void SetWillComputePluginGeometry(bool aWillComputePluginGeometry) void SetWillComputePluginGeometry(bool aWillComputePluginGeometry)
{ {
mWillComputePluginGeometry = aWillComputePluginGeometry; mWillComputePluginGeometry = aWillComputePluginGeometry;
@@ -246,7 +247,7 @@ public:
NS_ASSERTION(mWillComputePluginGeometry, "Should have signalled this in advance"); NS_ASSERTION(mWillComputePluginGeometry, "Should have signalled this in advance");
mMode = nsDisplayListBuilderMode::PLUGIN_GEOMETRY; mMode = nsDisplayListBuilderMode::PLUGIN_GEOMETRY;
} }
#endif
mozilla::layers::LayerManager* GetWidgetLayerManager(nsView** aView = nullptr); mozilla::layers::LayerManager* GetWidgetLayerManager(nsView** aView = nullptr);
/** /**
@@ -265,10 +266,12 @@ public:
* @return true if the display list is being built to compute geometry * @return true if the display list is being built to compute geometry
* for plugins. * for plugins.
*/ */
#ifdef MOZ_ENABLE_NPAPI
bool IsForPluginGeometry() bool IsForPluginGeometry()
{ {
return mMode == nsDisplayListBuilderMode::PLUGIN_GEOMETRY; return mMode == nsDisplayListBuilderMode::PLUGIN_GEOMETRY;
} }
#endif
/** /**
* @return true if the display list is being built for painting. * @return true if the display list is being built for painting.
@@ -304,8 +307,9 @@ public:
{ {
return mMode == nsDisplayListBuilderMode::PAINTING_SELECTION_BACKGROUND; return mMode == nsDisplayListBuilderMode::PAINTING_SELECTION_BACKGROUND;
} }
#ifdef MOZ_ENABLE_NPAPI
bool WillComputePluginGeometry() { return mWillComputePluginGeometry; } bool WillComputePluginGeometry() { return mWillComputePluginGeometry; }
#endif
/** /**
* @return true if "painting is suppressed" during page load and we * @return true if "painting is suppressed" during page load and we
* should paint only the background of the document. * should paint only the background of the document.
@@ -414,6 +418,7 @@ public:
*/ */
void SetAccurateVisibleRegions() { mAccurateVisibleRegions = true; } void SetAccurateVisibleRegions() { mAccurateVisibleRegions = true; }
bool GetAccurateVisibleRegions() { return mAccurateVisibleRegions; } bool GetAccurateVisibleRegions() { return mAccurateVisibleRegions; }
/** /**
* @return Returns true if we should include the caret in any display lists * @return Returns true if we should include the caret in any display lists
* that we make. * that we make.
@@ -1078,9 +1083,10 @@ public:
} }
bool NeedToForceTransparentSurfaceForItem(nsDisplayItem* aItem); bool NeedToForceTransparentSurfaceForItem(nsDisplayItem* aItem);
#ifdef MOZ_ENABLE_NPAPI
void SetContainsPluginItem() { mContainsPluginItem = true; } void SetContainsPluginItem() { mContainsPluginItem = true; }
bool ContainsPluginItem() { return mContainsPluginItem; } bool ContainsPluginItem() { return mContainsPluginItem; }
#endif
/** /**
* mContainsBlendMode is true if we processed a display item that * mContainsBlendMode is true if we processed a display item that
* has a blend mode attached. We do this so we can insert a * has a blend mode attached. We do this so we can insert a
+4 -2
View File
@@ -101,8 +101,9 @@
#include "nsIPrintSettings.h" #include "nsIPrintSettings.h"
#include "nsIPrintSettingsService.h" #include "nsIPrintSettingsService.h"
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginDocument.h" #include "nsIPluginDocument.h"
#endif
#endif // NS_PRINTING #endif // NS_PRINTING
@@ -3875,12 +3876,13 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
nsAutoPtr<AutoPrintEventDispatcher> autoBeforeAndAfterPrint( nsAutoPtr<AutoPrintEventDispatcher> autoBeforeAndAfterPrint(
new AutoPrintEventDispatcher(mDocument)); new AutoPrintEventDispatcher(mDocument));
NS_ENSURE_STATE(!GetIsPrinting()); NS_ENSURE_STATE(!GetIsPrinting());
#ifdef MOZ_ENABLE_NPAPI
// If we are hosting a full-page plugin, tell it to print // If we are hosting a full-page plugin, tell it to print
// first. It shows its own native print UI. // first. It shows its own native print UI.
nsCOMPtr<nsIPluginDocument> pDoc(do_QueryInterface(mDocument)); nsCOMPtr<nsIPluginDocument> pDoc(do_QueryInterface(mDocument));
if (pDoc) if (pDoc)
return pDoc->Print(); return pDoc->Print();
#endif
if (!mPrintEngine) { if (!mPrintEngine) {
NS_ENSURE_STATE(mDeviceContext); NS_ENSURE_STATE(mDeviceContext);
mPrintEngine = new nsPrintEngine(); mPrintEngine = new nsPrintEngine();
+4 -2
View File
@@ -3416,6 +3416,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
nsDisplayList list; nsDisplayList list;
#ifdef MOZ_ENABLE_NPAPI
// If the root has embedded plugins, flag the builder so we know we'll need // If the root has embedded plugins, flag the builder so we know we'll need
// to update plugin geometry after painting. // to update plugin geometry after painting.
if ((aFlags & PaintFrameFlags::PAINT_WIDGET_LAYERS) && if ((aFlags & PaintFrameFlags::PAINT_WIDGET_LAYERS) &&
@@ -3423,6 +3424,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
rootPresContext->NeedToComputePluginGeometryUpdates()) { rootPresContext->NeedToComputePluginGeometryUpdates()) {
builder.SetWillComputePluginGeometry(true); builder.SetWillComputePluginGeometry(true);
} }
#endif
nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize()); nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize());
bool ignoreViewportScrolling = bool ignoreViewportScrolling =
@@ -3684,6 +3686,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
} }
} }
#ifdef MOZ_ENABLE_NPAPI
if (builder.WillComputePluginGeometry()) { if (builder.WillComputePluginGeometry()) {
// For single process compute and apply plugin geometry updates to plugin // For single process compute and apply plugin geometry updates to plugin
// windows, then request composition. For content processes skip eveything // windows, then request composition. For content processes skip eveything
@@ -3708,8 +3711,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
layerManager->Composite(); layerManager->Composite();
} }
} }
#endif
// Flush the list so we don't trigger the IsEmpty-on-destruction assertion // Flush the list so we don't trigger the IsEmpty-on-destruction assertion
list.DeleteAll(); list.DeleteAll();
return NS_OK; return NS_OK;
+11 -5
View File
@@ -46,7 +46,9 @@
#include "mozilla/EffectCompositor.h" #include "mozilla/EffectCompositor.h"
#include "mozilla/EventListenerManager.h" #include "mozilla/EventListenerManager.h"
#include "prenv.h" #include "prenv.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsTransitionManager.h" #include "nsTransitionManager.h"
#include "nsAnimationManager.h" #include "nsAnimationManager.h"
#include "CounterStyleManager.h" #include "CounterStyleManager.h"
@@ -986,11 +988,11 @@ nsPresContext::DetachShell()
if (IsRoot()) { if (IsRoot()) {
nsRootPresContext* thisRoot = static_cast<nsRootPresContext*>(this); nsRootPresContext* thisRoot = static_cast<nsRootPresContext*>(this);
#ifdef MOZ_ENABLE_NPAPI
// Have to cancel our plugin geometry timer, because the // Have to cancel our plugin geometry timer, because the
// callback for that depends on a non-null presshell. // callback for that depends on a non-null presshell.
thisRoot->CancelApplyPluginGeometryTimer(); thisRoot->CancelApplyPluginGeometryTimer();
#endif
// The did-paint timer also depends on a non-null pres shell. // The did-paint timer also depends on a non-null pres shell.
thisRoot->CancelDidPaintTimer(); thisRoot->CancelDidPaintTimer();
} }
@@ -2816,12 +2818,15 @@ nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
{ {
} }
nsRootPresContext::~nsRootPresContext() nsRootPresContext::~nsRootPresContext()
{ {
CancelDidPaintTimer();
#ifdef MOZ_ENABLE_NPAPI
NS_ASSERTION(mRegisteredPlugins.Count() == 0, NS_ASSERTION(mRegisteredPlugins.Count() == 0,
"All plugins should have been unregistered"); "All plugins should have been unregistered");
CancelDidPaintTimer();
CancelApplyPluginGeometryTimer(); CancelApplyPluginGeometryTimer();
#endif
} }
/* virtual */ void /* virtual */ void
@@ -2831,7 +2836,7 @@ nsRootPresContext::Detach()
// XXXmats maybe also CancelApplyPluginGeometryTimer(); ? // XXXmats maybe also CancelApplyPluginGeometryTimer(); ?
nsPresContext::Detach(); nsPresContext::Detach();
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsRootPresContext::RegisterPluginForGeometryUpdates(nsIContent* aPlugin) nsRootPresContext::RegisterPluginForGeometryUpdates(nsIContent* aPlugin)
{ {
@@ -2928,6 +2933,7 @@ nsRootPresContext::CancelApplyPluginGeometryTimer()
} }
} }
#ifndef XP_MACOSX #ifndef XP_MACOSX
static bool static bool
@@ -3077,7 +3083,7 @@ nsRootPresContext::CollectPluginGeometryUpdates(LayerManager* aLayerManager)
PluginDidSetGeometry(mRegisteredPlugins); PluginDidSetGeometry(mRegisteredPlugins);
#endif // #ifndef XP_MACOSX #endif // #ifndef XP_MACOSX
} }
#endif // MOZ_ENABLE_NPAPI
static void static void
NotifyDidPaintForSubtreeCallback(nsITimer *aTimer, void *aClosure) NotifyDidPaintForSubtreeCallback(nsITimer *aTimer, void *aClosure)
{ {
+8 -2
View File
@@ -60,7 +60,9 @@ class nsIRunnable;
class gfxUserFontEntry; class gfxUserFontEntry;
class gfxUserFontSet; class gfxUserFontSet;
class gfxTextPerfMetrics; class gfxTextPerfMetrics;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginFrame; class nsPluginFrame;
#endif
class nsTransitionManager; class nsTransitionManager;
class nsAnimationManager; class nsAnimationManager;
class nsRefreshDriver; class nsRefreshDriver;
@@ -1475,7 +1477,7 @@ public:
mNotifyDidPaintTimer = nullptr; mNotifyDidPaintTimer = nullptr;
} }
} }
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Registers a plugin to receive geometry updates (position and clip * Registers a plugin to receive geometry updates (position and clip
* region) so it can update its widget. * region) so it can update its widget.
@@ -1519,6 +1521,7 @@ public:
* reflow, data is shipped over with layer updates. e10s specific. * reflow, data is shipped over with layer updates. e10s specific.
*/ */
void CollectPluginGeometryUpdates(mozilla::layers::LayerManager* aLayerManager); void CollectPluginGeometryUpdates(mozilla::layers::LayerManager* aLayerManager);
#endif
virtual bool IsRoot() override { return true; } virtual bool IsRoot() override { return true; }
@@ -1552,6 +1555,7 @@ public:
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
protected: protected:
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Start a timer to ensure we eventually run ApplyPluginGeometryUpdates. * Start a timer to ensure we eventually run ApplyPluginGeometryUpdates.
*/ */
@@ -1560,7 +1564,7 @@ protected:
* Cancel the timer that ensures we eventually run ApplyPluginGeometryUpdates. * Cancel the timer that ensures we eventually run ApplyPluginGeometryUpdates.
*/ */
void CancelApplyPluginGeometryTimer(); void CancelApplyPluginGeometryTimer();
#endif
class RunWillPaintObservers : public mozilla::Runnable { class RunWillPaintObservers : public mozilla::Runnable {
public: public:
explicit RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {} explicit RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {}
@@ -1579,8 +1583,10 @@ protected:
friend class nsPresContext; friend class nsPresContext;
nsCOMPtr<nsITimer> mNotifyDidPaintTimer; nsCOMPtr<nsITimer> mNotifyDidPaintTimer;
#ifdef MOZ_ENABLE_NPAPI
nsCOMPtr<nsITimer> mApplyPluginGeometryTimer; nsCOMPtr<nsITimer> mApplyPluginGeometryTimer;
nsTHashtable<nsRefPtrHashKey<nsIContent> > mRegisteredPlugins; nsTHashtable<nsRefPtrHashKey<nsIContent> > mRegisteredPlugins;
#endif
nsTArray<nsCOMPtr<nsIRunnable> > mWillPaintObservers; nsTArray<nsCOMPtr<nsIRunnable> > mWillPaintObservers;
nsRevocableEventPtr<RunWillPaintObservers> mWillPaintFallbackEvent; nsRevocableEventPtr<RunWillPaintObservers> mWillPaintFallbackEvent;
uint32_t mDOMGeneration; uint32_t mDOMGeneration;
+15 -4
View File
@@ -115,8 +115,10 @@
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIObjectFrame.h" #include "nsIObjectFrame.h"
#include "nsIObjectLoadingContent.h" #include "nsIObjectLoadingContent.h"
#endif
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsStyleSheetService.h" #include "nsStyleSheetService.h"
@@ -8723,7 +8725,7 @@ PresShell::WillPaintWindow()
return; return;
} }
#ifndef XP_MACOSX #if !defined(XP_MACOSX) && defined(MOZ_ENABLE_NPAPI)
rootPresContext->ApplyPluginGeometryUpdates(); rootPresContext->ApplyPluginGeometryUpdates();
#endif #endif
} }
@@ -8815,6 +8817,7 @@ PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet); return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet);
} }
#ifdef MOZ_ENABLE_NPAPI
static void static void
FreezeElement(nsISupports *aSupports, void * /* unused */) FreezeElement(nsISupports *aSupports, void * /* unused */)
{ {
@@ -8823,6 +8826,7 @@ FreezeElement(nsISupports *aSupports, void * /* unused */)
olc->StopPluginInstance(); olc->StopPluginInstance();
} }
} }
#endif
static bool static bool
FreezeSubDocument(nsIDocument *aDocument, void *aData) FreezeSubDocument(nsIDocument *aDocument, void *aData)
@@ -8841,7 +8845,9 @@ PresShell::Freeze()
MaybeReleaseCapturingContent(); MaybeReleaseCapturingContent();
#ifdef MOZ_ENABLE_NPAPI
mDocument->EnumerateActivityObservers(FreezeElement, nullptr); mDocument->EnumerateActivityObservers(FreezeElement, nullptr);
#endif
if (mCaret) { if (mCaret) {
SetCaretEnabled(false); SetCaretEnabled(false);
@@ -8888,7 +8894,7 @@ PresShell::FireOrClearDelayedEvents(bool aFireEvents)
} }
} }
} }
#ifdef MOZ_ENABLE_NPAPI
static void static void
ThawElement(nsISupports *aSupports, void *aShell) ThawElement(nsISupports *aSupports, void *aShell)
{ {
@@ -8897,6 +8903,7 @@ ThawElement(nsISupports *aSupports, void *aShell)
olc->AsyncStartPluginInstance(); olc->AsyncStartPluginInstance();
} }
} }
#endif
static bool static bool
ThawSubDocument(nsIDocument *aDocument, void *aData) ThawSubDocument(nsIDocument *aDocument, void *aData)
@@ -8916,9 +8923,9 @@ PresShell::Thaw()
presContext->RefreshDriver()->GetPresContext() == presContext) { presContext->RefreshDriver()->GetPresContext() == presContext) {
presContext->RefreshDriver()->Thaw(); presContext->RefreshDriver()->Thaw();
} }
#ifdef MOZ_ENABLE_NPAPI
mDocument->EnumerateActivityObservers(ThawElement, this); mDocument->EnumerateActivityObservers(ThawElement, this);
#endif
if (mDocument) if (mDocument)
mDocument->EnumerateSubDocuments(ThawSubDocument, nullptr); mDocument->EnumerateSubDocuments(ThawSubDocument, nullptr);
@@ -10733,6 +10740,7 @@ SetExternalResourceIsActive(nsIDocument* aDocument, void* aClosure)
return true; return true;
} }
#ifdef MOZ_ENABLE_NPAPI
static void static void
SetPluginIsActive(nsISupports* aSupports, void* aClosure) SetPluginIsActive(nsISupports* aSupports, void* aClosure)
{ {
@@ -10747,6 +10755,7 @@ SetPluginIsActive(nsISupports* aSupports, void* aClosure)
objectFrame->SetIsDocumentActive(*static_cast<bool*>(aClosure)); objectFrame->SetIsDocumentActive(*static_cast<bool*>(aClosure));
} }
} }
#endif
nsresult nsresult
PresShell::SetIsActive(bool aIsActive) PresShell::SetIsActive(bool aIsActive)
@@ -10764,8 +10773,10 @@ PresShell::SetIsActive(bool aIsActive)
// Propagate state-change to my resource documents' PresShells // Propagate state-change to my resource documents' PresShells
mDocument->EnumerateExternalResources(SetExternalResourceIsActive, mDocument->EnumerateExternalResources(SetExternalResourceIsActive,
&aIsActive); &aIsActive);
#ifdef MOZ_ENABLE_NPAPI
mDocument->EnumerateActivityObservers(SetPluginIsActive, mDocument->EnumerateActivityObservers(SetPluginIsActive,
&aIsActive); &aIsActive);
#endif
nsresult rv = UpdateImageLockingState(); nsresult rv = UpdateImageLockingState();
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
if (aIsActive) { if (aIsActive) {
+4
View File
@@ -42,7 +42,9 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsViewManager.h" #include "nsViewManager.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#endif
#include "mozilla/dom/Performance.h" #include "mozilla/dom/Performance.h"
#include "mozilla/dom/WindowBinding.h" #include "mozilla/dom/WindowBinding.h"
#include "mozilla/RestyleManager.h" #include "mozilla/RestyleManager.h"
@@ -1576,11 +1578,13 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
NS_PRECONDITION(!nsContentUtils::GetCurrentJSContext(), NS_PRECONDITION(!nsContentUtils::GetCurrentJSContext(),
"Shouldn't have a JSContext on the stack"); "Shouldn't have a JSContext on the stack");
#ifdef MOZ_ENABLE_NPAPI
if (nsNPAPIPluginInstance::InPluginCallUnsafeForReentry()) { if (nsNPAPIPluginInstance::InPluginCallUnsafeForReentry()) {
NS_ERROR("Refresh driver should not run during plugin call!"); NS_ERROR("Refresh driver should not run during plugin call!");
// Try to survive this by just ignoring the refresh tick. // Try to survive this by just ignoring the refresh tick.
return; return;
} }
#endif
PROFILER_LABEL("nsRefreshDriver", "Tick", PROFILER_LABEL("nsRefreshDriver", "Tick",
js::ProfileEntry::Category::GRAPHICS); js::ProfileEntry::Category::GRAPHICS);
+4 -3
View File
@@ -29,10 +29,11 @@
#include "DecoderTraits.h" #include "DecoderTraits.h"
// plugins #ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginHost.h" #include "nsIPluginHost.h"
#include "nsPluginHost.h" #include "nsPluginHost.h"
static NS_DEFINE_CID(kPluginDocumentCID, NS_PLUGINDOCUMENT_CID); static NS_DEFINE_CID(kPluginDocumentCID, NS_PLUGINDOCUMENT_CID);
#endif
// Factory code for creating variations on html documents // Factory code for creating variations on html documents
@@ -227,7 +228,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
aContainer, kImageDocumentCID, aContainer, kImageDocumentCID,
aDocListener, aDocViewer); aDocListener, aDocViewer);
} }
#ifdef MOZ_ENABLE_NPAPI
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
// Don't exclude disabled plugins, which will still trigger the "this plugin // Don't exclude disabled plugins, which will still trigger the "this plugin
// is disabled" placeholder. // is disabled" placeholder.
@@ -238,7 +239,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
aContainer, kPluginDocumentCID, aContainer, kPluginDocumentCID,
aDocListener, aDocViewer); aDocListener, aDocViewer);
} }
#endif
// If we get here, then we weren't able to create anything. Sorry! // If we get here, then we weren't able to create anything. Sorry!
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
+4
View File
@@ -439,7 +439,9 @@ MAKE_CTOR(CreateParentMessageManager, nsIMessageBroadcaster, NS_NewPar
MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender, NS_NewChildProcessMessageManager) MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender, NS_NewChildProcessMessageManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
#ifdef MOZ_ENABLE_NPAPI
MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument) MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
#endif
MAKE_CTOR(CreateVideoDocument, nsIDocument, NS_NewVideoDocument) MAKE_CTOR(CreateVideoDocument, nsIDocument, NS_NewVideoDocument)
MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager) MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager)
@@ -834,7 +836,9 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor }, { &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor },
{ &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable }, { &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable },
{ &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF }, { &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
#ifdef MOZ_ENABLE_NPAPI
{ &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument }, { &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
#endif
{ &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument }, { &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor }, { &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
{ &kTRANSFORMIIX_XSLT_PROCESSOR_CID, false, nullptr, txMozillaXSLTProcessorConstructor }, { &kTRANSFORMIIX_XSLT_PROCESSOR_CID, false, nullptr, txMozillaXSLTProcessorConstructor },
+7 -1
View File
@@ -189,9 +189,15 @@ UNIFIED_SOURCES += [
# nsPluginFrame.cpp needs to be built separately because of name clashes in the OS X headers. # nsPluginFrame.cpp needs to be built separately because of name clashes in the OS X headers.
SOURCES += [ SOURCES += [
'nsLineLayout.cpp', 'nsLineLayout.cpp',
'nsPluginFrame.cpp',
] ]
if CONFIG['MOZ_ENABLE_NPAPI']:
SOURCES += [
'nsPluginFrame.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'
+5 -2
View File
@@ -2117,8 +2117,11 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
if (effects->mOpacity == 0.0 && aBuilder->IsForPainting() && if (effects->mOpacity == 0.0 && aBuilder->IsForPainting() &&
!(disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) && !(disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) &&
!nsLayoutUtils::HasAnimationOfProperty(this, eCSSProperty_opacity)) { !nsLayoutUtils::HasAnimationOfProperty(this, eCSSProperty_opacity)) {
if (needEventRegions || if (needEventRegions
aBuilder->WillComputePluginGeometry()) { #ifdef MOZ_ENABLE_NPAPI
|| aBuilder->WillComputePluginGeometry()
#endif
) {
opacityItemForEventsAndPluginsOnly = true; opacityItemForEventsAndPluginsOnly = true;
} else { } else {
return; return;
+3 -1
View File
@@ -61,7 +61,9 @@
#include "AsyncScrollBase.h" #include "AsyncScrollBase.h"
#include "ScrollSnap.h" #include "ScrollSnap.h"
#include "UnitTransforms.h" #include "UnitTransforms.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "mozilla/layers/APZCCallbackHelper.h" #include "mozilla/layers/APZCCallbackHelper.h"
#include <mozilla/layers/AxisPhysicsModel.h> #include <mozilla/layers/AxisPhysicsModel.h>
#include <mozilla/layers/AxisPhysicsMSDModel.h> #include <mozilla/layers/AxisPhysicsMSDModel.h>
@@ -2175,7 +2177,7 @@ ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin)
bool bool
ScrollFrameHelper::HasPluginFrames() ScrollFrameHelper::HasPluginFrames()
{ {
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) #if (defined(XP_WIN) || defined(MOZ_WIDGET_GTK)) && defined(MOZ_ENABLE_NPAPI)
if (XRE_IsContentProcess()) { if (XRE_IsContentProcess()) {
nsPresContext* presContext = mOuter->PresContext(); nsPresContext* presContext = mOuter->PresContext();
nsRootPresContext* rootPresContext = presContext->GetRootPresContext(); nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
+4 -3
View File
@@ -12,7 +12,7 @@
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
#include "mozilla/BasicEvents.h" #include "mozilla/BasicEvents.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
// This is needed for DoublePassRenderingEvent. // This is needed for DoublePassRenderingEvent.
#include "mozilla/plugins/PluginMessageUtils.h" #include "mozilla/plugins/PluginMessageUtils.h"
#endif #endif
@@ -1608,7 +1608,7 @@ nsPluginFrame::HandleWheelEventAsDefaultAction(WidgetWheelEvent* aWheelEvent)
bool bool
nsPluginFrame::WantsToHandleWheelEventAsDefaultAction() const nsPluginFrame::WantsToHandleWheelEventAsDefaultAction() const
{ {
#ifdef XP_WIN #if defined(XP_WIN) && defined(MOZ_ENABLE_NPAPI)
if (!mInstanceOwner) { if (!mInstanceOwner) {
return false; return false;
} }
@@ -1740,12 +1740,13 @@ nsPluginFrame::EndSwapDocShells(nsISupports* aSupports, void*)
objectFrame->RegisterPluginForGeometryUpdates(); objectFrame->RegisterPluginForGeometryUpdates();
} }
} }
#ifdef MOZ_ENABLE_NPAPI
nsIFrame* nsIFrame*
NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{ {
return new (aPresShell) nsPluginFrame(aContext); return new (aPresShell) nsPluginFrame(aContext);
} }
#endif
bool bool
nsPluginFrame::IsPaintedByGecko() const nsPluginFrame::IsPaintedByGecko() const
+2
View File
@@ -63,7 +63,9 @@ public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
#ifdef MOZ_ENABLE_NPAPI
friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
#endif
NS_DECL_QUERYFRAME NS_DECL_QUERYFRAME
NS_DECL_QUERYFRAME_TARGET(nsPluginFrame) NS_DECL_QUERYFRAME_TARGET(nsPluginFrame)
+6 -1
View File
@@ -36,7 +36,9 @@
#include "nsIObjectLoadingContent.h" #include "nsIObjectLoadingContent.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "FrameLayerBuilder.h" #include "FrameLayerBuilder.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginFrame.h" #include "nsPluginFrame.h"
#endif
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIPermissionManager.h" #include "nsIPermissionManager.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
@@ -1046,8 +1048,10 @@ BeginSwapDocShellsForDocument(nsIDocument* aDocument, void*)
::DestroyDisplayItemDataForFrames(rootFrame); ::DestroyDisplayItemDataForFrames(rootFrame);
} }
} }
#ifdef MOZ_ENABLE_NPAPI
aDocument->EnumerateActivityObservers( aDocument->EnumerateActivityObservers(
nsPluginFrame::BeginSwapDocShells, nullptr); nsPluginFrame::BeginSwapDocShells, nullptr);
#endif
aDocument->EnumerateSubDocuments(BeginSwapDocShellsForDocument, nullptr); aDocument->EnumerateSubDocuments(BeginSwapDocShellsForDocument, nullptr);
return true; return true;
} }
@@ -1142,9 +1146,10 @@ EndSwapDocShellsForDocument(nsIDocument* aDocument, void*)
cv = prev; cv = prev;
} }
} }
#ifdef MOZ_ENABLE_NPAPI
aDocument->EnumerateActivityObservers( aDocument->EnumerateActivityObservers(
nsPluginFrame::EndSwapDocShells, nullptr); nsPluginFrame::EndSwapDocShells, nullptr);
#endif
aDocument->EnumerateSubDocuments(EndSwapDocShellsForDocument, nullptr); aDocument->EnumerateSubDocuments(EndSwapDocShellsForDocument, nullptr);
return true; return true;
} }
+18
View File
@@ -2491,6 +2491,24 @@ then
fi fi
AC_SUBST(MOZ_ENABLE_DBUS) AC_SUBST(MOZ_ENABLE_DBUS)
dnl ========================================================
dnl = NPAPI support
dnl ========================================================
MOZ_ENABLE_NPAPI=1
MOZ_ARG_DISABLE_BOOL(npapi,
[ --disable-npapi Disable NPAPI support ],
MOZ_ENABLE_NPAPI=,
MOZ_ENABLE_NPAPI=1)
if test "$MOZ_ENABLE_NPAPI"
then
AC_DEFINE(MOZ_ENABLE_NPAPI)
fi
AC_SUBST(MOZ_ENABLE_NPAPI)
dnl ========================================================= dnl =========================================================
dnl = Whether to exclude hyphenations files in the build dnl = Whether to exclude hyphenations files in the build
dnl ========================================================= dnl =========================================================
+6 -1
View File
@@ -58,7 +58,9 @@
#include "mozilla/ipc/ProcessChild.h" #include "mozilla/ipc/ProcessChild.h"
#include "ScopedXREEmbed.h" #include "ScopedXREEmbed.h"
#ifdef MOZ_ENABLE_NPAPI
#include "mozilla/plugins/PluginProcessChild.h" #include "mozilla/plugins/PluginProcessChild.h"
#endif
#include "mozilla/dom/ContentProcess.h" #include "mozilla/dom/ContentProcess.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
@@ -90,7 +92,9 @@ using mozilla::ipc::IOThreadChild;
using mozilla::ipc::ProcessChild; using mozilla::ipc::ProcessChild;
using mozilla::ipc::ScopedXREEmbed; using mozilla::ipc::ScopedXREEmbed;
#ifdef MOZ_ENABLE_NPAPI
using mozilla::plugins::PluginProcessChild; using mozilla::plugins::PluginProcessChild;
#endif
using mozilla::dom::ContentProcess; using mozilla::dom::ContentProcess;
using mozilla::dom::ContentParent; using mozilla::dom::ContentParent;
using mozilla::dom::ContentChild; using mozilla::dom::ContentChild;
@@ -478,10 +482,11 @@ XRE_InitChildProcess(int aArgc,
case GeckoProcessType_Default: case GeckoProcessType_Default:
NS_RUNTIMEABORT("This makes no sense"); NS_RUNTIMEABORT("This makes no sense");
break; break;
#ifdef MOZ_ENABLE_NPAPI
case GeckoProcessType_Plugin: case GeckoProcessType_Plugin:
process = new PluginProcessChild(parentPID); process = new PluginProcessChild(parentPID);
break; break;
#endif
case GeckoProcessType_Content: { case GeckoProcessType_Content: {
process = new ContentProcess(parentPID); process = new ContentProcess(parentPID);
@@ -2676,13 +2676,14 @@ nsExternalHelperAppService::GetTypeFromExtension(const nsACString& aFileExt,
if (found) { if (found) {
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
// Try the plugins // Try the plugins
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if (pluginHost && if (pluginHost &&
pluginHost->HavePluginForExtension(aFileExt, aContentType)) { pluginHost->HavePluginForExtension(aFileExt, aContentType)) {
return NS_OK; return NS_OK;
} }
#endif
// Let's see if an extension added something // Let's see if an extension added something
nsCOMPtr<nsICategoryManager> catMan( nsCOMPtr<nsICategoryManager> catMan(
+2
View File
@@ -14,7 +14,9 @@
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "nsRegion.h" #include "nsRegion.h"
#include "nsCOMArray.h" #include "nsCOMArray.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsIPluginWidget.h" #include "nsIPluginWidget.h"
#endif
#include "nsXULPopupManager.h" #include "nsXULPopupManager.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsPresContext.h" #include "nsPresContext.h"
+2 -1
View File
@@ -2088,7 +2088,7 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent,
// Fire a key event. // Fire a key event.
WidgetKeyboardEvent keyEvent(true, message, mWidget); WidgetKeyboardEvent keyEvent(true, message, mWidget);
InitKeyEvent(aNativeEvent, keyEvent); InitKeyEvent(aNativeEvent, keyEvent);
#ifdef MOZ_ENABLE_NPAPI
// Attach a plugin event, in case keyEvent gets dispatched to a plugin. Only // Attach a plugin event, in case keyEvent gets dispatched to a plugin. Only
// one field is needed -- the type. The other fields can be constructed as // one field is needed -- the type. The other fields can be constructed as
// the need arises. But Gecko doesn't have anything equivalent to the // the need arises. But Gecko doesn't have anything equivalent to the
@@ -2098,6 +2098,7 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent,
nsCocoaUtils::InitNPCocoaEvent(&cocoaEvent); nsCocoaUtils::InitNPCocoaEvent(&cocoaEvent);
cocoaEvent.type = NPCocoaEventFlagsChanged; cocoaEvent.type = NPCocoaEventFlagsChanged;
keyEvent.mPluginEvent.Copy(cocoaEvent); keyEvent.mPluginEvent.Copy(cocoaEvent);
#endif
KeyEventState currentKeyEvent(aNativeEvent); KeyEventState currentKeyEvent(aNativeEvent);
nsEventStatus status = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
+4 -1
View File
@@ -10,7 +10,9 @@
#include "nsRect.h" #include "nsRect.h"
#include "imgIContainer.h" #include "imgIContainer.h"
#ifdef MOZ_ENABLE_NPAPI
#include "npapi.h" #include "npapi.h"
#endif
#include "nsTArray.h" #include "nsTArray.h"
#include "Units.h" #include "Units.h"
@@ -346,11 +348,12 @@ public:
*/ */
static NSEvent* MakeNewCocoaEventWithType(NSEventType aEventType, static NSEvent* MakeNewCocoaEventWithType(NSEventType aEventType,
NSEvent *aEvent); NSEvent *aEvent);
#ifdef MOZ_ENABLE_NPAPI
/** /**
* Initializes aNPCocoaEvent. * Initializes aNPCocoaEvent.
*/ */
static void InitNPCocoaEvent(NPCocoaEvent* aNPCocoaEvent); static void InitNPCocoaEvent(NPCocoaEvent* aNPCocoaEvent);
#endif
/** /**
* Initializes WidgetInputEvent for aNativeEvent or aModifiers. * Initializes WidgetInputEvent for aNativeEvent or aModifiers.
+25
View File
@@ -79,7 +79,9 @@
#include "nsIPropertyBag2.h" #include "nsIPropertyBag2.h"
#include "GLContext.h" #include "GLContext.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#ifdef MOZ_ENABLE_NPAPI
#include "nsPluginNativeWindowGtk.h" #include "nsPluginNativeWindowGtk.h"
#endif
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
#include "mozilla/a11y/Accessible.h" #include "mozilla/a11y/Accessible.h"
@@ -439,7 +441,9 @@ nsWindow::nsWindow()
mContainer = nullptr; mContainer = nullptr;
mGdkWindow = nullptr; mGdkWindow = nullptr;
mShell = nullptr; mShell = nullptr;
#ifdef MOZ_ENABLE_NPAPI
mPluginNativeWindow = nullptr; mPluginNativeWindow = nullptr;
#endif
mHasMappedToplevel = false; mHasMappedToplevel = false;
mIsFullyObscured = false; mIsFullyObscured = false;
mRetryPointerGrab = false; mRetryPointerGrab = false;
@@ -456,7 +460,9 @@ nsWindow::nsWindow()
mXVisual = nullptr; mXVisual = nullptr;
mXDepth = 0; mXDepth = 0;
#endif /* MOZ_X11 */ #endif /* MOZ_X11 */
#ifdef MOZ_ENABLE_NPAPI
mPluginType = PluginType_NONE; mPluginType = PluginType_NONE;
#endif
if (!gGlobalsInitialized) { if (!gGlobalsInitialized) {
gGlobalsInitialized = true; gGlobalsInitialized = true;
@@ -1132,7 +1138,9 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
NativeResize(); NativeResize();
NotifyRollupGeometryChange(); NotifyRollupGeometryChange();
#ifdef MOZ_ENABLE_NPAPI
ResizePluginSocketWidget(); ResizePluginSocketWidget();
#endif
// send a resize notification if this is a toplevel // send a resize notification if this is a toplevel
if (mIsTopLevel || mListenForResizes) { if (mIsTopLevel || mListenForResizes) {
@@ -1163,7 +1171,9 @@ nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
NativeMoveResize(); NativeMoveResize();
NotifyRollupGeometryChange(); NotifyRollupGeometryChange();
#ifdef MOZ_ENABLE_NPAPI
ResizePluginSocketWidget(); ResizePluginSocketWidget();
#endif
if (mIsTopLevel || mListenForResizes) { if (mIsTopLevel || mListenForResizes) {
DispatchResized(); DispatchResized();
@@ -1172,6 +1182,7 @@ nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
return NS_OK; return NS_OK;
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsWindow::ResizePluginSocketWidget() nsWindow::ResizePluginSocketWidget()
{ {
@@ -1188,6 +1199,7 @@ nsWindow::ResizePluginSocketWidget()
} }
} }
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsWindow::Enable(bool aState) nsWindow::Enable(bool aState)
@@ -1730,6 +1742,7 @@ nsWindow::GetNativeData(uint32_t aDataType)
case NS_NATIVE_PLUGIN_PORT: case NS_NATIVE_PLUGIN_PORT:
return SetupPluginPort(); return SetupPluginPort();
#ifdef MOZ_ENABLE_NPAPI
case NS_NATIVE_PLUGIN_ID: case NS_NATIVE_PLUGIN_ID:
if (!mPluginNativeWindow) { if (!mPluginNativeWindow) {
NS_WARNING("no native plugin instance!"); NS_WARNING("no native plugin instance!");
@@ -1737,6 +1750,7 @@ nsWindow::GetNativeData(uint32_t aDataType)
} }
// Return the socket widget XID // Return the socket widget XID
return (void*)mPluginNativeWindow->window; return (void*)mPluginNativeWindow->window;
#endif
case NS_NATIVE_DISPLAY: { case NS_NATIVE_DISPLAY: {
#ifdef MOZ_X11 #ifdef MOZ_X11
@@ -1752,8 +1766,10 @@ nsWindow::GetNativeData(uint32_t aDataType)
case NS_NATIVE_SHAREABLE_WINDOW: case NS_NATIVE_SHAREABLE_WINDOW:
return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow)); return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
#ifdef MOZ_ENABLE_NPAPI
case NS_NATIVE_PLUGIN_OBJECT_PTR: case NS_NATIVE_PLUGIN_OBJECT_PTR:
return (void *) mPluginNativeWindow; return (void *) mPluginNativeWindow;
#endif
case NS_RAW_NATIVE_IME_CONTEXT: { case NS_RAW_NATIVE_IME_CONTEXT: {
void* pseudoIMEContext = GetPseudoIMEContext(); void* pseudoIMEContext = GetPseudoIMEContext();
if (pseudoIMEContext) { if (pseudoIMEContext) {
@@ -1778,6 +1794,7 @@ nsWindow::GetNativeData(uint32_t aDataType)
} }
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal) nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal)
{ {
@@ -1787,6 +1804,7 @@ nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal)
} }
mPluginNativeWindow = (nsPluginNativeWindowGtk*)aVal; mPluginNativeWindow = (nsPluginNativeWindowGtk*)aVal;
} }
#endif
NS_IMETHODIMP NS_IMETHODIMP
nsWindow::SetTitle(const nsAString& aTitle) nsWindow::SetTitle(const nsAString& aTitle)
@@ -4823,6 +4841,7 @@ nsWindow::SetDefaultIcon(void)
SetIcon(NS_LITERAL_STRING("default")); SetIcon(NS_LITERAL_STRING("default"));
} }
#ifdef MOZ_ENABLE_NPAPI
void void
nsWindow::SetPluginType(PluginType aPluginType) nsWindow::SetPluginType(PluginType aPluginType)
{ {
@@ -4937,6 +4956,7 @@ nsWindow::LoseNonXEmbedPluginFocus()
LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus end\n")); LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus end\n"));
} }
#endif /* MOZ_X11 */ #endif /* MOZ_X11 */
#endif /* MOZ_ENABLE_NPAPI */
gint gint
nsWindow::ConvertBorderStyles(nsBorderStyle aStyle) nsWindow::ConvertBorderStyles(nsBorderStyle aStyle)
@@ -5838,6 +5858,7 @@ popup_take_focus_filter(GdkXEvent *gdk_xevent,
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
static GdkFilterReturn static GdkFilterReturn
plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
{ {
@@ -5863,6 +5884,7 @@ plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
break; break;
xeventWindow = xevent->xreparent.window; xeventWindow = xevent->xreparent.window;
} }
#ifdef MOZ_ENABLE_NPAPI
#if (MOZ_WIDGET_GTK == 2) #if (MOZ_WIDGET_GTK == 2)
plugin_window = gdk_window_lookup(xeventWindow); plugin_window = gdk_window_lookup(xeventWindow);
#else #else
@@ -5903,12 +5925,14 @@ plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
// LoseNonXEmbedPluginFocus without any checking. // LoseNonXEmbedPluginFocus without any checking.
nswindow->LoseNonXEmbedPluginFocus(); nswindow->LoseNonXEmbedPluginFocus();
break; break;
#endif // MOZ_ENABLE_NPAPI
default: default:
break; break;
} }
return return_val; return return_val;
} }
#ifdef MOZ_ENABLE_NPAPI
static GdkFilterReturn static GdkFilterReturn
plugin_client_message_filter(GdkXEvent *gdk_xevent, plugin_client_message_filter(GdkXEvent *gdk_xevent,
GdkEvent *event, GdkEvent *event,
@@ -5942,6 +5966,7 @@ plugin_client_message_filter(GdkXEvent *gdk_xevent,
return return_val; return return_val;
} }
#endif /* MOZ_X11 */ #endif /* MOZ_X11 */
#endif /* MOZ_ENABLE_NPAPI */
static gboolean static gboolean
key_press_event_cb(GtkWidget *widget, GdkEventKey *event) key_press_event_cb(GtkWidget *widget, GdkEventKey *event)
+6
View File
@@ -62,7 +62,9 @@ extern PRLogModuleInfo *gWidgetDrawLog;
#endif /* MOZ_LOGGING */ #endif /* MOZ_LOGGING */
class gfxPattern; class gfxPattern;
#ifdef MOZ_ENABLE_NPAPI
class nsPluginNativeWindowGtk; class nsPluginNativeWindowGtk;
#endif
namespace mozilla { namespace mozilla {
class TimeStamp; class TimeStamp;
@@ -140,7 +142,9 @@ public:
uint32_t aHotspotX, uint32_t aHotspotY) override; uint32_t aHotspotX, uint32_t aHotspotY) override;
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override; NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
virtual void* GetNativeData(uint32_t aDataType) override; virtual void* GetNativeData(uint32_t aDataType) override;
#ifdef MOZ_ENABLE_NPAPI
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override; void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
#endif
NS_IMETHOD SetTitle(const nsAString& aTitle) override; NS_IMETHOD SetTitle(const nsAString& aTitle) override;
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override; NS_IMETHOD SetIcon(const nsAString& aIconSpec) override;
virtual void SetWindowClass(const nsAString& xulWinType) override; virtual void SetWindowClass(const nsAString& xulWinType) override;
@@ -520,8 +524,10 @@ private:
// Updates the bounds of the socket widget we manage for remote plugins. // Updates the bounds of the socket widget we manage for remote plugins.
void ResizePluginSocketWidget(); void ResizePluginSocketWidget();
#ifdef MOZ_ENABLE_NPAPI
// e10s specific - for managing the socket widget this window hosts. // e10s specific - for managing the socket widget this window hosts.
nsPluginNativeWindowGtk* mPluginNativeWindow; nsPluginNativeWindowGtk* mPluginNativeWindow;
#endif
// The cursor cache // The cursor cache
static GdkCursor *gsGtkCursorCache[eCursorCount]; static GdkCursor *gsGtkCursorCache[eCursorCount];
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff. Show more