зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1194488: Whitelist specific plugins for async init; r=jimm
--HG-- extra : rebase_source : d1823d3f1eaf2632fc61e0a444cce2d144d8951f
This commit is contained in:
Родитель
6fa32b756b
Коммит
1a99652bde
|
@ -267,7 +267,7 @@ GetNewPluginLibrary(nsPluginTag *aPluginTag)
|
|||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
return PluginModuleContentParent::LoadModule(aPluginTag->mId);
|
||||
return PluginModuleContentParent::LoadModule(aPluginTag->mId, aPluginTag);
|
||||
}
|
||||
|
||||
if (nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
|
||||
|
|
|
@ -267,6 +267,7 @@ nsPluginTag::nsPluginTag(const char* aName,
|
|||
mLibrary(nullptr),
|
||||
mIsJavaPlugin(false),
|
||||
mIsFlashPlugin(false),
|
||||
mSupportsAsyncInit(false),
|
||||
mFullPath(aFullPath),
|
||||
mLastModifiedTime(aLastModifiedTime),
|
||||
mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED),
|
||||
|
@ -343,12 +344,22 @@ void nsPluginTag::InitMime(const char* const* aMimeTypes,
|
|||
switch (nsPluginHost::GetSpecialType(mimeType)) {
|
||||
case nsPluginHost::eSpecialType_Java:
|
||||
mIsJavaPlugin = true;
|
||||
mSupportsAsyncInit = true;
|
||||
break;
|
||||
case nsPluginHost::eSpecialType_Flash:
|
||||
mIsFlashPlugin = true;
|
||||
mSupportsAsyncInit = true;
|
||||
break;
|
||||
case nsPluginHost::eSpecialType_Silverlight:
|
||||
case nsPluginHost::eSpecialType_Unity:
|
||||
mSupportsAsyncInit = true;
|
||||
break;
|
||||
case nsPluginHost::eSpecialType_None:
|
||||
default:
|
||||
#ifndef RELEASE_BUILD
|
||||
// Allow async init for all plugins on Nightly and Aurora
|
||||
mSupportsAsyncInit = true;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ public:
|
|||
nsRefPtr<nsNPAPIPlugin> mPlugin;
|
||||
bool mIsJavaPlugin;
|
||||
bool mIsFlashPlugin;
|
||||
bool mSupportsAsyncInit;
|
||||
nsCString mFullPath; // UTF-8
|
||||
int64_t mLastModifiedTime;
|
||||
nsCOMPtr<nsITimer> mUnloadTimer;
|
||||
|
|
|
@ -207,8 +207,9 @@ namespace {
|
|||
class PluginModuleMapping : public PRCList
|
||||
{
|
||||
public:
|
||||
explicit PluginModuleMapping(uint32_t aPluginId)
|
||||
explicit PluginModuleMapping(uint32_t aPluginId, bool aAllowAsyncInit)
|
||||
: mPluginId(aPluginId)
|
||||
, mAllowAsyncInit(aAllowAsyncInit)
|
||||
, mProcessIdValid(false)
|
||||
, mModule(nullptr)
|
||||
, mChannelOpened(false)
|
||||
|
@ -240,7 +241,7 @@ public:
|
|||
GetModule()
|
||||
{
|
||||
if (!mModule) {
|
||||
mModule = new PluginModuleContentParent();
|
||||
mModule = new PluginModuleContentParent(mAllowAsyncInit);
|
||||
}
|
||||
return mModule;
|
||||
}
|
||||
|
@ -333,6 +334,7 @@ private:
|
|||
}
|
||||
|
||||
uint32_t mPluginId;
|
||||
bool mAllowAsyncInit;
|
||||
bool mProcessIdValid;
|
||||
base::ProcessId mProcessId;
|
||||
PluginModuleContentParent* mModule;
|
||||
|
@ -372,10 +374,12 @@ mozilla::plugins::TerminatePlugin(uint32_t aPluginId,
|
|||
}
|
||||
|
||||
/* static */ PluginLibrary*
|
||||
PluginModuleContentParent::LoadModule(uint32_t aPluginId)
|
||||
PluginModuleContentParent::LoadModule(uint32_t aPluginId,
|
||||
nsPluginTag* aPluginTag)
|
||||
{
|
||||
PluginModuleMapping::NotifyLoadingModule loadingModule;
|
||||
nsAutoPtr<PluginModuleMapping> mapping(new PluginModuleMapping(aPluginId));
|
||||
nsAutoPtr<PluginModuleMapping> mapping(
|
||||
new PluginModuleMapping(aPluginId, aPluginTag->mSupportsAsyncInit));
|
||||
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
|
||||
|
@ -503,8 +507,9 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
nsAutoPtr<PluginModuleChromeParent> parent(new PluginModuleChromeParent(aFilePath, aPluginId,
|
||||
sandboxLevel));
|
||||
nsAutoPtr<PluginModuleChromeParent> parent(
|
||||
new PluginModuleChromeParent(aFilePath, aPluginId, sandboxLevel,
|
||||
aPluginTag->mSupportsAsyncInit));
|
||||
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
|
||||
parent->mSubprocess->SetCallRunnableImmediately(!parent->mIsStartingAsync);
|
||||
TimeStamp launchStart = TimeStamp::Now();
|
||||
|
@ -635,7 +640,7 @@ PluginModuleChromeParent::WaitForIPCConnection()
|
|||
return true;
|
||||
}
|
||||
|
||||
PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
||||
PluginModuleParent::PluginModuleParent(bool aIsChrome, bool aAllowAsyncInit)
|
||||
: mQuirks(QUIRKS_NOT_INITIALIZED)
|
||||
, mIsChrome(aIsChrome)
|
||||
, mShutdown(false)
|
||||
|
@ -653,7 +658,8 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
|
|||
, mAsyncNewRv(NS_ERROR_NOT_INITIALIZED)
|
||||
{
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
|
||||
mIsStartingAsync = Preferences::GetBool(kAsyncInitPref, false);
|
||||
mIsStartingAsync = aAllowAsyncInit &&
|
||||
Preferences::GetBool(kAsyncInitPref, false);
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"),
|
||||
mIsStartingAsync ?
|
||||
|
@ -676,8 +682,8 @@ PluginModuleParent::~PluginModuleParent()
|
|||
}
|
||||
}
|
||||
|
||||
PluginModuleContentParent::PluginModuleContentParent()
|
||||
: PluginModuleParent(false)
|
||||
PluginModuleContentParent::PluginModuleContentParent(bool aAllowAsyncInit)
|
||||
: PluginModuleParent(false, aAllowAsyncInit)
|
||||
{
|
||||
Preferences::RegisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
||||
}
|
||||
|
@ -691,8 +697,9 @@ bool PluginModuleChromeParent::sInstantiated = false;
|
|||
|
||||
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
|
||||
uint32_t aPluginId,
|
||||
int32_t aSandboxLevel)
|
||||
: PluginModuleParent(true)
|
||||
int32_t aSandboxLevel,
|
||||
bool aAllowAsyncInit)
|
||||
: PluginModuleParent(true, aAllowAsyncInit)
|
||||
, mSubprocess(new PluginProcessParent(aFilePath))
|
||||
, mPluginId(aPluginId)
|
||||
, mChromeTaskFactory(this)
|
||||
|
|
|
@ -97,7 +97,7 @@ protected:
|
|||
DeallocPPluginInstanceParent(PPluginInstanceParent* aActor) override;
|
||||
|
||||
public:
|
||||
explicit PluginModuleParent(bool aIsChrome);
|
||||
explicit PluginModuleParent(bool aIsChrome, bool aAllowAsyncInit);
|
||||
virtual ~PluginModuleParent();
|
||||
|
||||
bool RemovePendingSurrogate(const nsRefPtr<PluginAsyncSurrogate>& aSurrogate);
|
||||
|
@ -344,9 +344,9 @@ protected:
|
|||
class PluginModuleContentParent : public PluginModuleParent
|
||||
{
|
||||
public:
|
||||
explicit PluginModuleContentParent();
|
||||
explicit PluginModuleContentParent(bool aAllowAsyncInit);
|
||||
|
||||
static PluginLibrary* LoadModule(uint32_t aPluginId);
|
||||
static PluginLibrary* LoadModule(uint32_t aPluginId, nsPluginTag* aPluginTag);
|
||||
|
||||
static PluginModuleContentParent* Initialize(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess);
|
||||
|
@ -497,7 +497,8 @@ private:
|
|||
|
||||
// aFilePath is UTF8, not native!
|
||||
explicit PluginModuleChromeParent(const char* aFilePath, uint32_t aPluginId,
|
||||
int32_t aSandboxLevel);
|
||||
int32_t aSandboxLevel,
|
||||
bool aAllowAsyncInit);
|
||||
|
||||
CrashReporterParent* CrashReporter();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче