mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 633427: Fix bug in which we mis-label plugins as Flash plugins. This was causing us to load plugins unnecessarily when clearing private data. r=smichaud
This commit is contained in:
parent
eab4915242
commit
ad1fd62b8e
@ -105,72 +105,10 @@ mVersion(aPluginInfo->fVersion),
|
|||||||
mLastModifiedTime(0),
|
mLastModifiedTime(0),
|
||||||
mFlags(NS_PLUGIN_FLAG_ENABLED)
|
mFlags(NS_PLUGIN_FLAG_ENABLED)
|
||||||
{
|
{
|
||||||
if (!aPluginInfo->fMimeTypeArray) {
|
InitMime(aPluginInfo->fMimeTypeArray,
|
||||||
return;
|
aPluginInfo->fMimeDescriptionArray,
|
||||||
}
|
aPluginInfo->fExtensionArray,
|
||||||
|
aPluginInfo->fVariantCount);
|
||||||
for (PRUint32 i = 0; i < aPluginInfo->fVariantCount; i++) {
|
|
||||||
// First fill in the MIME types.
|
|
||||||
char* currentMIMEType = aPluginInfo->fMimeTypeArray[i];
|
|
||||||
if (currentMIMEType) {
|
|
||||||
if (mIsJavaPlugin) {
|
|
||||||
if (strcmp(currentMIMEType, "application/x-java-vm-npruntime") == 0) {
|
|
||||||
// This "magic MIME type" should not be exposed, but is just a signal
|
|
||||||
// to the browser that this is new-style java.
|
|
||||||
// Don't add it or its associated information to our arrays.
|
|
||||||
mIsNPRuntimeEnabledJavaPlugin = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mMimeTypes.AppendElement(nsCString(currentMIMEType));
|
|
||||||
if (nsPluginHost::IsJavaMIMEType(currentMIMEType)) {
|
|
||||||
mIsJavaPlugin = true;
|
|
||||||
}
|
|
||||||
else if (strcmp(currentMIMEType, "application/x-shockwave-flash") == 0) {
|
|
||||||
mIsFlashPlugin = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now fill in the MIME descriptions.
|
|
||||||
if (aPluginInfo->fMimeDescriptionArray &&
|
|
||||||
aPluginInfo->fMimeDescriptionArray[i]) {
|
|
||||||
// we should cut off the list of suffixes which the mime
|
|
||||||
// description string may have, see bug 53895
|
|
||||||
// it is usually in form "some description (*.sf1, *.sf2)"
|
|
||||||
// so we can search for the opening round bracket
|
|
||||||
char cur = '\0';
|
|
||||||
char pre = '\0';
|
|
||||||
char * p = PL_strrchr(aPluginInfo->fMimeDescriptionArray[i], '(');
|
|
||||||
if (p && (p != aPluginInfo->fMimeDescriptionArray[i])) {
|
|
||||||
if ((p - 1) && *(p - 1) == ' ') {
|
|
||||||
pre = *(p - 1);
|
|
||||||
*(p - 1) = '\0';
|
|
||||||
} else {
|
|
||||||
cur = *p;
|
|
||||||
*p = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mMimeDescriptions.AppendElement(nsCString(aPluginInfo->fMimeDescriptionArray[i]));
|
|
||||||
// restore the original string
|
|
||||||
if (cur != '\0')
|
|
||||||
*p = cur;
|
|
||||||
if (pre != '\0')
|
|
||||||
*(p - 1) = pre;
|
|
||||||
} else {
|
|
||||||
mMimeDescriptions.AppendElement(nsCString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now fill in the extensions.
|
|
||||||
if (aPluginInfo->fExtensionArray &&
|
|
||||||
aPluginInfo->fExtensionArray[i]) {
|
|
||||||
mExtensions.AppendElement(nsCString(aPluginInfo->fExtensionArray[i]));
|
|
||||||
} else {
|
|
||||||
mExtensions.AppendElement(nsCString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EnsureMembersAreUTF8();
|
EnsureMembersAreUTF8();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,26 +129,14 @@ mDescription(aDescription),
|
|||||||
mLibrary(nsnull),
|
mLibrary(nsnull),
|
||||||
mIsJavaPlugin(false),
|
mIsJavaPlugin(false),
|
||||||
mIsNPRuntimeEnabledJavaPlugin(false),
|
mIsNPRuntimeEnabledJavaPlugin(false),
|
||||||
|
mIsFlashPlugin(false),
|
||||||
mFileName(aFileName),
|
mFileName(aFileName),
|
||||||
mFullPath(aFullPath),
|
mFullPath(aFullPath),
|
||||||
mVersion(aVersion),
|
mVersion(aVersion),
|
||||||
mLastModifiedTime(aLastModifiedTime),
|
mLastModifiedTime(aLastModifiedTime),
|
||||||
mFlags(0) // Caller will read in our flags from cache
|
mFlags(0) // Caller will read in our flags from cache
|
||||||
{
|
{
|
||||||
for (PRInt32 i = 0; i < aVariants; i++) {
|
InitMime(aMimeTypes, aMimeDescriptions, aExtensions, static_cast<PRUint32>(aVariants));
|
||||||
if (mIsJavaPlugin && aMimeTypes[i] &&
|
|
||||||
strcmp(aMimeTypes[i], "application/x-java-vm-npruntime") == 0) {
|
|
||||||
mIsNPRuntimeEnabledJavaPlugin = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
mMimeTypes.AppendElement(nsCString(aMimeTypes[i]));
|
|
||||||
mMimeDescriptions.AppendElement(nsCString(aMimeDescriptions[i]));
|
|
||||||
mExtensions.AppendElement(nsCString(aExtensions[i]));
|
|
||||||
if (nsPluginHost::IsJavaMIMEType(mMimeTypes[i].get())) {
|
|
||||||
mIsJavaPlugin = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aArgsAreUTF8)
|
if (!aArgsAreUTF8)
|
||||||
EnsureMembersAreUTF8();
|
EnsureMembersAreUTF8();
|
||||||
}
|
}
|
||||||
@ -222,6 +148,81 @@ nsPluginTag::~nsPluginTag()
|
|||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsPluginTag, nsIPluginTag)
|
NS_IMPL_ISUPPORTS1(nsPluginTag, nsIPluginTag)
|
||||||
|
|
||||||
|
void nsPluginTag::InitMime(const char* const* aMimeTypes,
|
||||||
|
const char* const* aMimeDescriptions,
|
||||||
|
const char* const* aExtensions,
|
||||||
|
PRUint32 aVariantCount)
|
||||||
|
{
|
||||||
|
if (!aMimeTypes) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PRUint32 i = 0; i < aVariantCount; i++) {
|
||||||
|
if (!aMimeTypes[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we already marked this as a Java plugin, a later MIME type will tell
|
||||||
|
// us if it is npruntime-enabled.
|
||||||
|
if (mIsJavaPlugin) {
|
||||||
|
if (strcmp(aMimeTypes[i], "application/x-java-vm-npruntime") == 0) {
|
||||||
|
// This "magic MIME type" should not be exposed, but is just a signal
|
||||||
|
// to the browser that this is new-style java.
|
||||||
|
// Don't add it or its associated information to our arrays.
|
||||||
|
mIsNPRuntimeEnabledJavaPlugin = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for certain special plugins.
|
||||||
|
if (nsPluginHost::IsJavaMIMEType(aMimeTypes[i])) {
|
||||||
|
mIsJavaPlugin = true;
|
||||||
|
} else if (strcmp(aMimeTypes[i], "application/x-shockwave-flash") == 0) {
|
||||||
|
mIsFlashPlugin = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill in our MIME type array.
|
||||||
|
mMimeTypes.AppendElement(nsCString(aMimeTypes[i]));
|
||||||
|
|
||||||
|
// Now fill in the MIME descriptions.
|
||||||
|
if (aMimeDescriptions && aMimeDescriptions[i]) {
|
||||||
|
// we should cut off the list of suffixes which the mime
|
||||||
|
// description string may have, see bug 53895
|
||||||
|
// it is usually in form "some description (*.sf1, *.sf2)"
|
||||||
|
// so we can search for the opening round bracket
|
||||||
|
char cur = '\0';
|
||||||
|
char pre = '\0';
|
||||||
|
char * p = PL_strrchr(aMimeDescriptions[i], '(');
|
||||||
|
if (p && (p != aMimeDescriptions[i])) {
|
||||||
|
if ((p - 1) && *(p - 1) == ' ') {
|
||||||
|
pre = *(p - 1);
|
||||||
|
*(p - 1) = '\0';
|
||||||
|
} else {
|
||||||
|
cur = *p;
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mMimeDescriptions.AppendElement(nsCString(aMimeDescriptions[i]));
|
||||||
|
// restore the original string
|
||||||
|
if (cur != '\0') {
|
||||||
|
*p = cur;
|
||||||
|
}
|
||||||
|
if (pre != '\0') {
|
||||||
|
*(p - 1) = pre;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mMimeDescriptions.AppendElement(nsCString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now fill in the extensions.
|
||||||
|
if (aExtensions && aExtensions[i]) {
|
||||||
|
mExtensions.AppendElement(nsCString(aExtensions[i]));
|
||||||
|
} else {
|
||||||
|
mExtensions.AppendElement(nsCString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(XP_WIN) && !defined(XP_MACOSX)
|
#if !defined(XP_WIN) && !defined(XP_MACOSX)
|
||||||
static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder,
|
static nsresult ConvertToUTF8(nsIUnicodeDecoder *aUnicodeDecoder,
|
||||||
nsAFlatCString& aString)
|
nsAFlatCString& aString)
|
||||||
|
@ -119,7 +119,11 @@ public:
|
|||||||
nsCOMPtr<nsITimer> mUnloadTimer;
|
nsCOMPtr<nsITimer> mUnloadTimer;
|
||||||
private:
|
private:
|
||||||
PRUint32 mFlags;
|
PRUint32 mFlags;
|
||||||
|
|
||||||
|
void InitMime(const char* const* aMimeTypes,
|
||||||
|
const char* const* aMimeDescriptions,
|
||||||
|
const char* const* aExtensions,
|
||||||
|
PRUint32 aVariantCount);
|
||||||
nsresult EnsureMembersAreUTF8();
|
nsresult EnsureMembersAreUTF8();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user