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
+1374 -247

No files matched your search

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