Bug 1875822 - Remove a bunch of dead JS plugin code. r=nika
Also bonus clean-up. Differential Revision: https://phabricator.services.mozilla.com/D199272
This commit is contained in:
@@ -1179,12 +1179,6 @@ pref("accessibility.typeaheadfind.timeout", 5000);
|
|||||||
pref("accessibility.typeaheadfind.linksonly", false);
|
pref("accessibility.typeaheadfind.linksonly", false);
|
||||||
pref("accessibility.typeaheadfind.flashBar", 1);
|
pref("accessibility.typeaheadfind.flashBar", 1);
|
||||||
|
|
||||||
#if defined(_ARM64_) && defined(XP_WIN)
|
|
||||||
pref("plugin.default.state", 0);
|
|
||||||
#else
|
|
||||||
pref("plugin.default.state", 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Toggling Search bar on and off in about:preferences
|
// Toggling Search bar on and off in about:preferences
|
||||||
pref("browser.preferences.search", true);
|
pref("browser.preferences.search", true);
|
||||||
#if defined(NIGHTLY_BUILD)
|
#if defined(NIGHTLY_BUILD)
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "mozIDOMWindow.h"
|
#include "mozIDOMWindow.h"
|
||||||
#include "nsIOService.h"
|
#include "nsIOService.h"
|
||||||
|
#include "nsObjectLoadingContent.h"
|
||||||
#include "mozilla/AlreadyAddRefed.h"
|
#include "mozilla/AlreadyAddRefed.h"
|
||||||
#include "mozilla/ArrayIterator.h"
|
#include "mozilla/ArrayIterator.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
@@ -312,7 +313,6 @@
|
|||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIParserUtils.h"
|
#include "nsIParserUtils.h"
|
||||||
#include "nsIPermissionManager.h"
|
#include "nsIPermissionManager.h"
|
||||||
#include "nsIPluginTag.h"
|
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsIProperties.h"
|
#include "nsIProperties.h"
|
||||||
#include "nsIProtocolHandler.h"
|
#include "nsIProtocolHandler.h"
|
||||||
@@ -357,7 +357,6 @@
|
|||||||
#include "nsPIDOMWindowInlines.h"
|
#include "nsPIDOMWindowInlines.h"
|
||||||
#include "nsParser.h"
|
#include "nsParser.h"
|
||||||
#include "nsParserConstants.h"
|
#include "nsParserConstants.h"
|
||||||
#include "nsPluginHost.h"
|
|
||||||
#include "nsPoint.h"
|
#include "nsPoint.h"
|
||||||
#include "nsPointerHashKeys.h"
|
#include "nsPointerHashKeys.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
@@ -10556,9 +10555,7 @@ uint32_t nsContentUtils::HtmlObjectContentTypeForMIMEType(
|
|||||||
return nsIObjectLoadingContent::TYPE_DOCUMENT;
|
return nsIObjectLoadingContent::TYPE_DOCUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSpecialPlugin = nsPluginHost::GetSpecialType(aMIMEType) !=
|
if (nsObjectLoadingContent::IsFallbackMimeType(aMIMEType)) {
|
||||||
nsPluginHost::eSpecialType_None;
|
|
||||||
if (isSpecialPlugin) {
|
|
||||||
return nsIObjectLoadingContent::TYPE_FALLBACK;
|
return nsIObjectLoadingContent::TYPE_FALLBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
interface nsIChannel;
|
interface nsIChannel;
|
||||||
interface nsIRequest;
|
interface nsIRequest;
|
||||||
interface nsIFrame;
|
interface nsIFrame;
|
||||||
interface nsIPluginTag;
|
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
|
|
||||||
webidl BrowsingContext;
|
webidl BrowsingContext;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
#include "nsIExternalProtocolHandler.h"
|
#include "nsIExternalProtocolHandler.h"
|
||||||
#include "nsIPermissionManager.h"
|
#include "nsIPermissionManager.h"
|
||||||
#include "nsPluginHost.h"
|
|
||||||
#include "nsPluginTags.h"
|
|
||||||
#include "nsIHttpChannel.h"
|
#include "nsIHttpChannel.h"
|
||||||
#include "nsINestedURI.h"
|
#include "nsINestedURI.h"
|
||||||
#include "nsScriptSecurityManager.h"
|
#include "nsScriptSecurityManager.h"
|
||||||
@@ -105,14 +103,20 @@ static LogModule* GetObjectLog() {
|
|||||||
#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug)
|
#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug)
|
||||||
|
|
||||||
static bool IsFlashMIME(const nsACString& aMIMEType) {
|
static bool IsFlashMIME(const nsACString& aMIMEType) {
|
||||||
return nsPluginHost::GetSpecialType(aMIMEType) ==
|
return aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash") ||
|
||||||
nsPluginHost::eSpecialType_Flash;
|
aMIMEType.LowerCaseEqualsASCII("application/futuresplash") ||
|
||||||
|
aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash-test");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsPluginType(nsObjectLoadingContent::ObjectType type) {
|
static bool IsPluginType(nsObjectLoadingContent::ObjectType type) {
|
||||||
return type == nsObjectLoadingContent::eType_Fallback;
|
return type == nsObjectLoadingContent::eType_Fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nsObjectLoadingContent::IsFallbackMimeType(const nsACString& aMIMEType) {
|
||||||
|
return IsFlashMIME(aMIMEType) ||
|
||||||
|
aMIMEType.LowerCaseEqualsASCII("application/x-test");
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Runnables and helper classes
|
/// Runnables and helper classes
|
||||||
///
|
///
|
||||||
@@ -1569,7 +1573,7 @@ nsresult nsObjectLoadingContent::OpenChannel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nsObjectLoadingContent::GetCapabilities() const {
|
uint32_t nsObjectLoadingContent::GetCapabilities() const {
|
||||||
return eSupportImages | eSupportPlugins | eSupportDocuments;
|
return eSupportImages | eSupportDocuments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsObjectLoadingContent::Destroy() {
|
void nsObjectLoadingContent::Destroy() {
|
||||||
@@ -1653,9 +1657,9 @@ nsObjectLoadingContent::ObjectType nsObjectLoadingContent::GetTypeOfContent(
|
|||||||
Element* el = AsElement();
|
Element* el = AsElement();
|
||||||
NS_ASSERTION(el, "must be a content");
|
NS_ASSERTION(el, "must be a content");
|
||||||
|
|
||||||
// Images, documents and (fake) plugins are always supported.
|
// Images and documents are always supported.
|
||||||
MOZ_ASSERT(GetCapabilities() &
|
MOZ_ASSERT((GetCapabilities() & (eSupportImages | eSupportDocuments)) ==
|
||||||
(eSupportImages | eSupportDocuments | eSupportPlugins));
|
(eSupportImages | eSupportDocuments));
|
||||||
|
|
||||||
LOG(
|
LOG(
|
||||||
("OBJLC [%p]: calling HtmlObjectContentTypeForMIMEType: aMIMEType: %s - "
|
("OBJLC [%p]: calling HtmlObjectContentTypeForMIMEType: aMIMEType: %s - "
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ class nsObjectLoadingContent : public nsIStreamListener,
|
|||||||
mNetworkCreated = aNetworkCreated;
|
mNetworkCreated = aNetworkCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsFallbackMimeType(const nsACString& aMimeType);
|
||||||
|
|
||||||
// Helper for WebIDL NeedResolve
|
// Helper for WebIDL NeedResolve
|
||||||
bool DoResolve(
|
bool DoResolve(
|
||||||
JSContext* aCx, JS::Handle<JSObject*> aObject, JS::Handle<jsid> aId,
|
JSContext* aCx, JS::Handle<JSObject*> aObject, JS::Handle<jsid> aId,
|
||||||
@@ -171,21 +173,20 @@ class nsObjectLoadingContent : public nsIStreamListener,
|
|||||||
|
|
||||||
enum Capabilities {
|
enum Capabilities {
|
||||||
eSupportImages = 1u << 0, // Images are supported (imgILoader)
|
eSupportImages = 1u << 0, // Images are supported (imgILoader)
|
||||||
eSupportPlugins = 1u << 1, // Plugins are supported (nsIPluginHost)
|
eSupportDocuments = 1u << 1, // Documents are supported
|
||||||
eSupportDocuments = 1u << 2, // Documents are supported
|
|
||||||
// (DocumentLoaderFactory)
|
// (DocumentLoaderFactory)
|
||||||
// This flag always includes SVG
|
// This flag always includes SVG
|
||||||
|
|
||||||
// Node supports class ID as an attribute, and should fallback if it is
|
// Node supports class ID as an attribute, and should fallback if it is
|
||||||
// present, as class IDs are not supported.
|
// present, as class IDs are not supported.
|
||||||
eFallbackIfClassIDPresent = 1u << 3,
|
eFallbackIfClassIDPresent = 1u << 2,
|
||||||
|
|
||||||
// If possible to get a *plugin* type from the type attribute *or* file
|
// If possible to get a *plugin* type from the type attribute *or* file
|
||||||
// extension, we can use that type and begin loading the plugin before
|
// extension, we can use that type and begin loading the plugin before
|
||||||
// opening a channel.
|
// opening a channel.
|
||||||
// A side effect of this is if the channel fails, the plugin is still
|
// A side effect of this is if the channel fails, the plugin is still
|
||||||
// running.
|
// running.
|
||||||
eAllowPluginSkipChannel = 1u << 4
|
eAllowPluginSkipChannel = 1u << 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -223,8 +223,7 @@ void HTMLEmbedElement::StartObjectLoad(bool aNotify, bool aForceLoad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t HTMLEmbedElement::GetCapabilities() const {
|
uint32_t HTMLEmbedElement::GetCapabilities() const {
|
||||||
return eSupportPlugins | eAllowPluginSkipChannel | eSupportImages |
|
return eAllowPluginSkipChannel | eSupportImages | eSupportDocuments;
|
||||||
eSupportDocuments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLEmbedElement::DestroyContent() {
|
void HTMLEmbedElement::DestroyContent() {
|
||||||
|
|||||||
@@ -234,7 +234,6 @@
|
|||||||
#include "nsMemoryReporterManager.h"
|
#include "nsMemoryReporterManager.h"
|
||||||
#include "nsOpenURIInFrameParams.h"
|
#include "nsOpenURIInFrameParams.h"
|
||||||
#include "nsPIWindowWatcher.h"
|
#include "nsPIWindowWatcher.h"
|
||||||
#include "nsPluginTags.h"
|
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsSHistory.h"
|
#include "nsSHistory.h"
|
||||||
@@ -595,8 +594,6 @@ ProcessID GetTelemetryProcessID(const nsACString& remoteType) {
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
StaticAutoPtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
|
||||||
ContentParent::sJSPluginContentParents;
|
|
||||||
StaticAutoPtr<LinkedList<ContentParent>> ContentParent::sContentParents;
|
StaticAutoPtr<LinkedList<ContentParent>> ContentParent::sContentParents;
|
||||||
StaticRefPtr<ContentParent> ContentParent::sRecycledE10SProcess;
|
StaticRefPtr<ContentParent> ContentParent::sRecycledE10SProcess;
|
||||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||||
@@ -809,8 +806,7 @@ void ContentParent::ReleaseCachedProcesses() {
|
|||||||
// Ensure the process cannot be claimed between check and MarkAsDead.
|
// Ensure the process cannot be claimed between check and MarkAsDead.
|
||||||
RecursiveMutexAutoLock lock(cp->ThreadsafeHandleMutex());
|
RecursiveMutexAutoLock lock(cp->ThreadsafeHandleMutex());
|
||||||
|
|
||||||
if (cp->ManagedPBrowserParent().Count() == 0 &&
|
if (cp->ManagedPBrowserParent().Count() == 0 && !cp->HasActiveWorker() &&
|
||||||
!cp->HasActiveWorkerOrJSPlugin() &&
|
|
||||||
cp->mRemoteType == DEFAULT_REMOTE_TYPE) {
|
cp->mRemoteType == DEFAULT_REMOTE_TYPE) {
|
||||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||||
(" Shutdown %p (%s)", cp.get(), cp->mRemoteType.get()));
|
(" Shutdown %p (%s)", cp.get(), cp->mRemoteType.get()));
|
||||||
@@ -824,11 +820,10 @@ void ContentParent::ReleaseCachedProcesses() {
|
|||||||
// message manager.
|
// message manager.
|
||||||
cp->ShutDownMessageManager();
|
cp->ShutDownMessageManager();
|
||||||
} else {
|
} else {
|
||||||
MOZ_LOG(
|
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||||
ContentParent::GetLog(), LogLevel::Debug,
|
(" Skipping %p (%s), count %d, HasActiveWorker %d", cp.get(),
|
||||||
(" Skipping %p (%s), count %d, HasActiveWorkerOrJSPlugin %d",
|
cp->mRemoteType.get(), cp->ManagedPBrowserParent().Count(),
|
||||||
cp.get(), cp->mRemoteType.get(), cp->ManagedPBrowserParent().Count(),
|
cp->HasActiveWorker()));
|
||||||
cp->HasActiveWorkerOrJSPlugin()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1198,31 +1193,6 @@ bool ContentParent::WaitForLaunchSync(ProcessPriority aPriority) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/
|
|
||||||
already_AddRefed<ContentParent> ContentParent::GetNewOrUsedJSPluginProcess(
|
|
||||||
uint32_t aPluginID, const hal::ProcessPriority& aPriority) {
|
|
||||||
RefPtr<ContentParent> p;
|
|
||||||
if (sJSPluginContentParents) {
|
|
||||||
p = sJSPluginContentParents->Get(aPluginID);
|
|
||||||
} else {
|
|
||||||
sJSPluginContentParents = new nsTHashMap<nsUint32HashKey, ContentParent*>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
return p.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
p = new ContentParent(aPluginID);
|
|
||||||
|
|
||||||
if (!p->LaunchSubprocessSync(aPriority)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
sJSPluginContentParents->InsertOrUpdate(aPluginID, p);
|
|
||||||
|
|
||||||
return p.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsIDocShell* GetOpenerDocShellHelper(Element* aFrameElement) {
|
static nsIDocShell* GetOpenerDocShellHelper(Element* aFrameElement) {
|
||||||
// Propagate the private-browsing status of the element's parent
|
// Propagate the private-browsing status of the element's parent
|
||||||
// docshell to the remote docshell, via the chrome flags.
|
// docshell to the remote docshell, via the chrome flags.
|
||||||
@@ -1472,13 +1442,8 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
|
|||||||
if (aOpenerContentParent && !aOpenerContentParent->IsShuttingDown()) {
|
if (aOpenerContentParent && !aOpenerContentParent->IsShuttingDown()) {
|
||||||
constructorSender = aOpenerContentParent;
|
constructorSender = aOpenerContentParent;
|
||||||
} else {
|
} else {
|
||||||
if (aContext.IsJSPlugin()) {
|
constructorSender = GetNewOrUsedBrowserProcess(
|
||||||
constructorSender = GetNewOrUsedJSPluginProcess(
|
remoteType, aBrowsingContext->Group(), PROCESS_PRIORITY_FOREGROUND);
|
||||||
aContext.JSPluginId(), PROCESS_PRIORITY_FOREGROUND);
|
|
||||||
} else {
|
|
||||||
constructorSender = GetNewOrUsedBrowserProcess(
|
|
||||||
remoteType, aBrowsingContext->Group(), PROCESS_PRIORITY_FOREGROUND);
|
|
||||||
}
|
|
||||||
if (!constructorSender) {
|
if (!constructorSender) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -1951,19 +1916,13 @@ void ContentParent::AssertNotInPool() {
|
|||||||
MOZ_RELEASE_ASSERT(!mIsInPool);
|
MOZ_RELEASE_ASSERT(!mIsInPool);
|
||||||
|
|
||||||
MOZ_RELEASE_ASSERT(sRecycledE10SProcess != this);
|
MOZ_RELEASE_ASSERT(sRecycledE10SProcess != this);
|
||||||
if (IsForJSPlugin()) {
|
MOZ_RELEASE_ASSERT(!sBrowserContentParents ||
|
||||||
MOZ_RELEASE_ASSERT(!sJSPluginContentParents ||
|
!sBrowserContentParents->Contains(mRemoteType) ||
|
||||||
!sJSPluginContentParents->Get(mJSPluginID));
|
!sBrowserContentParents->Get(mRemoteType)->Contains(this));
|
||||||
} else {
|
|
||||||
MOZ_RELEASE_ASSERT(
|
|
||||||
!sBrowserContentParents ||
|
|
||||||
!sBrowserContentParents->Contains(mRemoteType) ||
|
|
||||||
!sBrowserContentParents->Get(mRemoteType)->Contains(this));
|
|
||||||
|
|
||||||
for (const auto& group : mGroups) {
|
for (const auto& group : mGroups) {
|
||||||
MOZ_RELEASE_ASSERT(group->GetHostProcess(mRemoteType) != this,
|
MOZ_RELEASE_ASSERT(group->GetHostProcess(mRemoteType) != this,
|
||||||
"still a host process for one of our groups?");
|
"still a host process for one of our groups?");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1974,16 +1933,6 @@ void ContentParent::AssertAlive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContentParent::RemoveFromList() {
|
void ContentParent::RemoveFromList() {
|
||||||
if (IsForJSPlugin()) {
|
|
||||||
if (sJSPluginContentParents) {
|
|
||||||
sJSPluginContentParents->Remove(mJSPluginID);
|
|
||||||
if (!sJSPluginContentParents->Count()) {
|
|
||||||
sJSPluginContentParents = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mIsInPool) {
|
if (!mIsInPool) {
|
||||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||||
AssertNotInPool();
|
AssertNotInPool();
|
||||||
@@ -2327,11 +2276,7 @@ void ContentParent::StopRecyclingE10SOnly(bool aForeground) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentParent::HasActiveWorkerOrJSPlugin() {
|
bool ContentParent::HasActiveWorker() {
|
||||||
if (IsForJSPlugin()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have active workers, we need to stay alive.
|
// If we have active workers, we need to stay alive.
|
||||||
{
|
{
|
||||||
// Most of the times we'll get here with the mutex acquired, but still.
|
// Most of the times we'll get here with the mutex acquired, but still.
|
||||||
@@ -2344,7 +2289,7 @@ bool ContentParent::HasActiveWorkerOrJSPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ContentParent::ShouldKeepProcessAlive() {
|
bool ContentParent::ShouldKeepProcessAlive() {
|
||||||
if (HasActiveWorkerOrJSPlugin()) {
|
if (HasActiveWorker()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2869,7 +2814,7 @@ RefPtr<ContentParent::LaunchPromise> ContentParent::LaunchSubprocessAsync(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentParent::ContentParent(const nsACString& aRemoteType, int32_t aJSPluginID)
|
ContentParent::ContentParent(const nsACString& aRemoteType)
|
||||||
: mSubprocess(nullptr),
|
: mSubprocess(nullptr),
|
||||||
mLaunchTS(TimeStamp::Now()),
|
mLaunchTS(TimeStamp::Now()),
|
||||||
mLaunchYieldTS(mLaunchTS),
|
mLaunchYieldTS(mLaunchTS),
|
||||||
@@ -2878,7 +2823,6 @@ ContentParent::ContentParent(const nsACString& aRemoteType, int32_t aJSPluginID)
|
|||||||
mRemoteType(aRemoteType),
|
mRemoteType(aRemoteType),
|
||||||
mChildID(gContentChildID++),
|
mChildID(gContentChildID++),
|
||||||
mGeolocationWatchID(-1),
|
mGeolocationWatchID(-1),
|
||||||
mJSPluginID(aJSPluginID),
|
|
||||||
mThreadsafeHandle(
|
mThreadsafeHandle(
|
||||||
new ThreadsafeContentParentHandle(this, mChildID, mRemoteType)),
|
new ThreadsafeContentParentHandle(this, mChildID, mRemoteType)),
|
||||||
mNumDestroyingTabs(0),
|
mNumDestroyingTabs(0),
|
||||||
@@ -2899,9 +2843,6 @@ ContentParent::ContentParent(const nsACString& aRemoteType, int32_t aJSPluginID)
|
|||||||
mBlockShutdownCalled(false),
|
mBlockShutdownCalled(false),
|
||||||
#endif
|
#endif
|
||||||
mHangMonitorActor(nullptr) {
|
mHangMonitorActor(nullptr) {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(!IsForJSPlugin(),
|
|
||||||
"XXX(nika): How are we creating a JSPlugin?");
|
|
||||||
|
|
||||||
mRemoteTypeIsolationPrincipal =
|
mRemoteTypeIsolationPrincipal =
|
||||||
CreateRemoteTypeIsolationPrincipal(aRemoteType);
|
CreateRemoteTypeIsolationPrincipal(aRemoteType);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include "nsClassHashtable.h"
|
#include "nsClassHashtable.h"
|
||||||
#include "nsTHashMap.h"
|
#include "nsTHashMap.h"
|
||||||
#include "nsTHashSet.h"
|
#include "nsTHashSet.h"
|
||||||
#include "nsPluginTags.h"
|
|
||||||
#include "nsHashKeys.h"
|
#include "nsHashKeys.h"
|
||||||
#include "nsIAsyncShutdown.h"
|
#include "nsIAsyncShutdown.h"
|
||||||
#include "nsIDOMProcessParent.h"
|
#include "nsIDOMProcessParent.h"
|
||||||
@@ -218,14 +217,6 @@ class ContentParent final : public PContentParent,
|
|||||||
bool WaitForLaunchSync(hal::ProcessPriority aPriority =
|
bool WaitForLaunchSync(hal::ProcessPriority aPriority =
|
||||||
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND);
|
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get or create a content process for a JS plugin. aPluginID is the id of the
|
|
||||||
* JS plugin
|
|
||||||
* (@see nsFakePlugin::mId). There is a maximum of one process per JS plugin.
|
|
||||||
*/
|
|
||||||
static already_AddRefed<ContentParent> GetNewOrUsedJSPluginProcess(
|
|
||||||
uint32_t aPluginID, const hal::ProcessPriority& aPriority);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get or create a content process for the given TabContext. aFrameElement
|
* Get or create a content process for the given TabContext. aFrameElement
|
||||||
* should be the frame/iframe element with which this process will
|
* should be the frame/iframe element with which this process will
|
||||||
@@ -391,9 +382,6 @@ class ContentParent final : public PContentParent,
|
|||||||
bool IsDead() const { return mLifecycleState == LifecycleState::DEAD; }
|
bool IsDead() const { return mLifecycleState == LifecycleState::DEAD; }
|
||||||
|
|
||||||
bool IsForBrowser() const { return mIsForBrowser; }
|
bool IsForBrowser() const { return mIsForBrowser; }
|
||||||
bool IsForJSPlugin() const {
|
|
||||||
return mJSPluginID != nsFakePluginTag::NOT_JSPLUGIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeckoChildProcessHost* Process() const { return mSubprocess; }
|
GeckoChildProcessHost* Process() const { return mSubprocess; }
|
||||||
|
|
||||||
@@ -690,8 +678,6 @@ class ContentParent final : public PContentParent,
|
|||||||
*/
|
*/
|
||||||
static nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>*
|
static nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>*
|
||||||
sBrowserContentParents;
|
sBrowserContentParents;
|
||||||
static mozilla::StaticAutoPtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
|
||||||
sJSPluginContentParents;
|
|
||||||
static mozilla::StaticAutoPtr<LinkedList<ContentParent>> sContentParents;
|
static mozilla::StaticAutoPtr<LinkedList<ContentParent>> sContentParents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -728,11 +714,7 @@ class ContentParent final : public PContentParent,
|
|||||||
bool aLoadUri, nsIContentSecurityPolicy* aCsp,
|
bool aLoadUri, nsIContentSecurityPolicy* aCsp,
|
||||||
const OriginAttributes& aOriginAttributes);
|
const OriginAttributes& aOriginAttributes);
|
||||||
|
|
||||||
explicit ContentParent(int32_t aPluginID) : ContentParent(""_ns, aPluginID) {}
|
explicit ContentParent(const nsACString& aRemoteType);
|
||||||
explicit ContentParent(const nsACString& aRemoteType)
|
|
||||||
: ContentParent(aRemoteType, nsFakePluginTag::NOT_JSPLUGIN) {}
|
|
||||||
|
|
||||||
ContentParent(const nsACString& aRemoteType, int32_t aPluginID);
|
|
||||||
|
|
||||||
// Launch the subprocess and associated initialization.
|
// Launch the subprocess and associated initialization.
|
||||||
// Returns false if the process fails to start.
|
// Returns false if the process fails to start.
|
||||||
@@ -795,9 +777,9 @@ class ContentParent final : public PContentParent,
|
|||||||
void RemoveFromList();
|
void RemoveFromList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if the process has an active worker or JSPlugin
|
* Return if the process has an active worker.
|
||||||
*/
|
*/
|
||||||
bool HasActiveWorkerOrJSPlugin();
|
bool HasActiveWorker();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decide whether the process should be kept alive even when it would normally
|
* Decide whether the process should be kept alive even when it would normally
|
||||||
@@ -1466,12 +1448,6 @@ class ContentParent final : public PContentParent,
|
|||||||
ContentParentId mChildID;
|
ContentParentId mChildID;
|
||||||
int32_t mGeolocationWatchID;
|
int32_t mGeolocationWatchID;
|
||||||
|
|
||||||
// This contains the id for the JS plugin (@see nsFakePluginTag) if this is
|
|
||||||
// the ContentParent for a process containing iframes for that JS plugin. If
|
|
||||||
// this is not a ContentParent for a JS plugin then it contains the value
|
|
||||||
// nsFakePluginTag::NOT_JSPLUGIN.
|
|
||||||
int32_t mJSPluginID;
|
|
||||||
|
|
||||||
// After we destroy the last Browser, we also start a timer to ensure
|
// After we destroy the last Browser, we also start a timer to ensure
|
||||||
// that even content processes that are not responding will get a
|
// that even content processes that are not responding will get a
|
||||||
// second chance and a shutdown message.
|
// second chance and a shutdown message.
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ struct FrameIPCTabContext
|
|||||||
uint32_t maxTouchPoints;
|
uint32_t maxTouchPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JSPluginFrameIPCTabContext
|
|
||||||
{
|
|
||||||
uint32_t jsPluginId;
|
|
||||||
};
|
|
||||||
|
|
||||||
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
|
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
|
||||||
// iframe/PBrowser's own and containing app-ids and tell you whether the
|
// iframe/PBrowser's own and containing app-ids and tell you whether the
|
||||||
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
|
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
|
||||||
@@ -46,7 +41,6 @@ union IPCTabContext
|
|||||||
{
|
{
|
||||||
PopupIPCTabContext;
|
PopupIPCTabContext;
|
||||||
FrameIPCTabContext;
|
FrameIPCTabContext;
|
||||||
JSPluginFrameIPCTabContext;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,8 @@ namespace mozilla::dom {
|
|||||||
TabContext::TabContext()
|
TabContext::TabContext()
|
||||||
: mInitialized(false),
|
: mInitialized(false),
|
||||||
mChromeOuterWindowID(0),
|
mChromeOuterWindowID(0),
|
||||||
mJSPluginID(-1),
|
|
||||||
mMaxTouchPoints(0) {}
|
mMaxTouchPoints(0) {}
|
||||||
|
|
||||||
bool TabContext::IsJSPlugin() const { return mJSPluginID >= 0; }
|
|
||||||
|
|
||||||
int32_t TabContext::JSPluginId() const { return mJSPluginID; }
|
|
||||||
|
|
||||||
uint64_t TabContext::ChromeOuterWindowID() const {
|
uint64_t TabContext::ChromeOuterWindowID() const {
|
||||||
return mChromeOuterWindowID;
|
return mChromeOuterWindowID;
|
||||||
}
|
}
|
||||||
@@ -60,19 +55,7 @@ bool TabContext::SetTabContext(uint64_t aChromeOuterWindowID,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabContext::SetTabContextForJSPluginFrame(int32_t aJSPluginID) {
|
|
||||||
NS_ENSURE_FALSE(mInitialized, false);
|
|
||||||
|
|
||||||
mInitialized = true;
|
|
||||||
mJSPluginID = aJSPluginID;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCTabContext TabContext::AsIPCTabContext() const {
|
IPCTabContext TabContext::AsIPCTabContext() const {
|
||||||
if (IsJSPlugin()) {
|
|
||||||
return IPCTabContext(JSPluginFrameIPCTabContext(mJSPluginID));
|
|
||||||
}
|
|
||||||
|
|
||||||
return IPCTabContext(
|
return IPCTabContext(
|
||||||
FrameIPCTabContext(mChromeOuterWindowID, mMaxTouchPoints));
|
FrameIPCTabContext(mChromeOuterWindowID, mMaxTouchPoints));
|
||||||
}
|
}
|
||||||
@@ -80,7 +63,6 @@ IPCTabContext TabContext::AsIPCTabContext() const {
|
|||||||
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
: mInvalidReason(nullptr) {
|
: mInvalidReason(nullptr) {
|
||||||
uint64_t chromeOuterWindowID = 0;
|
uint64_t chromeOuterWindowID = 0;
|
||||||
int32_t jsPluginId = -1;
|
|
||||||
uint32_t maxTouchPoints = 0;
|
uint32_t maxTouchPoints = 0;
|
||||||
|
|
||||||
switch (aParams.type()) {
|
switch (aParams.type()) {
|
||||||
@@ -90,13 +72,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
|||||||
chromeOuterWindowID = ipcContext.chromeOuterWindowID();
|
chromeOuterWindowID = ipcContext.chromeOuterWindowID();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPCTabContext::TJSPluginFrameIPCTabContext: {
|
|
||||||
const JSPluginFrameIPCTabContext& ipcContext =
|
|
||||||
aParams.get_JSPluginFrameIPCTabContext();
|
|
||||||
|
|
||||||
jsPluginId = ipcContext.jsPluginId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IPCTabContext::TFrameIPCTabContext: {
|
case IPCTabContext::TFrameIPCTabContext: {
|
||||||
const FrameIPCTabContext& ipcContext = aParams.get_FrameIPCTabContext();
|
const FrameIPCTabContext& ipcContext = aParams.get_FrameIPCTabContext();
|
||||||
|
|
||||||
@@ -109,13 +84,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rv;
|
if (!mTabContext.SetTabContext(chromeOuterWindowID, maxTouchPoints)) {
|
||||||
if (jsPluginId >= 0) {
|
|
||||||
rv = mTabContext.SetTabContextForJSPluginFrame(jsPluginId);
|
|
||||||
} else {
|
|
||||||
rv = mTabContext.SetTabContext(chromeOuterWindowID, maxTouchPoints);
|
|
||||||
}
|
|
||||||
if (!rv) {
|
|
||||||
mInvalidReason = "Couldn't initialize TabContext.";
|
mInvalidReason = "Couldn't initialize TabContext.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ class TabContext {
|
|||||||
*/
|
*/
|
||||||
IPCTabContext AsIPCTabContext() const;
|
IPCTabContext AsIPCTabContext() const;
|
||||||
|
|
||||||
bool IsJSPlugin() const;
|
|
||||||
int32_t JSPluginId() const;
|
|
||||||
|
|
||||||
uint64_t ChromeOuterWindowID() const;
|
uint64_t ChromeOuterWindowID() const;
|
||||||
|
|
||||||
uint32_t MaxTouchPoints() const { return mMaxTouchPoints; }
|
uint32_t MaxTouchPoints() const { return mMaxTouchPoints; }
|
||||||
@@ -75,16 +72,6 @@ class TabContext {
|
|||||||
*/
|
*/
|
||||||
bool UpdateTabContextAfterSwap(const TabContext& aContext);
|
bool UpdateTabContextAfterSwap(const TabContext& aContext);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set this TabContext to be for a JS plugin. aPluginID is the id of the JS
|
|
||||||
* plugin
|
|
||||||
* (@see nsFakePlugin::mId).
|
|
||||||
* As with the other protected mutator methods, this lets you modify a
|
|
||||||
* TabContext once.
|
|
||||||
* (@see TabContext::SetTabContext above for more details).
|
|
||||||
*/
|
|
||||||
bool SetTabContextForJSPluginFrame(int32_t aJSPluginID);
|
|
||||||
|
|
||||||
void SetMaxTouchPoints(uint32_t aMaxTouchPoints) {
|
void SetMaxTouchPoints(uint32_t aMaxTouchPoints) {
|
||||||
mMaxTouchPoints = aMaxTouchPoints;
|
mMaxTouchPoints = aMaxTouchPoints;
|
||||||
}
|
}
|
||||||
@@ -100,8 +87,6 @@ class TabContext {
|
|||||||
*/
|
*/
|
||||||
uint64_t mChromeOuterWindowID;
|
uint64_t mChromeOuterWindowID;
|
||||||
|
|
||||||
int32_t mJSPluginID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of touch points.
|
* Maximum number of touch points.
|
||||||
*/
|
*/
|
||||||
@@ -122,10 +107,6 @@ class MutableTabContext : public TabContext {
|
|||||||
bool SetTabContext(uint64_t aChromeOuterWindowID, uint32_t aMaxTouchPoints) {
|
bool SetTabContext(uint64_t aChromeOuterWindowID, uint32_t aMaxTouchPoints) {
|
||||||
return TabContext::SetTabContext(aChromeOuterWindowID, aMaxTouchPoints);
|
return TabContext::SetTabContext(aChromeOuterWindowID, aMaxTouchPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetTabContextForJSPluginFrame(uint32_t aJSPluginID) {
|
|
||||||
return TabContext::SetTabContextForJSPluginFrame(aJSPluginID);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ DIRS += [
|
|||||||
"locks",
|
"locks",
|
||||||
"network",
|
"network",
|
||||||
"permission",
|
"permission",
|
||||||
"plugins/base",
|
|
||||||
"prototype",
|
"prototype",
|
||||||
"indexedDB",
|
"indexedDB",
|
||||||
"system",
|
"system",
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
|
||||||
# vim: set filetype=python:
|
|
||||||
# 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/.
|
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
|
||||||
"nsIPluginTag.idl",
|
|
||||||
]
|
|
||||||
|
|
||||||
XPIDL_MODULE = "plugin"
|
|
||||||
|
|
||||||
EXPORTS += [
|
|
||||||
"nsPluginHost.h",
|
|
||||||
"nsPluginTags.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
|
||||||
"nsPluginHost.cpp",
|
|
||||||
"nsPluginTags.cpp",
|
|
||||||
]
|
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
|
||||||
"/dom/base",
|
|
||||||
"/gfx/cairo/cairo/src",
|
|
||||||
"/layout/generic",
|
|
||||||
"/layout/xul",
|
|
||||||
"/netwerk/base",
|
|
||||||
"/widget",
|
|
||||||
"/widget/cocoa",
|
|
||||||
"/xpcom/base",
|
|
||||||
]
|
|
||||||
|
|
||||||
if CONFIG["OS_ARCH"] == "WINNT":
|
|
||||||
LOCAL_INCLUDES += [
|
|
||||||
"/xpcom/base",
|
|
||||||
]
|
|
||||||
|
|
||||||
include("/ipc/chromium/chromium-config.mozbuild")
|
|
||||||
|
|
||||||
FINAL_LIBRARY = "xul"
|
|
||||||
|
|
||||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
||||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* 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"
|
|
||||||
|
|
||||||
interface nsIURI;
|
|
||||||
|
|
||||||
[builtinclass, scriptable, uuid(5daa99d5-265a-4397-b429-c943803e2619)]
|
|
||||||
interface nsIPluginTag : nsISupports
|
|
||||||
{
|
|
||||||
// enabledState is stored as one of the following as an integer in prefs,
|
|
||||||
// so if new states are added, they must not renumber the existing states.
|
|
||||||
const unsigned long STATE_DISABLED = 0;
|
|
||||||
const unsigned long STATE_CLICKTOPLAY = 1;
|
|
||||||
const unsigned long STATE_ENABLED = 2;
|
|
||||||
|
|
||||||
readonly attribute AUTF8String description;
|
|
||||||
readonly attribute AUTF8String filename;
|
|
||||||
readonly attribute AUTF8String fullpath;
|
|
||||||
readonly attribute AUTF8String version;
|
|
||||||
readonly attribute AUTF8String name;
|
|
||||||
|
|
||||||
// The 'nice' name of this plugin, e.g. 'flash' 'java'
|
|
||||||
readonly attribute AUTF8String niceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* true only if this plugin is "hardblocked" and cannot be enabled.
|
|
||||||
*/
|
|
||||||
// FIXME-jsplugins QI to fakePluginTag possible
|
|
||||||
// FIXME-jsplugins implement missing + tests (whatever that means)
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean blocklisted;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* true if the state is non-default and locked, false otherwise.
|
|
||||||
*/
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean isEnabledStateLocked;
|
|
||||||
|
|
||||||
// If this plugin is capable of being used (not disabled, blocklisted, etc)
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean active;
|
|
||||||
|
|
||||||
// Get a specific nsIBlocklistService::STATE_*
|
|
||||||
[infallible]
|
|
||||||
readonly attribute unsigned long blocklistState;
|
|
||||||
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean disabled;
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean clicktoplay;
|
|
||||||
[infallible]
|
|
||||||
readonly attribute boolean loaded;
|
|
||||||
// See the STATE_* values above.
|
|
||||||
attribute unsigned long enabledState;
|
|
||||||
|
|
||||||
readonly attribute PRTime lastModifiedTime;
|
|
||||||
|
|
||||||
readonly attribute boolean isFlashPlugin;
|
|
||||||
|
|
||||||
Array<AUTF8String> getMimeTypes();
|
|
||||||
Array<AUTF8String> getMimeDescriptions();
|
|
||||||
Array<AUTF8String> getExtensions();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An id for this plugin. 0 is a valid id.
|
|
||||||
*/
|
|
||||||
readonly attribute unsigned long id;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An interface representing a "fake" plugin: one implemented in JavaScript, not
|
|
||||||
* as a NPAPI plug-in. See nsIPluginHost.registerFakePlugin and the
|
|
||||||
* documentation for the FakePluginTagInit dictionary.
|
|
||||||
*/
|
|
||||||
[builtinclass, scriptable, uuid(6d22c968-226d-4156-b230-da6ad6bbf6e8)]
|
|
||||||
interface nsIFakePluginTag : nsIPluginTag
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The URI that should be loaded into the tag (as a frame) to handle the
|
|
||||||
* plugin. Note that the original data/src value for the plugin is not loaded
|
|
||||||
* and will need to be requested by the handler via XHR or similar if desired.
|
|
||||||
*/
|
|
||||||
readonly attribute nsIURI handlerURI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Optional script to run in a sandbox when instantiating a plugin. If this
|
|
||||||
* value is an empty string then no such script will be run.
|
|
||||||
* The script runs in a sandbox with system principal in the process that
|
|
||||||
* contains the element that instantiates the plugin (ie the EMBED or OBJECT
|
|
||||||
* element). The sandbox global has a 'pluginElement' property that the script
|
|
||||||
* can use to access the element that instantiates the plugin.
|
|
||||||
*/
|
|
||||||
readonly attribute AString sandboxScript;
|
|
||||||
};
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
/* nsPluginHost.cpp - top-level plugin management code */
|
|
||||||
|
|
||||||
#include "nsPluginHost.h"
|
|
||||||
|
|
||||||
#include "nsTString.h"
|
|
||||||
|
|
||||||
nsPluginHost::SpecialType nsPluginHost::GetSpecialType(
|
|
||||||
const nsACString& aMIMEType) {
|
|
||||||
if (aMIMEType.LowerCaseEqualsASCII("application/x-test")) {
|
|
||||||
return eSpecialType_Test;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash") ||
|
|
||||||
aMIMEType.LowerCaseEqualsASCII("application/futuresplash") ||
|
|
||||||
aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash-test")) {
|
|
||||||
return eSpecialType_Flash;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eSpecialType_None;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef nsPluginHost_h_
|
|
||||||
#define nsPluginHost_h_
|
|
||||||
|
|
||||||
#include "nsStringFwd.h"
|
|
||||||
|
|
||||||
namespace nsPluginHost {
|
|
||||||
|
|
||||||
// checks whether aType is a type we recognize for potential special handling
|
|
||||||
enum SpecialType {
|
|
||||||
eSpecialType_None,
|
|
||||||
// Needed to whitelist for async init support
|
|
||||||
eSpecialType_Test,
|
|
||||||
// Informs some decisions about OOP and quirks
|
|
||||||
eSpecialType_Flash
|
|
||||||
};
|
|
||||||
SpecialType GetSpecialType(const nsACString& aMIMEType);
|
|
||||||
|
|
||||||
} // namespace nsPluginHost
|
|
||||||
|
|
||||||
#endif // nsPluginHost_h_
|
|
||||||
@@ -1,389 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* 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 "nsPluginTags.h"
|
|
||||||
|
|
||||||
#include "prlink.h"
|
|
||||||
#include "prenv.h"
|
|
||||||
#include "nsIBlocklistService.h"
|
|
||||||
#include "nsCharSeparatedTokenizer.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "mozilla/Unused.h"
|
|
||||||
#include "nsNetUtil.h"
|
|
||||||
#include <cctype>
|
|
||||||
#include "mozilla/Encoding.h"
|
|
||||||
#include "mozilla/dom/FakePluginTagInitBinding.h"
|
|
||||||
|
|
||||||
using mozilla::dom::FakePluginTagInit;
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
// check comma delimited extensions
|
|
||||||
static bool ExtensionInList(const nsCString& aExtensionList,
|
|
||||||
const nsACString& aExtension) {
|
|
||||||
for (const nsACString& extension :
|
|
||||||
nsCCharSeparatedTokenizer(aExtensionList, ',').ToRange()) {
|
|
||||||
if (extension.Equals(aExtension, nsCaseInsensitiveCStringComparator)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for an extension in an extensions array, and return its
|
|
||||||
// matching mime type
|
|
||||||
static bool SearchExtensions(const nsTArray<nsCString>& aExtensions,
|
|
||||||
const nsTArray<nsCString>& aMimeTypes,
|
|
||||||
const nsACString& aFindExtension,
|
|
||||||
nsACString& aMatchingType) {
|
|
||||||
uint32_t mimes = aMimeTypes.Length();
|
|
||||||
MOZ_ASSERT(mimes == aExtensions.Length(),
|
|
||||||
"These arrays should have matching elements");
|
|
||||||
|
|
||||||
aMatchingType.Truncate();
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mimes; i++) {
|
|
||||||
if (ExtensionInList(aExtensions[i], aFindExtension)) {
|
|
||||||
aMatchingType = aMimeTypes[i];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsCString MakeNiceFileName(const nsCString& aFileName) {
|
|
||||||
nsCString niceName = aFileName;
|
|
||||||
int32_t niceNameLength = aFileName.RFind(".");
|
|
||||||
NS_ASSERTION(niceNameLength != kNotFound, "aFileName doesn't have a '.'?");
|
|
||||||
while (niceNameLength > 0) {
|
|
||||||
char chr = aFileName[niceNameLength - 1];
|
|
||||||
if (!std::isalpha(chr))
|
|
||||||
niceNameLength--;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it turns out that niceNameLength <= 0, we'll fall back and use the
|
|
||||||
// entire aFileName (which we've already taken care of, a few lines back).
|
|
||||||
if (niceNameLength > 0) {
|
|
||||||
niceName.Truncate(niceNameLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
ToLowerCase(niceName);
|
|
||||||
return niceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsCString MakePrefNameForPlugin(const char* const subname,
|
|
||||||
nsIInternalPluginTag* aTag) {
|
|
||||||
nsCString pref;
|
|
||||||
nsAutoCString pluginName(aTag->GetNiceFileName());
|
|
||||||
|
|
||||||
if (pluginName.IsEmpty()) {
|
|
||||||
// Use filename if nice name fails
|
|
||||||
pluginName = aTag->FileName();
|
|
||||||
if (pluginName.IsEmpty()) {
|
|
||||||
MOZ_ASSERT_UNREACHABLE("Plugin with no filename or nice name in list");
|
|
||||||
pluginName.AssignLiteral("unknown-plugin-name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pref.AssignLiteral("plugin.");
|
|
||||||
pref.Append(subname);
|
|
||||||
pref.Append('.');
|
|
||||||
pref.Append(pluginName);
|
|
||||||
|
|
||||||
return pref;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsCString GetStatePrefNameForPlugin(nsIInternalPluginTag* aTag) {
|
|
||||||
return MakePrefNameForPlugin("state", aTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult IsEnabledStateLockedForPlugin(nsIInternalPluginTag* aTag,
|
|
||||||
bool* aIsEnabledStateLocked) {
|
|
||||||
*aIsEnabledStateLocked = false;
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
||||||
|
|
||||||
if (NS_WARN_IF(!prefs)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unused << prefs->PrefIsLocked(GetStatePrefNameForPlugin(aTag).get(),
|
|
||||||
aIsEnabledStateLocked);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nsIInternalPluginTag */
|
|
||||||
|
|
||||||
uint32_t nsIInternalPluginTag::sNextId;
|
|
||||||
|
|
||||||
nsIInternalPluginTag::nsIInternalPluginTag() = default;
|
|
||||||
|
|
||||||
nsIInternalPluginTag::nsIInternalPluginTag(const char* aName,
|
|
||||||
const char* aDescription,
|
|
||||||
const char* aFileName,
|
|
||||||
const char* aVersion)
|
|
||||||
: mName(aName),
|
|
||||||
mDescription(aDescription),
|
|
||||||
mFileName(aFileName),
|
|
||||||
mVersion(aVersion) {}
|
|
||||||
|
|
||||||
nsIInternalPluginTag::nsIInternalPluginTag(
|
|
||||||
const char* aName, const char* aDescription, const char* aFileName,
|
|
||||||
const char* aVersion, const nsTArray<nsCString>& aMimeTypes,
|
|
||||||
const nsTArray<nsCString>& aMimeDescriptions,
|
|
||||||
const nsTArray<nsCString>& aExtensions)
|
|
||||||
: mName(aName),
|
|
||||||
mDescription(aDescription),
|
|
||||||
mFileName(aFileName),
|
|
||||||
mVersion(aVersion),
|
|
||||||
mMimeTypes(aMimeTypes.Clone()),
|
|
||||||
mMimeDescriptions(aMimeDescriptions.Clone()),
|
|
||||||
mExtensions(aExtensions.Clone()) {}
|
|
||||||
|
|
||||||
nsIInternalPluginTag::~nsIInternalPluginTag() = default;
|
|
||||||
|
|
||||||
bool nsIInternalPluginTag::HasExtension(const nsACString& aExtension,
|
|
||||||
nsACString& aMatchingType) const {
|
|
||||||
return SearchExtensions(mExtensions, mMimeTypes, aExtension, aMatchingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsIInternalPluginTag::HasMimeType(const nsACString& aMimeType) const {
|
|
||||||
return mMimeTypes.Contains(aMimeType,
|
|
||||||
nsCaseInsensitiveCStringArrayComparator());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nsFakePluginTag */
|
|
||||||
|
|
||||||
nsFakePluginTag::nsFakePluginTag()
|
|
||||||
: mId(sNextId++), mState(ePluginState_Disabled) {}
|
|
||||||
|
|
||||||
nsFakePluginTag::nsFakePluginTag(uint32_t aId,
|
|
||||||
already_AddRefed<nsIURI>&& aHandlerURI,
|
|
||||||
const char* aName, const char* aDescription,
|
|
||||||
const nsTArray<nsCString>& aMimeTypes,
|
|
||||||
const nsTArray<nsCString>& aMimeDescriptions,
|
|
||||||
const nsTArray<nsCString>& aExtensions,
|
|
||||||
const nsCString& aNiceName,
|
|
||||||
const nsString& aSandboxScript)
|
|
||||||
: nsIInternalPluginTag(aName, aDescription, nullptr, nullptr, aMimeTypes,
|
|
||||||
aMimeDescriptions, aExtensions),
|
|
||||||
mId(aId),
|
|
||||||
mHandlerURI(aHandlerURI),
|
|
||||||
mNiceName(aNiceName),
|
|
||||||
mSandboxScript(aSandboxScript),
|
|
||||||
mState(ePluginState_Enabled) {}
|
|
||||||
|
|
||||||
nsFakePluginTag::~nsFakePluginTag() = default;
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsFakePluginTag)
|
|
||||||
NS_IMPL_RELEASE(nsFakePluginTag)
|
|
||||||
NS_INTERFACE_TABLE_HEAD(nsFakePluginTag)
|
|
||||||
NS_INTERFACE_TABLE_BEGIN
|
|
||||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsFakePluginTag, nsIPluginTag,
|
|
||||||
nsIInternalPluginTag)
|
|
||||||
NS_INTERFACE_TABLE_ENTRY(nsFakePluginTag, nsIInternalPluginTag)
|
|
||||||
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsFakePluginTag, nsISupports,
|
|
||||||
nsIInternalPluginTag)
|
|
||||||
NS_INTERFACE_TABLE_ENTRY(nsFakePluginTag, nsIFakePluginTag)
|
|
||||||
NS_INTERFACE_TABLE_END
|
|
||||||
NS_INTERFACE_TABLE_TAIL
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
nsresult nsFakePluginTag::Create(const FakePluginTagInit& aInitDictionary,
|
|
||||||
nsFakePluginTag** aPluginTag) {
|
|
||||||
NS_ENSURE_TRUE(sNextId <= PR_INT32_MAX, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
NS_ENSURE_TRUE(!aInitDictionary.mMimeEntries.IsEmpty(), NS_ERROR_INVALID_ARG);
|
|
||||||
|
|
||||||
RefPtr<nsFakePluginTag> tag = new nsFakePluginTag();
|
|
||||||
nsresult rv =
|
|
||||||
NS_NewURI(getter_AddRefs(tag->mHandlerURI), aInitDictionary.mHandlerURI);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mNiceName, tag->mNiceName);
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mFullPath, tag->mFullPath);
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mName, tag->mName);
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mDescription, tag->mDescription);
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mFileName, tag->mFileName);
|
|
||||||
CopyUTF16toUTF8(aInitDictionary.mVersion, tag->mVersion);
|
|
||||||
tag->mSandboxScript = aInitDictionary.mSandboxScript;
|
|
||||||
|
|
||||||
for (const mozilla::dom::FakePluginMimeEntry& mimeEntry :
|
|
||||||
aInitDictionary.mMimeEntries) {
|
|
||||||
CopyUTF16toUTF8(mimeEntry.mType, *tag->mMimeTypes.AppendElement());
|
|
||||||
CopyUTF16toUTF8(mimeEntry.mDescription,
|
|
||||||
*tag->mMimeDescriptions.AppendElement());
|
|
||||||
CopyUTF16toUTF8(mimeEntry.mExtension, *tag->mExtensions.AppendElement());
|
|
||||||
}
|
|
||||||
|
|
||||||
tag.forget(aPluginTag);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsFakePluginTag::HandlerURIMatches(nsIURI* aURI) {
|
|
||||||
bool equals = false;
|
|
||||||
return NS_SUCCEEDED(mHandlerURI->Equals(aURI, &equals)) && equals;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetHandlerURI(nsIURI** aResult) {
|
|
||||||
NS_IF_ADDREF(*aResult = mHandlerURI);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetSandboxScript(nsAString& aSandboxScript) {
|
|
||||||
aSandboxScript = mSandboxScript;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetDescription(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = mDescription;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetIsFlashPlugin(bool* aIsFlash) {
|
|
||||||
*aIsFlash = false;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetFilename(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = mFileName;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetFullpath(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = mFullPath;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetVersion(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = mVersion;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetName(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = mName;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsCString& nsFakePluginTag::GetNiceFileName() {
|
|
||||||
// We don't try to mimic the special-cased flash/java names if the fake plugin
|
|
||||||
// claims one of their MIME types, but do allow directly setting niceName if
|
|
||||||
// emulating those is desired.
|
|
||||||
if (mNiceName.IsEmpty() && !mFileName.IsEmpty()) {
|
|
||||||
mNiceName = MakeNiceFileName(mFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mNiceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetNiceName(/* utf-8 */ nsACString& aResult) {
|
|
||||||
aResult = GetNiceFileName();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetBlocklistState(uint32_t* aResult) {
|
|
||||||
// Fake tags don't currently support blocklisting
|
|
||||||
*aResult = nsIBlocklistService::STATE_NOT_BLOCKED;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetBlocklisted(bool* aBlocklisted) {
|
|
||||||
// Fake tags can't be blocklisted
|
|
||||||
*aBlocklisted = false;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetIsEnabledStateLocked(bool* aIsEnabledStateLocked) {
|
|
||||||
return IsEnabledStateLockedForPlugin(this, aIsEnabledStateLocked);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nsFakePluginTag::IsEnabled() {
|
|
||||||
return mState == ePluginState_Enabled || mState == ePluginState_Clicktoplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetDisabled(bool* aDisabled) {
|
|
||||||
*aDisabled = !IsEnabled();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetClicktoplay(bool* aClicktoplay) {
|
|
||||||
*aClicktoplay = (mState == ePluginState_Clicktoplay);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetEnabledState(uint32_t* aEnabledState) {
|
|
||||||
*aEnabledState = (uint32_t)mState;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::SetEnabledState(uint32_t aEnabledState) {
|
|
||||||
// There are static asserts above enforcing that this enum matches
|
|
||||||
mState = (PluginState)aEnabledState;
|
|
||||||
// FIXME-jsplugins update
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetMimeTypes(nsTArray<nsCString>& aResults) {
|
|
||||||
aResults = mMimeTypes.Clone();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetMimeDescriptions(nsTArray<nsCString>& aResults) {
|
|
||||||
aResults = mMimeDescriptions.Clone();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetExtensions(nsTArray<nsCString>& aResults) {
|
|
||||||
aResults = mExtensions.Clone();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetActive(bool* aResult) {
|
|
||||||
// Fake plugins can't be blocklisted, so this is just !Disabled
|
|
||||||
*aResult = IsEnabled();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetLastModifiedTime(PRTime* aLastModifiedTime) {
|
|
||||||
// FIXME-jsplugins What should this return, if anything?
|
|
||||||
MOZ_ASSERT(aLastModifiedTime);
|
|
||||||
*aLastModifiedTime = 0;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't load fake plugins out of a library, so they should always be there.
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetLoaded(bool* ret) {
|
|
||||||
*ret = true;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFakePluginTag::GetId(uint32_t* aId) {
|
|
||||||
*aId = mId;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef nsPluginTags_h_
|
|
||||||
#define nsPluginTags_h_
|
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
|
||||||
#include "nscore.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsCOMArray.h"
|
|
||||||
#include "nsIPluginTag.h"
|
|
||||||
#include "nsITimer.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
class nsIURI;
|
|
||||||
|
|
||||||
namespace mozilla::dom {
|
|
||||||
struct FakePluginTagInit;
|
|
||||||
} // namespace mozilla::dom
|
|
||||||
|
|
||||||
// An interface representing plugin tags internally.
|
|
||||||
#define NS_IINTERNALPLUGINTAG_IID \
|
|
||||||
{ \
|
|
||||||
0xe8fdd227, 0x27da, 0x46ee, { \
|
|
||||||
0xbe, 0xf3, 0x1a, 0xef, 0x5a, 0x8f, 0xc5, 0xb4 \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
class nsIInternalPluginTag : public nsIPluginTag {
|
|
||||||
public:
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IINTERNALPLUGINTAG_IID)
|
|
||||||
|
|
||||||
nsIInternalPluginTag();
|
|
||||||
nsIInternalPluginTag(const char* aName, const char* aDescription,
|
|
||||||
const char* aFileName, const char* aVersion);
|
|
||||||
nsIInternalPluginTag(const char* aName, const char* aDescription,
|
|
||||||
const char* aFileName, const char* aVersion,
|
|
||||||
const nsTArray<nsCString>& aMimeTypes,
|
|
||||||
const nsTArray<nsCString>& aMimeDescriptions,
|
|
||||||
const nsTArray<nsCString>& aExtensions);
|
|
||||||
|
|
||||||
virtual bool IsEnabled() = 0;
|
|
||||||
virtual const nsCString& GetNiceFileName() = 0;
|
|
||||||
|
|
||||||
const nsCString& Name() const { return mName; }
|
|
||||||
const nsCString& Description() const { return mDescription; }
|
|
||||||
|
|
||||||
const nsTArray<nsCString>& MimeTypes() const { return mMimeTypes; }
|
|
||||||
|
|
||||||
const nsTArray<nsCString>& MimeDescriptions() const {
|
|
||||||
return mMimeDescriptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsTArray<nsCString>& Extensions() const { return mExtensions; }
|
|
||||||
|
|
||||||
const nsCString& FileName() const { return mFileName; }
|
|
||||||
|
|
||||||
const nsCString& Version() const { return mVersion; }
|
|
||||||
|
|
||||||
// Returns true if this plugin claims it supports this MIME type. The
|
|
||||||
// comparison is done ASCII-case-insensitively.
|
|
||||||
bool HasMimeType(const nsACString& aMimeType) const;
|
|
||||||
|
|
||||||
// Returns true if this plugin claims it supports the given extension. In
|
|
||||||
// that case, aMatchingType is set to the MIME type the plugin claims
|
|
||||||
// corresponds to this extension. The match on aExtension is done
|
|
||||||
// ASCII-case-insensitively.
|
|
||||||
bool HasExtension(const nsACString& aExtension,
|
|
||||||
/* out */ nsACString& aMatchingType) const;
|
|
||||||
|
|
||||||
// These must match the STATE_* values in nsIPluginTag.idl
|
|
||||||
enum PluginState {
|
|
||||||
ePluginState_Disabled = 0,
|
|
||||||
ePluginState_Clicktoplay = 1,
|
|
||||||
ePluginState_Enabled = 2,
|
|
||||||
ePluginState_MaxValue = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
~nsIInternalPluginTag();
|
|
||||||
|
|
||||||
nsCString mName; // UTF-8
|
|
||||||
nsCString mDescription; // UTF-8
|
|
||||||
nsCString mFileName; // UTF-8
|
|
||||||
nsCString mVersion; // UTF-8
|
|
||||||
nsTArray<nsCString> mMimeTypes; // UTF-8
|
|
||||||
nsTArray<nsCString> mMimeDescriptions; // UTF-8
|
|
||||||
nsTArray<nsCString> mExtensions; // UTF-8
|
|
||||||
|
|
||||||
static uint32_t sNextId;
|
|
||||||
};
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInternalPluginTag, NS_IINTERNALPLUGINTAG_IID)
|
|
||||||
|
|
||||||
// A class representing "fake" plugin tags for Javascript-based plugins.
|
|
||||||
// There are currently no other types of supported plugins.
|
|
||||||
class nsFakePluginTag : public nsIInternalPluginTag, public nsIFakePluginTag {
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIPLUGINTAG
|
|
||||||
NS_DECL_NSIFAKEPLUGINTAG
|
|
||||||
|
|
||||||
static nsresult Create(const mozilla::dom::FakePluginTagInit& aInitDictionary,
|
|
||||||
nsFakePluginTag** aPluginTag);
|
|
||||||
nsFakePluginTag(uint32_t aId, already_AddRefed<nsIURI>&& aHandlerURI,
|
|
||||||
const char* aName, const char* aDescription,
|
|
||||||
const nsTArray<nsCString>& aMimeTypes,
|
|
||||||
const nsTArray<nsCString>& aMimeDescriptions,
|
|
||||||
const nsTArray<nsCString>& aExtensions,
|
|
||||||
const nsCString& aNiceName, const nsString& aSandboxScript);
|
|
||||||
|
|
||||||
bool IsEnabled() override;
|
|
||||||
const nsCString& GetNiceFileName() override;
|
|
||||||
|
|
||||||
bool HandlerURIMatches(nsIURI* aURI);
|
|
||||||
|
|
||||||
nsIURI* HandlerURI() const { return mHandlerURI; }
|
|
||||||
|
|
||||||
uint32_t Id() const { return mId; }
|
|
||||||
|
|
||||||
const nsString& SandboxScript() const { return mSandboxScript; }
|
|
||||||
|
|
||||||
static const int32_t NOT_JSPLUGIN = -1;
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsFakePluginTag();
|
|
||||||
virtual ~nsFakePluginTag();
|
|
||||||
|
|
||||||
// A unique id for this JS-implemented plugin. Registering a plugin through
|
|
||||||
// nsPluginHost::RegisterFakePlugin assigns a new id. The id is transferred
|
|
||||||
// through IPC when getting the list of JS-implemented plugins from child
|
|
||||||
// processes, so it should be consistent across processes.
|
|
||||||
// 0 is a valid id.
|
|
||||||
uint32_t mId;
|
|
||||||
|
|
||||||
// The URI of the handler for our fake plugin.
|
|
||||||
// FIXME-jsplugins do we need to sanity check these?
|
|
||||||
nsCOMPtr<nsIURI> mHandlerURI;
|
|
||||||
|
|
||||||
nsCString mFullPath;
|
|
||||||
nsCString mNiceName;
|
|
||||||
|
|
||||||
nsString mSandboxScript;
|
|
||||||
|
|
||||||
PluginState mState;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // nsPluginTags_h_
|
|
||||||
@@ -1979,9 +1979,6 @@ pref("dom.global_stop_script", true);
|
|||||||
// Support the input event queue on the main thread of content process
|
// Support the input event queue on the main thread of content process
|
||||||
pref("input_event_queue.supported", true);
|
pref("input_event_queue.supported", true);
|
||||||
|
|
||||||
// The default value for nsIPluginTag.enabledState (STATE_ENABLED = 2)
|
|
||||||
pref("plugin.default.state", 2);
|
|
||||||
|
|
||||||
// Enable multi by default.
|
// Enable multi by default.
|
||||||
#if !defined(MOZ_ASAN) && !defined(MOZ_TSAN)
|
#if !defined(MOZ_ASAN) && !defined(MOZ_TSAN)
|
||||||
pref("dom.ipc.processCount", 8);
|
pref("dom.ipc.processCount", 8);
|
||||||
|
|||||||
@@ -1321,7 +1321,7 @@ var gBlocklistLevel = DEFAULT_LEVEL;
|
|||||||
* disable - can be used by the nsIBlocklistPrompt to allows users to decide
|
* disable - can be used by the nsIBlocklistPrompt to allows users to decide
|
||||||
* whether a soft-blocked add-on should be disabled,
|
* whether a soft-blocked add-on should be disabled,
|
||||||
* blocked - true if the item is hard-blocked, false otherwise,
|
* blocked - true if the item is hard-blocked, false otherwise,
|
||||||
* item - the nsIPluginTag or Addon object
|
* item - the Addon object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// It is not possible to use the one in Services since it will not successfully
|
// It is not possible to use the one in Services since it will not successfully
|
||||||
|
|||||||
Reference in New Issue
Block a user