backout f9b9d90ff8e1 due to bustage

This commit is contained in:
Margaret Leibovic 2011-12-09 14:56:20 -08:00
parent 34375f92be
commit 3b340fd477
7 changed files with 34 additions and 53 deletions

View File

@ -589,7 +589,6 @@ pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
pref("plugins.update.url", "https://www.mozilla.com/%LOCALE%/plugincheck/");
pref("plugins.update.notifyUser", false);
pref("plugins.click_to_play", false);
#ifdef XP_WIN
pref("browser.preferences.instantApply", false);

View File

@ -51,7 +51,7 @@ interface nsIDOMClientRect;
/**
* This interface represents a content node that loads objects.
*/
[scriptable, uuid(e5330f90-91a3-41d7-b29e-af38a23a6602)]
[scriptable, uuid(107e8048-d00f-4711-bd21-97184ccae0b1)]
interface nsIObjectLoadingContent : nsISupports
{
const unsigned long TYPE_LOADING = 0;
@ -125,10 +125,4 @@ interface nsIObjectLoadingContent : nsISupports
in AString pluginDumpID,
in AString browserDumpID,
in boolean submittedCrashReport);
/**
* This method will play a plugin that has been stopped by the
* click-to-play plugins feature.
*/
void playPlugin();
};

View File

@ -105,7 +105,10 @@ static PRLogModuleInfo* gObjectLog = PR_NewLogModule("objlc");
#define LOG(args) PR_LOG(gObjectLog, PR_LOG_DEBUG, args)
#define LOG_ENABLED() PR_LOG_TEST(gObjectLog, PR_LOG_DEBUG)
#ifdef ANDROID
#include "nsXULAppAPI.h"
#include "mozilla/Preferences.h"
#endif
class nsAsyncInstantiateEvent : public nsRunnable {
public:
@ -425,14 +428,14 @@ IsSupportedImage(const nsCString& aMimeType)
}
static bool
IsSupportedPlugin(const nsCString& aMIMEType, bool aHasBeenClickedToPlay)
IsSupportedPlugin(const nsCString& aMIMEType)
{
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) {
return false;
}
nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get(), aHasBeenClickedToPlay);
nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get());
return NS_SUCCEEDED(rv);
}
@ -458,7 +461,7 @@ GetExtensionFromURI(nsIURI* uri, nsCString& ext)
* in the given URI. The MIME type is returned in the mimeType out parameter.
*/
static bool
IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType, bool aHasBeenClickedToPlay)
IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
{
nsCAutoString ext;
GetExtensionFromURI(uri, ext);
@ -474,8 +477,7 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType, bool aHasBeenClicke
}
const char* typeFromExt;
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt,
aHasBeenClickedToPlay))) {
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) {
mimeType = typeFromExt;
return true;
}
@ -490,9 +492,6 @@ nsObjectLoadingContent::nsObjectLoadingContent()
, mUserDisabled(false)
, mSuppressed(false)
, mNetworkCreated(true)
// If plugins.click_to_play is false, plugins will just act like they've already
// been clicked to play
, mHasBeenClickedToPlay(!mozilla::Preferences::GetBool("plugins.click_to_play", false))
, mFallbackReason(ePluginOtherState)
{
}
@ -554,7 +553,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
// Need to check IsSupportedPlugin() in addition to GetTypeOfContent()
// because otherwise the default plug-in's catch-all behavior would
// confuse things.
(IsSupportedPlugin(mContentType, mHasBeenClickedToPlay) &&
(IsSupportedPlugin(mContentType) &&
GetTypeOfContent(mContentType) == eType_Plugin)) {
// Set the type we'll use for dispatch on the channel. Otherwise we could
// end up trying to dispatch to a nsFrameLoader, which will complain that
@ -574,7 +573,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
if (mContentType.EqualsASCII(APPLICATION_OCTET_STREAM)) {
nsCAutoString extType;
if (IsPluginEnabledByExtension(uri, extType, mHasBeenClickedToPlay)) {
if (IsPluginEnabledByExtension(uri, extType)) {
mContentType = extType;
chan->SetContentType(extType);
}
@ -1274,8 +1273,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
nsCAutoString overrideType;
if ((caps & eOverrideServerType) &&
((!aTypeHint.IsEmpty() && IsSupportedPlugin(aTypeHint, mHasBeenClickedToPlay)) ||
(aURI && IsPluginEnabledByExtension(aURI, overrideType, mHasBeenClickedToPlay)))) {
((!aTypeHint.IsEmpty() && IsSupportedPlugin(aTypeHint)) ||
(aURI && IsPluginEnabledByExtension(aURI, overrideType)))) {
ObjectType newType;
if (overrideType.IsEmpty()) {
newType = GetTypeOfContent(aTypeHint);
@ -1413,7 +1412,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
return NS_OK;
}
if (IsSupportedPlugin(aTypeHint, mHasBeenClickedToPlay)) {
if (IsSupportedPlugin(aTypeHint)) {
mType = eType_Plugin;
rv = TryInstantiate(aTypeHint, aURI);
@ -1715,7 +1714,7 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
return eType_Document;
}
if ((caps & eSupportPlugins) && IsSupportedPlugin(aMIMEType, mHasBeenClickedToPlay)) {
if ((caps & eSupportPlugins) && IsSupportedPlugin(aMIMEType)) {
return eType_Plugin;
}
@ -1876,7 +1875,7 @@ nsObjectLoadingContent::Instantiate(nsIObjectFrame* aFrame,
nsCString typeToUse(aMIMEType);
if (typeToUse.IsEmpty() && aURI) {
IsPluginEnabledByExtension(aURI, typeToUse, mHasBeenClickedToPlay);
IsPluginEnabledByExtension(aURI, typeToUse);
}
nsCOMPtr<nsIContent> thisContent =
@ -1963,6 +1962,12 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
/* static */ PluginSupportState
nsObjectLoadingContent::GetPluginDisabledState(const nsCString& aContentType)
{
#ifdef ANDROID
// if plugins are disabled, don't show the click to play message
if (!mozilla::Preferences::GetBool("plugin.disable", false) &&
XRE_GetProcessType() == GeckoProcessType_Content)
return ePluginClickToPlay;
#endif
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) {
@ -1972,8 +1977,6 @@ nsObjectLoadingContent::GetPluginDisabledState(const nsCString& aContentType)
nsresult rv = pluginHost->IsPluginEnabledForType(aContentType.get());
if (rv == NS_ERROR_PLUGIN_DISABLED)
return ePluginDisabled;
if (rv == NS_ERROR_PLUGIN_CLICKTOPLAY)
return ePluginClickToPlay;
if (rv == NS_ERROR_PLUGIN_BLOCKLISTED)
return ePluginBlocklisted;
return ePluginUnsupported;
@ -2043,13 +2046,3 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
}
return NS_OK;
}
NS_IMETHODIMP
nsObjectLoadingContent::PlayPlugin()
{
if (!nsContentUtils::IsCallerChrome())
return NS_OK;
mHasBeenClickedToPlay = true;
return LoadObject(mURI, true, mContentType, true);
}

View File

@ -66,7 +66,7 @@ enum PluginSupportState {
ePluginOutdated, // The plugin is considered outdated, but not disabled
ePluginOtherState, // Something else (e.g. uninitialized or not a plugin)
ePluginCrashed,
ePluginClickToPlay // The plugin is disabled until the user clicks on it
ePluginClickToPlay
};
/**
@ -410,9 +410,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent
// it may lose the flag.
bool mNetworkCreated : 1;
// Used to keep track of whether or not a plugin has been clicked to play.
bool mHasBeenClickedToPlay : 1;
// A specific state that caused us to fallback
PluginSupportState mFallbackReason;

View File

@ -46,6 +46,5 @@
#define NS_ERROR_PLUGIN_DISABLED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PLUGINS,1001)
#define NS_ERROR_PLUGIN_BLOCKLISTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PLUGINS,1002)
#define NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PLUGINS,1003)
#define NS_ERROR_PLUGIN_CLICKTOPLAY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PLUGINS,1004)
#endif // nsPluginError_h__

View File

@ -1330,11 +1330,11 @@ nsPluginHost::TrySetUpPluginInstance(const char *aMimeType,
}
nsresult
nsPluginHost::IsPluginEnabledForType(const char* aMimeType, bool aHasBeenClickedToPlay)
nsPluginHost::IsPluginEnabledForType(const char* aMimeType)
{
nsPluginTag *plugin = FindPluginForType(aMimeType, true);
if (plugin)
return aHasBeenClickedToPlay ? NS_OK : NS_ERROR_PLUGIN_CLICKTOPLAY;
return NS_OK;
// Pass false as the second arg so we can return NS_ERROR_PLUGIN_DISABLED
// for disabled plug-ins.
@ -1349,7 +1349,7 @@ nsPluginHost::IsPluginEnabledForType(const char* aMimeType, bool aHasBeenClicked
return NS_ERROR_PLUGIN_DISABLED;
}
return aHasBeenClickedToPlay ? NS_OK : NS_ERROR_PLUGIN_CLICKTOPLAY;
return NS_OK;
}
// check comma delimitered extensions
@ -1379,14 +1379,10 @@ static int CompareExtensions(const char *aExtensionList, const char *aExtension)
nsresult
nsPluginHost::IsPluginEnabledForExtension(const char* aExtension,
const char* &aMimeType,
bool aHasBeenClickedToPlay)
const char* &aMimeType)
{
nsPluginTag *plugin = FindPluginEnabledForExtension(aExtension, aMimeType);
if (plugin)
return aHasBeenClickedToPlay ? NS_OK : NS_ERROR_PLUGIN_CLICKTOPLAY;
return NS_ERROR_FAILURE;
return plugin ? NS_OK : NS_ERROR_FAILURE;
}
class DOMMimeTypeImpl : public nsIDOMMimeType {
@ -2258,6 +2254,11 @@ nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
nsresult nsPluginHost::LoadPlugins()
{
#ifdef ANDROID
if (XRE_GetProcessType() == GeckoProcessType_Content) {
return NS_OK;
}
#endif
// do not do anything if it is already done
// use ReloadPlugins() to enforce loading
if (mPluginsLoaded)

View File

@ -117,10 +117,8 @@ public:
nsresult SetUpPluginInstance(const char *aMimeType,
nsIURI *aURL,
nsIPluginInstanceOwner *aOwner);
nsresult IsPluginEnabledForType(const char* aMimeType,
bool aHasBeenClickedToPlay = false);
nsresult IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType,
bool aHasBeenClickedToPlay = false);
nsresult IsPluginEnabledForType(const char* aMimeType);
nsresult IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
nsresult GetPluginCount(PRUint32* aPluginCount);
nsresult GetPlugins(PRUint32 aPluginCount, nsIDOMPlugin** aPluginArray);