mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 313700 - Stale information in about:plugins (pluginreg.dat) after a plugin update. r=josh
This commit is contained in:
parent
401a30de2c
commit
b02d7f21d4
@ -68,6 +68,9 @@
|
||||
#include "nsIProtocolProxyService.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIFile.h"
|
||||
#if defined(XP_MACOSX)
|
||||
#include "nsILocalFileMac.h"
|
||||
#endif
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURL.h"
|
||||
@ -1991,7 +1994,19 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
continue;
|
||||
|
||||
PRInt64 fileModTime = LL_ZERO;
|
||||
#if defined(XP_MACOSX)
|
||||
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)
|
||||
// is a much better guide to when it was last modified than the date of
|
||||
// its package directory. See bug 313700.
|
||||
nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(localfile);
|
||||
if (localFileMac) {
|
||||
localFileMac->GetBundleContentsLastModifiedTime(&fileModTime);
|
||||
} else {
|
||||
localfile->GetLastModifiedTime(&fileModTime);
|
||||
}
|
||||
#else
|
||||
localfile->GetLastModifiedTime(&fileModTime);
|
||||
#endif
|
||||
|
||||
// Look for it in our cache
|
||||
NS_ConvertUTF16toUTF8 filePath(utf16FilePath);
|
||||
|
@ -50,7 +50,7 @@
|
||||
[ptr] native FSRefPtr(FSRef);
|
||||
native CFURLRef(CFURLRef);
|
||||
|
||||
[scriptable, uuid(DE4C75BE-D42B-4F8C-95D9-284C83CF29A4)]
|
||||
[scriptable, uuid(E5DE2CC9-BF06-4329-8F91-5D2D45284500)]
|
||||
interface nsILocalFileMac : nsILocalFile
|
||||
{
|
||||
/**
|
||||
@ -193,6 +193,15 @@ interface nsILocalFileMac : nsILocalFile
|
||||
* returns the identifier of the bundle
|
||||
*/
|
||||
readonly attribute AUTF8String bundleIdentifier;
|
||||
|
||||
/**
|
||||
* Last modified time of a bundle's contents (as opposed to its package
|
||||
* directory). Our convention is to make the bundle's Info.plist file
|
||||
* stand in for the rest of its contents -- since this file contains the
|
||||
* bundle's version information and other identifiers. For non-bundles
|
||||
* this is the same as lastModifiedTime.
|
||||
*/
|
||||
readonly attribute PRInt64 bundleContentsLastModifiedTime;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -2440,6 +2440,34 @@ nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetBundleContentsLastModifiedTime(PRInt64 *aLastModTime)
|
||||
{
|
||||
CHECK_mPath();
|
||||
NS_ENSURE_ARG_POINTER(aLastModTime);
|
||||
|
||||
bool isPackage = false;
|
||||
nsresult rv = IsPackage(&isPackage);
|
||||
if (NS_FAILED(rv) || !isPackage) {
|
||||
return GetLastModifiedTime(aLastModTime);
|
||||
}
|
||||
|
||||
nsCAutoString infoPlistPath(mPath);
|
||||
infoPlistPath.AppendLiteral("/Contents/Info.plist");
|
||||
PRFileInfo64 info;
|
||||
if (PR_GetFileInfo64(infoPlistPath.get(), &info) != PR_SUCCESS) {
|
||||
return GetLastModifiedTime(aLastModTime);
|
||||
}
|
||||
PRInt64 modTime = PRInt64(info.modifyTime);
|
||||
if (modTime == 0) {
|
||||
*aLastModTime = 0;
|
||||
} else {
|
||||
*aLastModTime = modTime / PRInt64(PR_USEC_PER_MSEC);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalFile::InitWithFile(nsIFile *aFile)
|
||||
{
|
||||
NS_ENSURE_ARG(aFile);
|
||||
|
Loading…
Reference in New Issue
Block a user