mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 971279 - Add plugin.java.mime. r=bsmedberg
This commit is contained in:
parent
b2a962217f
commit
78dc97b207
@ -33,15 +33,10 @@ var gPluginHandler = {
|
|||||||
let fallbackType = null;
|
let fallbackType = null;
|
||||||
let blocklistState = null;
|
let blocklistState = null;
|
||||||
|
|
||||||
if (pluginElement instanceof HTMLAppletElement) {
|
|
||||||
tagMimetype = "application/x-java-vm";
|
|
||||||
} else {
|
|
||||||
tagMimetype = pluginElement.actualType;
|
tagMimetype = pluginElement.actualType;
|
||||||
|
|
||||||
if (tagMimetype == "") {
|
if (tagMimetype == "") {
|
||||||
tagMimetype = pluginElement.type;
|
tagMimetype = pluginElement.type;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (gPluginHandler.isKnownPlugin(pluginElement)) {
|
if (gPluginHandler.isKnownPlugin(pluginElement)) {
|
||||||
pluginTag = pluginHost.getPluginTagForType(pluginElement.actualType);
|
pluginTag = pluginHost.getPluginTagForType(pluginElement.actualType);
|
||||||
|
@ -92,6 +92,8 @@
|
|||||||
|
|
||||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||||
|
|
||||||
|
static const char *kPrefJavaMIME = "plugin.java.mime";
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
@ -1410,8 +1412,12 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
|||||||
///
|
///
|
||||||
/// Initial MIME Type
|
/// Initial MIME Type
|
||||||
///
|
///
|
||||||
|
|
||||||
if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
|
if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
|
||||||
newMime.AssignLiteral("application/x-java-vm");
|
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||||
|
newMime = javaMIME;
|
||||||
|
NS_ASSERTION(nsPluginHost::IsJavaMIMEType(newMime.get()),
|
||||||
|
"plugin.mime.java should be recognized by IsJavaMIMEType");
|
||||||
isJava = true;
|
isJava = true;
|
||||||
} else {
|
} else {
|
||||||
nsAutoString rawTypeAttr;
|
nsAutoString rawTypeAttr;
|
||||||
@ -1432,9 +1438,12 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
|||||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
||||||
if (!classIDAttr.IsEmpty()) {
|
if (!classIDAttr.IsEmpty()) {
|
||||||
// Our classid support is limited to 'java:' ids
|
// Our classid support is limited to 'java:' ids
|
||||||
|
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||||
|
NS_ASSERTION(nsPluginHost::IsJavaMIMEType(javaMIME.get()),
|
||||||
|
"plugin.mime.java should be recognized by IsJavaMIMEType");
|
||||||
if (StringBeginsWith(classIDAttr, NS_LITERAL_STRING("java:")) &&
|
if (StringBeginsWith(classIDAttr, NS_LITERAL_STRING("java:")) &&
|
||||||
PluginExistsForType("application/x-java-vm")) {
|
PluginExistsForType(javaMIME)) {
|
||||||
newMime.Assign("application/x-java-vm");
|
newMime = javaMIME;
|
||||||
isJava = true;
|
isJava = true;
|
||||||
} else {
|
} else {
|
||||||
// XXX(johns): Our de-facto behavior since forever was to refuse to load
|
// XXX(johns): Our de-facto behavior since forever was to refuse to load
|
||||||
|
@ -576,8 +576,11 @@ bool
|
|||||||
Navigator::JavaEnabled(ErrorResult& aRv)
|
Navigator::JavaEnabled(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
|
Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
|
||||||
// Return true if we have a handler for "application/x-java-vm",
|
|
||||||
// otherwise return false.
|
// Return true if we have a handler for the java mime
|
||||||
|
nsAdoptingString javaMIME = Preferences::GetString("plugin.java.mime");
|
||||||
|
NS_ENSURE_TRUE(!javaMIME.IsEmpty(), false);
|
||||||
|
|
||||||
if (!mMimeTypes) {
|
if (!mMimeTypes) {
|
||||||
if (!mWindow) {
|
if (!mWindow) {
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||||
@ -588,8 +591,7 @@ Navigator::JavaEnabled(ErrorResult& aRv)
|
|||||||
|
|
||||||
RefreshMIMEArray();
|
RefreshMIMEArray();
|
||||||
|
|
||||||
nsMimeType *mimeType =
|
nsMimeType *mimeType = mMimeTypes->NamedItem(javaMIME);
|
||||||
mMimeTypes->NamedItem(NS_LITERAL_STRING("application/x-java-vm"));
|
|
||||||
|
|
||||||
return mimeType && mimeType->GetEnabledPlugin();
|
return mimeType && mimeType->GetEnabledPlugin();
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,7 @@ using mozilla::TimeStamp;
|
|||||||
|
|
||||||
static const char *kPrefWhitelist = "plugin.allowed_types";
|
static const char *kPrefWhitelist = "plugin.allowed_types";
|
||||||
static const char *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
|
static const char *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
|
||||||
|
static const char *kPrefJavaMIME = "plugin.java.mime";
|
||||||
|
|
||||||
// Version of cached plugin info
|
// Version of cached plugin info
|
||||||
// 0.01 first implementation
|
// 0.01 first implementation
|
||||||
@ -1555,8 +1556,12 @@ nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain,
|
|||||||
|
|
||||||
bool nsPluginHost::IsJavaMIMEType(const char* aType)
|
bool nsPluginHost::IsJavaMIMEType(const char* aType)
|
||||||
{
|
{
|
||||||
|
// The java mime pref may well not be one of these,
|
||||||
|
// e.g. application/x-java-test used in the test suite
|
||||||
|
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||||
return aType &&
|
return aType &&
|
||||||
((0 == PL_strncasecmp(aType, "application/x-java-vm",
|
(javaMIME.EqualsIgnoreCase(aType) ||
|
||||||
|
(0 == PL_strncasecmp(aType, "application/x-java-vm",
|
||||||
sizeof("application/x-java-vm") - 1)) ||
|
sizeof("application/x-java-vm") - 1)) ||
|
||||||
(0 == PL_strncasecmp(aType, "application/x-java-applet",
|
(0 == PL_strncasecmp(aType, "application/x-java-applet",
|
||||||
sizeof("application/x-java-applet") - 1)) ||
|
sizeof("application/x-java-applet") - 1)) ||
|
||||||
|
@ -136,17 +136,11 @@ var PluginHelper = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getPluginMimeType: function (plugin) {
|
getPluginMimeType: function (plugin) {
|
||||||
var tagMimetype;
|
var tagMimetype = plugin.actualType;
|
||||||
if (plugin instanceof HTMLAppletElement) {
|
|
||||||
tagMimetype = "application/x-java-vm";
|
|
||||||
} else {
|
|
||||||
tagMimetype = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent)
|
|
||||||
.actualType;
|
|
||||||
|
|
||||||
if (tagMimetype == "") {
|
if (tagMimetype == "") {
|
||||||
tagMimetype = plugin.type;
|
tagMimetype = plugin.type;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return tagMimetype;
|
return tagMimetype;
|
||||||
},
|
},
|
||||||
|
@ -1910,6 +1910,11 @@ pref("plugins.enumerable_names", "Java,Nexus Personal,QuickTime,Shockwave");
|
|||||||
// The default value for nsIPluginTag.enabledState (STATE_ENABLED = 2)
|
// The default value for nsIPluginTag.enabledState (STATE_ENABLED = 2)
|
||||||
pref("plugin.default.state", 2);
|
pref("plugin.default.state", 2);
|
||||||
|
|
||||||
|
// The MIME type that should bind to legacy java-specific invocations like
|
||||||
|
// <applet> and <object data="java:foo">. Setting this to a non-java MIME type
|
||||||
|
// is undefined behavior.
|
||||||
|
pref("plugin.java.mime", "application/x-java-vm");
|
||||||
|
|
||||||
// How long in minutes we will allow a plugin to work after the user has chosen
|
// How long in minutes we will allow a plugin to work after the user has chosen
|
||||||
// to allow it "now"
|
// to allow it "now"
|
||||||
pref("plugin.sessionPermissionNow.intervalInMinutes", 60);
|
pref("plugin.sessionPermissionNow.intervalInMinutes", 60);
|
||||||
|
Loading…
Reference in New Issue
Block a user