author | Benjamin Smedberg <benjamin@smedbergs.us> |
Thu, 24 Mar 2011 14:43:37 -0400 | |
changeset 63821 | 2e161bb743d7cf2e1fe55f96ad500097273ff8b2 |
parent 63820 | 4e57be6b29d8c9abe5b6fb6f31eb74dae4525ab1 |
child 63823 | bc7c390b2b435f7eed2e663290f80d8b9c7aa5dc |
child 63896 | b343cef454207d5d5beb4d0d656114441fe5cbcb |
push id | 19263 |
push user | eakhgari@mozilla.com |
push date | Thu, 24 Mar 2011 19:21:02 +0000 |
treeherder | mozilla-central@2e161bb743d7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jst, joshmoz |
bugs | 638171 |
milestone | 2.2a1pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/modules/plugin/base/src/nsPluginHost.cpp +++ b/modules/plugin/base/src/nsPluginHost.cpp @@ -189,18 +189,19 @@ using mozilla::TimeStamp; // 0.07 changed nsIRegistry to flat file support for caching plugins info // 0.08 mime entry point on MachO, bug 137535 // 0.09 the file encoding is changed to UTF-8, bug 420285 // 0.10 added plugin versions on appropriate platforms, bug 427743 // 0.11 file name and full path fields now store expected values on all platforms, bug 488181 // 0.12 force refresh due to quicktime pdf claim fix, bug 611197 // 0.13 add architecture and list of invalid plugins, bug 616271 // 0.14 force refresh due to locale comparison fix, bug 611296 +// 0.15 force refresh due to bug in reading Java plist MIME data, bug 638171 // The current plugin registry version (and the maximum version we know how to read) -static const char *kPluginRegistryVersion = "0.14"; +static const char *kPluginRegistryVersion = "0.15"; // The minimum registry version we know how to read static const char *kMinimumRegistryVersion = "0.9"; static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID); static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_service;1"; // Registry keys for caching plugin info static const char kPluginsRootKey[] = "software/plugins";
--- a/modules/plugin/base/src/nsPluginTags.cpp +++ b/modules/plugin/base/src/nsPluginTags.cpp @@ -121,31 +121,33 @@ mIsJavaPlugin(PR_FALSE), mIsNPRuntimeEnabledJavaPlugin(PR_FALSE), mIsFlashPlugin(PR_FALSE), mFileName(aPluginInfo->fFileName), mFullPath(aPluginInfo->fFullPath), mVersion(aPluginInfo->fVersion), mLastModifiedTime(0), mFlags(NS_PLUGIN_FLAG_ENABLED) { + PRInt32 javaSentinelVariant = -1; + if (aPluginInfo->fMimeTypeArray) { mMimeTypeArray = new char*[mVariants]; for (int i = 0; i < mVariants; i++) { char* currentMIMEType = aPluginInfo->fMimeTypeArray[i]; if (!currentMIMEType) { continue; } if (mIsJavaPlugin) { if (strcmp(currentMIMEType, "application/x-java-vm-npruntime") == 0) { - // Stop processing here, any mimetypes after the magic "I'm a - // NPRuntime enabled Java plugin" mimetype will be ignored. + // This "magic MIME type" should not be exposed, but is just a signal + // to the browser that this is new-style java. + // Remove it and its associated MIME description from our arrays. mIsNPRuntimeEnabledJavaPlugin = PR_TRUE; - mVariants = i; - break; + javaSentinelVariant = i; } } mMimeTypeArray[i] = new_str(currentMIMEType); if (nsPluginHost::IsJavaMIMEType(mMimeTypeArray[i])) { mIsJavaPlugin = PR_TRUE; } @@ -187,16 +189,18 @@ mFlags(NS_PLUGIN_FLAG_ENABLED) } if (aPluginInfo->fExtensionArray != nsnull) { mExtensionsArray = new char*[mVariants]; for (int i = 0; i < mVariants; i++) mExtensionsArray[i] = new_str(aPluginInfo->fExtensionArray[i]); } + RemoveJavaSentinel(javaSentinelVariant); + EnsureMembersAreUTF8(); } nsPluginTag::nsPluginTag(const char* aName, const char* aDescription, const char* aFileName, const char* aFullPath, const char* aVersion, @@ -218,40 +222,39 @@ mCanUnloadLibrary(aCanUnload), mIsJavaPlugin(PR_FALSE), mIsNPRuntimeEnabledJavaPlugin(PR_FALSE), mFileName(aFileName), mFullPath(aFullPath), mVersion(aVersion), mLastModifiedTime(aLastModifiedTime), mFlags(0) // Caller will read in our flags from cache { + PRInt32 javaSentinelVariant = -1; + if (aVariants) { mMimeTypeArray = new char*[mVariants]; mExtensionsArray = new char*[mVariants]; for (PRInt32 i = 0; i < aVariants; ++i) { if (mIsJavaPlugin && aMimeTypes[i] && strcmp(aMimeTypes[i], "application/x-java-vm-npruntime") == 0) { mIsNPRuntimeEnabledJavaPlugin = PR_TRUE; - - // Stop processing here, any mimetypes after the magic "I'm a - // NPRuntime enabled Java plugin" mimetype will be ignored. - mVariants = i; - - break; + javaSentinelVariant = i; } mMimeTypeArray[i] = new_str(aMimeTypes[i]); mMimeDescriptionArray.AppendElement(aMimeDescriptions[i]); mExtensionsArray[i] = new_str(aExtensions[i]); if (nsPluginHost::IsJavaMIMEType(mMimeTypeArray[i])) mIsJavaPlugin = PR_TRUE; } } - + + RemoveJavaSentinel(javaSentinelVariant); + if (!aArgsAreUTF8) EnsureMembersAreUTF8(); } nsPluginTag::~nsPluginTag() { NS_ASSERTION(!mNext, "Risk of exhausting the stack space, bug 486349"); @@ -578,8 +581,38 @@ void nsPluginTag::TryUnloadPlugin() mLibrary = nsnull; // Remove mime types added to the category manager // only if we were made 'active' by setting the host if (mPluginHost) { RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginUnregister); } } + +void +nsPluginTag::RemoveJavaSentinel(PRInt32 sentinelIndex) +{ + if (sentinelIndex == -1) + return; + + delete[] mMimeTypeArray[sentinelIndex]; + mMimeDescriptionArray.RemoveElementAt(sentinelIndex); + if (mExtensionsArray) + delete[] mExtensionsArray[sentinelIndex]; + + // Move the subsequent entries in the arrays. + if (mVariants > sentinelIndex + 1) { + memmove(mMimeTypeArray + sentinelIndex, + mMimeTypeArray + sentinelIndex + 1, + (mVariants - sentinelIndex - 1) * sizeof(mMimeTypeArray[0])); + + if (mExtensionsArray) { + memmove(mExtensionsArray + sentinelIndex, + mExtensionsArray + sentinelIndex + 1, + (mVariants - sentinelIndex - 1) * sizeof(mExtensionsArray[0])); + } + } + --mVariants; + + mMimeTypeArray[mVariants] = NULL; + if (mExtensionsArray) + mExtensionsArray[mVariants] = NULL; +}
--- a/modules/plugin/base/src/nsPluginTags.h +++ b/modules/plugin/base/src/nsPluginTags.h @@ -95,16 +95,21 @@ public: void Mark(PRUint32 mask); void UnMark(PRUint32 mask); PRBool HasFlag(PRUint32 flag); PRUint32 Flags(); PRBool Equals(nsPluginTag* aPluginTag); PRBool IsEnabled(); void RegisterWithCategoryManager(PRBool aOverrideInternalTypes, nsRegisterType aType = ePluginRegister); + + // Remove the MIME/description/extension entry associated with the magic Java sentinel + // which informs us that the Java plugin is NPAPI-enabled. If sentinelIndex is -1, no + // action will be performed. + void RemoveJavaSentinel(PRInt32 sentinelIndex); nsRefPtr<nsPluginTag> mNext; nsPluginHost *mPluginHost; nsCString mName; // UTF-8 nsCString mDescription; // UTF-8 PRInt32 mVariants; char **mMimeTypeArray; nsTArray<nsCString> mMimeDescriptionArray; // UTF-8