зеркало из https://github.com/mozilla/gecko-dev.git
Bug 685236 - Stop using GetNativePath in nsPluginDirWin.cpp. r=jimm
MozReview-Commit-ID: 2eFSKhCEk48 --HG-- extra : source : eb4f7d7b7bce49e295fc37ab000b3c542ee2a15c extra : intermediate-source : d175a56b5aaaa54002212f6b73cbd3a49bad7619
This commit is contained in:
Родитель
9cb3c17ed9
Коммит
d46d67a41d
|
@ -237,33 +237,25 @@ static bool CanLoadPlugin(char16ptr_t aBinaryPath)
|
||||||
// The file name must be in the form "np*.dll"
|
// The file name must be in the form "np*.dll"
|
||||||
bool nsPluginsDir::IsPluginFile(nsIFile* file)
|
bool nsPluginsDir::IsPluginFile(nsIFile* file)
|
||||||
{
|
{
|
||||||
nsAutoCString path;
|
nsAutoString path;
|
||||||
if (NS_FAILED(file->GetNativePath(path)))
|
if (NS_FAILED(file->GetPath(path)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const char *cPath = path.get();
|
|
||||||
|
|
||||||
// this is most likely a path, so skip to the filename
|
// this is most likely a path, so skip to the filename
|
||||||
const char* filename = PL_strrchr(cPath, '\\');
|
auto filename = Substring(path, path.RFindChar('\\') + 1);
|
||||||
if (filename)
|
// The file name must have at least one character between "np" and ".dll".
|
||||||
++filename;
|
if (filename.Length() < 7) {
|
||||||
else
|
return false;
|
||||||
filename = cPath;
|
}
|
||||||
|
|
||||||
char* extension = PL_strrchr(filename, '.');
|
ToLowerCase(filename);
|
||||||
if (extension)
|
if (StringBeginsWith(filename, NS_LITERAL_STRING("np")) &&
|
||||||
++extension;
|
StringEndsWith(filename, NS_LITERAL_STRING(".dll"))) {
|
||||||
|
// don't load OJI-based Java plugins
|
||||||
uint32_t fullLength = strlen(filename);
|
if (StringBeginsWith(filename, NS_LITERAL_STRING("npoji")) ||
|
||||||
uint32_t extLength = extension ? strlen(extension) : 0;
|
StringBeginsWith(filename, NS_LITERAL_STRING("npjava")))
|
||||||
if (fullLength >= 7 && extLength == 3) {
|
return false;
|
||||||
if (!PL_strncasecmp(filename, "np", 2) && !PL_strncasecmp(extension, "dll", 3)) {
|
return true;
|
||||||
// don't load OJI-based Java plugins
|
|
||||||
if (!PL_strncasecmp(filename, "npoji", 5) ||
|
|
||||||
!PL_strncasecmp(filename, "npjava", 6))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче