mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 644585 - Firefox 4 cannot find plugins whose path is non-ASCII. Make nsPluginTag.mFullPath and various other "full path" members use wide strings, so that we don't have to guess (and get it wrong in a couple cases) whether it's native encoding (which is lossy on Windows) or UTF8. Also, remove support for reading older versions of the plugin registry file, since it's just a cache and doesn't contain data important to the user. r=josh
This commit is contained in:
parent
49fceed112
commit
e1685e0eba
@ -107,7 +107,6 @@ static HWND sBrowserHwnd = NULL;
|
||||
|
||||
PluginModuleChild::PluginModuleChild()
|
||||
: mLibrary(0)
|
||||
, mPluginFilename("")
|
||||
, mQuirks(QUIRKS_NOT_INITIALIZED)
|
||||
, mShutdownFunc(0)
|
||||
, mInitializeFunc(0)
|
||||
@ -184,11 +183,11 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
|
||||
if (!InitGraphics())
|
||||
return false;
|
||||
|
||||
mPluginFilename = aPluginFilename.c_str();
|
||||
CopyUTF8toUTF16(aPluginFilename.c_str(), mPluginFilename);
|
||||
nsCOMPtr<nsILocalFile> pluginFile;
|
||||
NS_NewNativeLocalFile(mPluginFilename,
|
||||
PR_TRUE,
|
||||
getter_AddRefs(pluginFile));
|
||||
NS_NewLocalFile(mPluginFilename,
|
||||
PR_TRUE,
|
||||
getter_AddRefs(pluginFile));
|
||||
|
||||
PRBool exists;
|
||||
pluginFile->Exists(&exists);
|
||||
@ -1880,7 +1879,7 @@ PluginModuleChild::InitQuirksModes(const nsCString& aMimeType)
|
||||
}
|
||||
|
||||
// QuickTime plugin usually loaded with audio/mpeg mimetype
|
||||
NS_NAMED_LITERAL_CSTRING(quicktime, "npqtplugin");
|
||||
NS_NAMED_LITERAL_STRING(quicktime, "npqtplugin");
|
||||
if (FindInReadable(quicktime, mPluginFilename)) {
|
||||
mQuirks |= QUIRK_QUICKTIME_AVOID_SETWINDOW;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ private:
|
||||
#endif
|
||||
|
||||
PRLibrary* mLibrary;
|
||||
nsCString mPluginFilename;
|
||||
nsString mPluginFilename;
|
||||
nsCString mUserAgent;
|
||||
int mQuirks;
|
||||
|
||||
|
@ -83,7 +83,7 @@ struct RunnableMethodTraits<mozilla::plugins::PluginModuleParent>
|
||||
|
||||
// static
|
||||
PluginLibrary*
|
||||
PluginModuleParent::LoadModule(const char* aFilePath)
|
||||
PluginModuleParent::LoadModule(const nsAString& aFilePath)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
|
||||
@ -105,8 +105,8 @@ PluginModuleParent::LoadModule(const char* aFilePath)
|
||||
}
|
||||
|
||||
|
||||
PluginModuleParent::PluginModuleParent(const char* aFilePath)
|
||||
: mSubprocess(new PluginProcessParent(aFilePath))
|
||||
PluginModuleParent::PluginModuleParent(const nsAString& aFilePath)
|
||||
: mSubprocess(new PluginProcessParent(NS_ConvertUTF16toUTF8(aFilePath).get()))
|
||||
, mPluginThread(0)
|
||||
, mShutdown(false)
|
||||
, mClearSiteDataSupported(false)
|
||||
|
@ -106,7 +106,7 @@ protected:
|
||||
DeallocPPluginInstance(PPluginInstanceParent* aActor);
|
||||
|
||||
public:
|
||||
PluginModuleParent(const char* aFilePath);
|
||||
PluginModuleParent(const nsAString& aFilePath);
|
||||
virtual ~PluginModuleParent();
|
||||
|
||||
NS_OVERRIDE virtual void SetPlugin(nsNPAPIPlugin* plugin)
|
||||
@ -122,7 +122,7 @@ public:
|
||||
* This may or may not launch a plugin child process,
|
||||
* and may or may not be very expensive.
|
||||
*/
|
||||
static PluginLibrary* LoadModule(const char* aFilePath);
|
||||
static PluginLibrary* LoadModule(const nsAString& aFilePath);
|
||||
|
||||
const NPNetscapeFuncs* GetNetscapeFuncs() {
|
||||
return mNPNIface;
|
||||
|
@ -48,7 +48,7 @@ namespace mozilla {
|
||||
class PluginPRLibrary : public PluginLibrary
|
||||
{
|
||||
public:
|
||||
PluginPRLibrary(const char* aFilePath, PRLibrary* aLibrary) :
|
||||
PluginPRLibrary(const nsAString& aFilePath, PRLibrary* aLibrary) :
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
mNP_Initialize(nsnull),
|
||||
#else
|
||||
|
@ -379,7 +379,7 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
|
||||
// of "dom.ipc.plugins.enabled"
|
||||
// The "filename.dll" part can contain shell wildcard pattern
|
||||
|
||||
nsCAutoString prefFile(aPluginTag->mFullPath.get());
|
||||
NS_ConvertUTF16toUTF8 prefFile(aPluginTag->mFullPath);
|
||||
PRInt32 slashPos = prefFile.RFindCharInSet("/\\");
|
||||
if (kNotFound == slashPos)
|
||||
return PR_FALSE;
|
||||
@ -472,10 +472,10 @@ GetNewPluginLibrary(nsPluginTag *aPluginTag)
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
|
||||
return PluginModuleParent::LoadModule(aPluginTag->mFullPath.get());
|
||||
return PluginModuleParent::LoadModule(aPluginTag->mFullPath);
|
||||
}
|
||||
#endif
|
||||
return new PluginPRLibrary(aPluginTag->mFullPath.get(), aPluginTag->mLibrary);
|
||||
return new PluginPRLibrary(aPluginTag->mFullPath, aPluginTag->mLibrary);
|
||||
}
|
||||
|
||||
// Creates an nsNPAPIPlugin object. One nsNPAPIPlugin object exists per plugin (not instance).
|
||||
|
@ -180,25 +180,8 @@ using mozilla::TimeStamp;
|
||||
#define kPluginTmpDirName NS_LITERAL_CSTRING("plugtmp")
|
||||
|
||||
// Version of cached plugin info
|
||||
// 0.01 first implementation
|
||||
// 0.02 added caching of CanUnload to fix bug 105935
|
||||
// 0.03 changed name, description and mime desc from string to bytes, bug 108246
|
||||
// 0.04 added new mime entry point on Mac, bug 113464
|
||||
// 0.05 added new entry point check for the default plugin, bug 132430
|
||||
// 0.06 strip off suffixes in mime description strings, bug 53895
|
||||
// 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.15";
|
||||
// The minimum registry version we know how to read
|
||||
static const char *kMinimumRegistryVersion = "0.9";
|
||||
// The current plugin registry version (and the only version we know how to read)
|
||||
static const char *kPluginRegistryVersion = "0.16";
|
||||
|
||||
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_service;1";
|
||||
@ -241,7 +224,7 @@ nsPluginHost *nsPluginHost::sInst;
|
||||
|
||||
NS_IMPL_ISUPPORTS0(nsInvalidPluginTag)
|
||||
|
||||
nsInvalidPluginTag::nsInvalidPluginTag(const char* aFullPath, PRInt64 aLastModifiedTime)
|
||||
nsInvalidPluginTag::nsInvalidPluginTag(const nsAString& aFullPath, PRInt64 aLastModifiedTime)
|
||||
: mFullPath(aFullPath),
|
||||
mLastModifiedTime(aLastModifiedTime),
|
||||
mSeen(false)
|
||||
@ -1539,7 +1522,7 @@ public:
|
||||
if (prefService &&
|
||||
NS_SUCCEEDED(prefService->GetBoolPref("plugin.expose_full_path", &bShowPath)) &&
|
||||
bShowPath) {
|
||||
CopyUTF8toUTF16(mPluginTag.mFullPath, aFilename);
|
||||
aFilename = mPluginTag.mFullPath;
|
||||
} else {
|
||||
CopyUTF8toUTF16(mPluginTag.mFileName, aFilename);
|
||||
}
|
||||
@ -1719,24 +1702,6 @@ nsPluginHost::FindPluginEnabledForExtension(const char* aExtension,
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
static nsresult ConvertToNative(nsIUnicodeEncoder *aEncoder,
|
||||
const nsACString& aUTF8String,
|
||||
nsACString& aNativeString)
|
||||
{
|
||||
NS_ConvertUTF8toUTF16 utf16(aUTF8String);
|
||||
PRInt32 len = utf16.Length();
|
||||
PRInt32 outLen;
|
||||
nsresult rv = aEncoder->GetMaxLength(utf16.get(), len, &outLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!EnsureStringLength(aNativeString, outLen))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = aEncoder->Convert(utf16.get(), &len,
|
||||
aNativeString.BeginWriting(), &outLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aNativeString.SetLength(outLen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
|
||||
nsNPAPIPlugin **aOutNPAPIPlugin)
|
||||
{
|
||||
@ -1749,7 +1714,7 @@ static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
|
||||
if (aPluginTag->mFullPath.IsEmpty())
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
file->InitWithPath(NS_ConvertUTF8toUTF16(aPluginTag->mFullPath));
|
||||
file->InitWithPath(aPluginTag->mFullPath);
|
||||
nsPluginFile pluginFile(file);
|
||||
PRLibrary* pluginLibrary = NULL;
|
||||
|
||||
@ -1764,36 +1729,16 @@ static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
|
||||
do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString charset;
|
||||
rv = pcs->GetCharset(kPlatformCharsetSel_FileName, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString fullPath;
|
||||
if (!charset.LowerCaseEqualsLiteral("utf-8")) {
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ccm->GetUnicodeEncoderRaw(charset.get(), getter_AddRefs(encoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ConvertToNative(encoder, aPluginTag->mFullPath, fullPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
fullPath = aPluginTag->mFullPath;
|
||||
}
|
||||
rv = nsNPAPIPlugin::CreatePlugin(aPluginTag, aOutNPAPIPlugin);
|
||||
|
||||
#if defined(XP_MACOSX) && !defined(__LP64__)
|
||||
short appRefNum = ::CurResFile();
|
||||
nsCOMPtr<nsILocalFile> pluginPath;
|
||||
NS_NewNativeLocalFile(nsDependentCString(fullPath.get()), PR_TRUE,
|
||||
getter_AddRefs(pluginPath));
|
||||
NS_NewLocalFile(aPluginTag->mFullPath, PR_TRUE,
|
||||
getter_AddRefs(pluginPath));
|
||||
nsPluginFile pluginFile(pluginPath);
|
||||
short pluginRefNum = pluginFile.OpenPluginResource();
|
||||
#endif
|
||||
|
||||
rv = nsNPAPIPlugin::CreatePlugin(aPluginTag, aOutNPAPIPlugin);
|
||||
|
||||
#if defined(XP_MACOSX) && !defined(__LP64__)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
(*aOutNPAPIPlugin)->SetPluginRefNum(pluginRefNum);
|
||||
else if (pluginRefNum > 0)
|
||||
@ -2228,9 +2173,8 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
PRInt64 fileModTime = pfd.mModTime;
|
||||
|
||||
// Look for it in our cache
|
||||
NS_ConvertUTF16toUTF8 filePath(pfd.mFilePath);
|
||||
nsRefPtr<nsPluginTag> pluginTag;
|
||||
RemoveCachedPluginsInfo(filePath.get(),
|
||||
RemoveCachedPluginsInfo(pfd.mFilePath,
|
||||
getter_AddRefs(pluginTag));
|
||||
|
||||
PRBool enabled = PR_TRUE;
|
||||
@ -2278,7 +2222,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
for (nsRefPtr<nsInvalidPluginTag> invalidPlugins = mInvalidPlugins;
|
||||
invalidPlugins; invalidPlugins = invalidPlugins->mNext) {
|
||||
// If already marked as invalid, ignore it
|
||||
if (invalidPlugins->mFullPath.Equals(filePath.get()) &&
|
||||
if (invalidPlugins->mFullPath.Equals(pfd.mFilePath) &&
|
||||
invalidPlugins->mLastModifiedTime == fileModTime) {
|
||||
if (aCreatePluginList) {
|
||||
invalidPlugins->mSeen = true;
|
||||
@ -2302,7 +2246,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
nsresult res = pluginFile.GetPluginInfo(info, &library);
|
||||
// if we don't have mime type don't proceed, this is not a plugin
|
||||
if (NS_FAILED(res) || !info.fMimeTypeArray) {
|
||||
nsRefPtr<nsInvalidPluginTag> invalidTag = new nsInvalidPluginTag(filePath.get(),
|
||||
nsRefPtr<nsInvalidPluginTag> invalidTag = new nsInvalidPluginTag(pfd.mFilePath,
|
||||
fileModTime);
|
||||
pluginFile.FreePluginInfo(info);
|
||||
|
||||
@ -2761,13 +2705,13 @@ nsPluginHost::WritePluginInfo()
|
||||
// filename & fullpath are on separate line
|
||||
// because they can contain field delimiter char
|
||||
PR_fprintf(fd, "%s%c%c\n%s%c%c\n%s%c%c\n",
|
||||
(!tag->mFileName.IsEmpty() ? tag->mFileName.get() : ""),
|
||||
tag->mFileName.get(),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
(!tag->mFullPath.IsEmpty() ? tag->mFullPath.get() : ""),
|
||||
tag->mFullPath.get(),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
(!tag->mVersion.IsEmpty() ? tag->mVersion.get() : ""),
|
||||
tag->mVersion.get(),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER);
|
||||
|
||||
@ -2824,7 +2768,7 @@ nsPluginHost::WritePluginInfo()
|
||||
while (invalidPlugins) {
|
||||
// fullPath
|
||||
PR_fprintf(fd, "%s%c%c\n",
|
||||
(!invalidPlugins->mFullPath.IsEmpty() ? invalidPlugins->mFullPath.get() : ""),
|
||||
NS_ConvertUTF16toUTF8(invalidPlugins->mFullPath).get(),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER);
|
||||
|
||||
@ -2931,114 +2875,71 @@ nsPluginHost::ReadPluginInfo()
|
||||
return rv;
|
||||
|
||||
// kPluginRegistryVersion
|
||||
PRInt32 vdiff = NS_CompareVersions(values[1], kPluginRegistryVersion);
|
||||
// If this is a registry from some future version then don't attempt to read it
|
||||
if (vdiff > 0)
|
||||
return rv;
|
||||
// If this is a registry from before the minimum then don't attempt to read it
|
||||
if (NS_CompareVersions(values[1], kMinimumRegistryVersion) < 0)
|
||||
if (!strcmp(values[1], kPluginRegistryVersion))
|
||||
return rv;
|
||||
|
||||
// Registry v0.10 and upwards includes the plugin version field
|
||||
PRBool regHasVersion = NS_CompareVersions(values[1], "0.10") >= 0;
|
||||
|
||||
// Registry v0.13 and upwards includes the architecture
|
||||
if (NS_CompareVersions(values[1], "0.13") >= 0) {
|
||||
char* archValues[6];
|
||||
char* archValues[6];
|
||||
|
||||
if (!reader.NextLine()) {
|
||||
return rv;
|
||||
}
|
||||
if (!reader.NextLine()) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ArchLiteral, Architecture
|
||||
if (2 != reader.ParseLine(archValues, 2)) {
|
||||
return rv;
|
||||
}
|
||||
// ArchLiteral, Architecture
|
||||
if (2 != reader.ParseLine(archValues, 2)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ArchLiteral
|
||||
if (PL_strcmp(archValues[0], "Arch")) {
|
||||
return rv;
|
||||
}
|
||||
// ArchLiteral
|
||||
if (PL_strcmp(archValues[0], "Arch")) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (!runtime) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
if (!runtime) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCAutoString arch;
|
||||
if (NS_FAILED(runtime->GetXPCOMABI(arch))) {
|
||||
return rv;
|
||||
}
|
||||
nsCAutoString arch;
|
||||
if (NS_FAILED(runtime->GetXPCOMABI(arch))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// If this is a registry from a different architecture then don't attempt to read it
|
||||
if (PL_strcmp(archValues[1], arch.get())) {
|
||||
return rv;
|
||||
}
|
||||
// If this is a registry from a different architecture then don't attempt to read it
|
||||
if (PL_strcmp(archValues[1], arch.get())) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Registry v0.13 and upwards includes the list of invalid plugins
|
||||
bool hasInvalidPlugins = (NS_CompareVersions(values[1], "0.13") >= 0);
|
||||
|
||||
if (!ReadSectionHeader(reader, "PLUGINS"))
|
||||
return rv;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
PRBool hasFullPathInFileNameField = PR_FALSE;
|
||||
#else
|
||||
PRBool hasFullPathInFileNameField = (NS_CompareVersions(values[1], "0.11") < 0);
|
||||
#endif
|
||||
|
||||
while (reader.NextLine()) {
|
||||
const char *filename;
|
||||
const char *fullpath;
|
||||
nsCAutoString derivedFileName;
|
||||
|
||||
if (hasInvalidPlugins && *reader.LinePtr() == '[') {
|
||||
if (*reader.LinePtr() == '[') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (hasFullPathInFileNameField) {
|
||||
fullpath = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
// try to derive a file name from the full path
|
||||
if (fullpath) {
|
||||
nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
|
||||
file->InitWithNativePath(nsDependentCString(fullpath));
|
||||
file->GetNativeLeafName(derivedFileName);
|
||||
filename = derivedFileName.get();
|
||||
} else {
|
||||
filename = NULL;
|
||||
}
|
||||
filename = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
|
||||
// skip the next line, useless in this version
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
} else {
|
||||
filename = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
|
||||
fullpath = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
}
|
||||
fullpath = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
|
||||
const char *version;
|
||||
if (regHasVersion) {
|
||||
version = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
} else {
|
||||
version = "0";
|
||||
}
|
||||
version = reader.LinePtr();
|
||||
if (!reader.NextLine())
|
||||
return rv;
|
||||
|
||||
// lastModifiedTimeStamp|canUnload|tag.mFlag
|
||||
if (reader.ParseLine(values, 3) != 3)
|
||||
return rv;
|
||||
|
||||
// If this is an old plugin registry mark this plugin tag to be refreshed
|
||||
PRInt64 lastmod = (vdiff == 0) ? nsCRT::atoll(values[0]) : -1;
|
||||
PRInt64 lastmod = nsCRT::atoll(values[0]);
|
||||
PRBool canunload = atoi(values[1]);
|
||||
PRUint32 tagflag = atoi(values[2]);
|
||||
if (!reader.NextLine())
|
||||
@ -3094,7 +2995,7 @@ nsPluginHost::ReadPluginInfo()
|
||||
nsRefPtr<nsPluginTag> tag = new nsPluginTag(name,
|
||||
description,
|
||||
filename,
|
||||
fullpath,
|
||||
NS_ConvertUTF8toUTF16(fullpath),
|
||||
version,
|
||||
(const char* const*)mimetypes,
|
||||
(const char* const*)mimedescriptions,
|
||||
@ -3114,34 +3015,34 @@ nsPluginHost::ReadPluginInfo()
|
||||
mCachedPlugins = tag;
|
||||
}
|
||||
|
||||
if (hasInvalidPlugins) {
|
||||
if (!ReadSectionHeader(reader, "INVALID")) {
|
||||
if (!ReadSectionHeader(reader, "INVALID")) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
while (reader.NextLine()) {
|
||||
const char *fullpath = reader.LinePtr();
|
||||
if (!reader.NextLine()) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
const char *lastModifiedTimeStamp = reader.LinePtr();
|
||||
PRInt64 lastmod = nsCRT::atoll(lastModifiedTimeStamp);
|
||||
|
||||
nsRefPtr<nsInvalidPluginTag> invalidTag = new nsInvalidPluginTag(NS_ConvertUTF8toUTF16(fullpath),
|
||||
lastmod);
|
||||
|
||||
while (reader.NextLine()) {
|
||||
const char *fullpath = reader.LinePtr();
|
||||
if (!reader.NextLine()) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
const char *lastModifiedTimeStamp = reader.LinePtr();
|
||||
PRInt64 lastmod = (vdiff == 0) ? nsCRT::atoll(lastModifiedTimeStamp) : -1;
|
||||
|
||||
nsRefPtr<nsInvalidPluginTag> invalidTag = new nsInvalidPluginTag(fullpath, lastmod);
|
||||
|
||||
invalidTag->mNext = mInvalidPlugins;
|
||||
if (mInvalidPlugins) {
|
||||
mInvalidPlugins->mPrev = invalidTag;
|
||||
}
|
||||
mInvalidPlugins = invalidTag;
|
||||
invalidTag->mNext = mInvalidPlugins;
|
||||
if (mInvalidPlugins) {
|
||||
mInvalidPlugins->mPrev = invalidTag;
|
||||
}
|
||||
mInvalidPlugins = invalidTag;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginHost::RemoveCachedPluginsInfo(const char *filePath, nsPluginTag **result)
|
||||
nsPluginHost::RemoveCachedPluginsInfo(const nsAString& filePath, nsPluginTag **result)
|
||||
{
|
||||
nsRefPtr<nsPluginTag> prev;
|
||||
nsRefPtr<nsPluginTag> tag = mCachedPlugins;
|
||||
|
@ -76,12 +76,12 @@ class nsIChannel;
|
||||
class nsInvalidPluginTag : public nsISupports
|
||||
{
|
||||
public:
|
||||
nsInvalidPluginTag(const char* aFullPath, PRInt64 aLastModifiedTime = 0);
|
||||
nsInvalidPluginTag(const nsAString& aFullPath, PRInt64 aLastModifiedTime = 0);
|
||||
virtual ~nsInvalidPluginTag();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsCString mFullPath;
|
||||
nsString mFullPath;
|
||||
PRInt64 mLastModifiedTime;
|
||||
bool mSeen;
|
||||
|
||||
@ -257,7 +257,7 @@ private:
|
||||
|
||||
// Given a file path, returns the plugins info from our cache
|
||||
// and removes it from the cache.
|
||||
void RemoveCachedPluginsInfo(const char *filePath,
|
||||
void RemoveCachedPluginsInfo(const nsAString& filePath,
|
||||
nsPluginTag **result);
|
||||
|
||||
// Checks to see if a tag object is in our list of live tags.
|
||||
|
@ -202,7 +202,7 @@ mFlags(NS_PLUGIN_FLAG_ENABLED)
|
||||
nsPluginTag::nsPluginTag(const char* aName,
|
||||
const char* aDescription,
|
||||
const char* aFileName,
|
||||
const char* aFullPath,
|
||||
const nsAString& aFullPath,
|
||||
const char* aVersion,
|
||||
const char* const* aMimeTypes,
|
||||
const char* const* aMimeDescriptions,
|
||||
@ -320,7 +320,6 @@ nsresult nsPluginTag::EnsureMembersAreUTF8()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ConvertToUTF8(decoder, mFileName);
|
||||
ConvertToUTF8(decoder, mFullPath);
|
||||
}
|
||||
|
||||
// The description of the plug-in and the various MIME type descriptions
|
||||
@ -364,7 +363,7 @@ nsPluginTag::GetFilename(nsACString& aFileName)
|
||||
NS_IMETHODIMP
|
||||
nsPluginTag::GetFullpath(nsACString& aFullPath)
|
||||
{
|
||||
aFullPath = mFullPath;
|
||||
CopyUTF16toUTF8(mFullPath, aFullPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
nsPluginTag(const char* aName,
|
||||
const char* aDescription,
|
||||
const char* aFileName,
|
||||
const char* aFullPath,
|
||||
const nsAString& aFullPath,
|
||||
const char* aVersion,
|
||||
const char* const* aMimeTypes,
|
||||
const char* const* aMimeDescriptions,
|
||||
@ -121,7 +121,7 @@ public:
|
||||
PRPackedBool mIsNPRuntimeEnabledJavaPlugin;
|
||||
PRPackedBool mIsFlashPlugin;
|
||||
nsCString mFileName; // UTF-8
|
||||
nsCString mFullPath; // UTF-8
|
||||
nsString mFullPath;
|
||||
nsCString mVersion; // UTF-8
|
||||
PRInt64 mLastModifiedTime;
|
||||
private:
|
||||
|
@ -64,7 +64,7 @@ struct nsPluginInfo {
|
||||
char** fMimeDescriptionArray;
|
||||
char** fExtensionArray;
|
||||
char* fFileName;
|
||||
char* fFullPath;
|
||||
PRUnichar* fFullPath;
|
||||
char* fVersion;
|
||||
#ifdef XP_MACOSX
|
||||
PRBool fBundle;
|
||||
|
@ -518,7 +518,11 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
|
||||
CFBundleRef bundle = getPluginBundle(path.get());
|
||||
|
||||
// fill in full path
|
||||
info.fFullPath = PL_strdup(path.get());
|
||||
nsAutoString wpath;
|
||||
rv = mPlugin->GetPath(wpath);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
info.fFullPath = ToNewUnicode(wpath);
|
||||
|
||||
// fill in file name
|
||||
nsCAutoString fileName;
|
||||
|
@ -368,10 +368,10 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCAutoString path;
|
||||
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
|
||||
nsAutoString path;
|
||||
if (NS_FAILED(rv = mPlugin->GetPath(path)))
|
||||
return rv;
|
||||
info.fFullPath = PL_strdup(path.get());
|
||||
info.fFullPath = ToNewUnicode(path);
|
||||
|
||||
nsCAutoString fileName;
|
||||
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
|
||||
@ -427,8 +427,7 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
|
||||
PR_FREEIF(info.fMimeDescriptionArray);
|
||||
PR_FREEIF(info.fExtensionArray);
|
||||
|
||||
if (info.fFullPath != nsnull)
|
||||
PL_strfree(info.fFullPath);
|
||||
NS_Free(info.fFullPath);
|
||||
|
||||
if (info.fFileName != nsnull)
|
||||
PL_strfree(info.fFileName);
|
||||
|
@ -377,7 +377,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
|
||||
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
|
||||
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
|
||||
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
|
||||
info.fFullPath = PL_strdup(NS_ConvertUTF16toUTF8(fullPath).get());
|
||||
info.fFullPath = ToNewUnicode(fullPath);
|
||||
info.fFileName = PL_strdup(NS_ConvertUTF16toUTF8(fileName).get());
|
||||
info.fVersion = GetVersion(verbuf);
|
||||
|
||||
@ -412,7 +412,7 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
|
||||
FreeStringArray(info.fVariantCount, info.fExtensionArray);
|
||||
|
||||
if (info.fFullPath)
|
||||
PL_strfree(info.fFullPath);
|
||||
NS_Free(info.fFullPath);
|
||||
|
||||
if (info.fFileName)
|
||||
PL_strfree(info.fFileName);
|
||||
|
2
netwerk/cache/nsDiskCacheStreams.cpp
vendored
2
netwerk/cache/nsDiskCacheStreams.cpp
vendored
@ -757,9 +757,9 @@ nsDiskCacheStreamIO::FlushBufferToFile()
|
||||
rv = OpenCacheFile(PR_RDWR | PR_CREATE_FILE, &mFD);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#if 0
|
||||
PRInt64 dataSize = mBinding->mCacheEntry->PredictedDataSize();
|
||||
// Appears to cause bug 617123? Disabled for now.
|
||||
#if 0
|
||||
if (dataSize != -1)
|
||||
mozilla::fallocate(mFD, PR_MIN(dataSize, kPreallocateLimit));
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user