diff --git a/application/basilisk/app/profile/basilisk.js b/application/basilisk/app/profile/basilisk.js index f9afa79f8..5db1caa6a 100644 --- a/application/basilisk/app/profile/basilisk.js +++ b/application/basilisk/app/profile/basilisk.js @@ -909,6 +909,8 @@ pref("browser.flash-protected-mode-flip.done", false); pref("dom.ipc.shims.enabledWarnings", false); +pref("dom.ipc.plugins.enabled", true); + // Start the browser in e10s mode pref("browser.tabs.remote.autostart", false); pref("browser.tabs.remote.desktopbehavior", true); diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 697bfacd4..ceab501c4 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -236,10 +236,152 @@ nsNPAPIPlugin::PluginCrashed(const nsAString& pluginDumpID, bool nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag) { -#ifdef MOZ_WIDGET_ANDROID - return false; -#else + if (XRE_GetProcessType() == GeckoProcessType_Content) { + return true; + } + +#if (MOZ_WIDGET_GTK == 3) + // We force OOP on Linux/GTK3 because some plugins use GTK2 and both GTK + // libraries can't be loaded in the same process. return true; +#else + if (PR_GetEnv("MOZ_DISABLE_OOP_PLUGINS")) { + return false; + } + + if (!aPluginTag) { + return false; + } + +#ifdef ACCESSIBILITY + // Certain assistive technologies don't want oop Flash, thus we have a special + // pref for them to disable oop Flash (refer to bug 785047 for details). + bool useA11yPref = false; +#ifdef XP_WIN + useA11yPref = a11y::Compatibility::IsJAWS(); +#endif +#endif + + nsIPrefBranch* prefs = Preferences::GetRootBranch(); + if (!prefs) { + return false; + } + + // Get per-library whitelist/blacklist pref string + // "dom.ipc.plugins.enabled.filename.dll" and fall back to the default value + // of "dom.ipc.plugins.enabled" + // The "filename.dll" part can contain shell wildcard pattern + + nsAutoCString prefFile(aPluginTag->mFullPath.get()); + int32_t slashPos = prefFile.RFindCharInSet("/\\"); + if (kNotFound == slashPos) + return false; + prefFile.Cut(0, slashPos + 1); + ToLowerCase(prefFile); + +#ifdef XP_MACOSX +#if defined(__i386__) + nsAutoCString prefGroupKey("dom.ipc.plugins.enabled.i386."); +#elif defined(__x86_64__) + nsAutoCString prefGroupKey("dom.ipc.plugins.enabled.x86_64."); +#elif defined(__ppc__) + nsAutoCString prefGroupKey("dom.ipc.plugins.enabled.ppc."); +#endif +#else + nsAutoCString prefGroupKey("dom.ipc.plugins.enabled."); +#endif + +#ifdef ACCESSIBILITY + if (useA11yPref) + prefGroupKey.AssignLiteral("dom.ipc.plugins.enabled.a11y."); +#endif + + if (BrowserTabsRemoteAutostart()) { + // dom.ipc.plugins.java.enabled is obsolete in Nightly w/e10s, we've + // flipped the default to ON and now have a force-disable pref. This + // way we don't break non-e10s browsers. + if (aPluginTag->mIsJavaPlugin && + Preferences::GetBool("dom.ipc.plugins.java.force-disable", false)) { + return false; + } + } else { + // Java plugins include a number of different file names, + // so use the mime type (mIsJavaPlugin) and a special pref. + if (aPluginTag->mIsJavaPlugin && + !Preferences::GetBool("dom.ipc.plugins.java.enabled", true)) { + return false; + } + } + + uint32_t prefCount; + char** prefNames; + nsresult rv = prefs->GetChildList(prefGroupKey.get(), + &prefCount, &prefNames); + + bool oopPluginsEnabled = false; + bool prefSet = false; + + if (NS_SUCCEEDED(rv) && prefCount > 0) { + uint32_t prefixLength = prefGroupKey.Length(); + for (uint32_t currentPref = 0; currentPref < prefCount; currentPref++) { + // Get the mask + const char* maskStart = prefNames[currentPref] + prefixLength; + bool match = false; + + int valid = NS_WildCardValid(maskStart); + if (valid == INVALID_SXP) { + continue; + } + else if(valid == NON_SXP) { + // mask is not a shell pattern, compare it as normal string + match = (strcmp(prefFile.get(), maskStart) == 0); + } + else { + match = (NS_WildCardMatch(prefFile.get(), maskStart, 0) == MATCH); + } + + if (match && NS_SUCCEEDED(Preferences::GetBool(prefNames[currentPref], + &oopPluginsEnabled))) { + prefSet = true; + break; + } + } + NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(prefCount, prefNames); + } + + if (!prefSet) { + oopPluginsEnabled = +#ifdef XP_MACOSX +#if defined(__i386__) + Preferences::GetBool("dom.ipc.plugins.enabled.i386", false); +#elif defined(__x86_64__) + Preferences::GetBool("dom.ipc.plugins.enabled.x86_64", false); +#elif defined(__ppc__) + Preferences::GetBool("dom.ipc.plugins.enabled.ppc", false); +#endif +#else +#ifdef ACCESSIBILITY + useA11yPref ? Preferences::GetBool("dom.ipc.plugins.enabled.a11y", false) : +#endif + Preferences::GetBool("dom.ipc.plugins.enabled", false); +#endif + +#ifdef XP_WIN + // On Windows Vista+, we force Flash to run in OOPP mode when no specific + // override exists, because Adobe doesn't test Flash in-process and there + // are known stability bugs. (See also bug 769721) + if (aPluginTag->mIsFlashPlugin && IsVistaOrLater()) { +#ifdef ACCESSIBILITY + if (!useA11yPref) + return true; +#else + return true; +#endif + } +#endif + } + + return oopPluginsEnabled; #endif }