mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 983993, part 1 - Remove trailing whitespace from nsOSHelperAppService.
This commit is contained in:
parent
dbcaee046c
commit
32e5aaa404
@ -83,7 +83,7 @@ nsOSHelperAppService::UnescapeCommand(const nsAString& aEscapedCommand,
|
||||
LOG(("Command to escape: '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(aEscapedCommand).get()));
|
||||
// XXX This function will need to get the mime type and various stuff like that being passed in to work properly
|
||||
|
||||
|
||||
LOG(("UnescapeCommand really needs some work -- it should actually do some unescaping\n"));
|
||||
|
||||
CopyUTF16toUTF8(aEscapedCommand, aUnEscapedCommand);
|
||||
@ -124,7 +124,7 @@ ParseMIMEType(const nsAString::const_iterator& aStart_iter,
|
||||
nsAString::const_iterator& aMinorTypeEnd,
|
||||
const nsAString::const_iterator& aEnd_iter) {
|
||||
nsAString::const_iterator iter(aStart_iter);
|
||||
|
||||
|
||||
// skip leading whitespace
|
||||
while (iter != aEnd_iter && nsCRT::IsAsciiSpace(*iter)) {
|
||||
++iter;
|
||||
@ -133,20 +133,20 @@ ParseMIMEType(const nsAString::const_iterator& aStart_iter,
|
||||
if (iter == aEnd_iter) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
aMajorTypeStart = iter;
|
||||
|
||||
// find major/minor separator ('/')
|
||||
while (iter != aEnd_iter && *iter != '/') {
|
||||
++iter;
|
||||
}
|
||||
|
||||
|
||||
if (iter == aEnd_iter) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
aMajorTypeEnd = iter;
|
||||
|
||||
|
||||
// skip '/'
|
||||
++iter;
|
||||
|
||||
@ -175,7 +175,7 @@ nsOSHelperAppService::GetFileLocation(const char* aPrefName,
|
||||
aPrefName,
|
||||
aEnvVarName));
|
||||
NS_PRECONDITION(aPrefName, "Null pref name passed; don't do that!");
|
||||
|
||||
|
||||
aFileLocation.Truncate();
|
||||
/* The lookup order is:
|
||||
1) user pref
|
||||
@ -234,7 +234,7 @@ nsOSHelperAppService::LookUpTypeAndDescription(const nsAString& aFileExtension,
|
||||
|
||||
const char* filenamePref = aUserData ?
|
||||
"helpers.private_mime_types_file" : "helpers.global_mime_types_file";
|
||||
|
||||
|
||||
rv = GetFileLocation(filenamePref, nullptr, mimeFileName);
|
||||
if (NS_SUCCEEDED(rv) && !mimeFileName.IsEmpty()) {
|
||||
rv = GetTypeAndDescriptionFromMimetypesFile(mimeFileName,
|
||||
@ -335,7 +335,7 @@ nsOSHelperAppService::GetTypeAndDescriptionFromMimetypesFile(const nsAString& aF
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsAutoString extensions;
|
||||
nsString entry;
|
||||
entry.SetCapacity(100);
|
||||
@ -503,14 +503,14 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsAutoString extensions;
|
||||
nsString entry;
|
||||
entry.SetCapacity(100);
|
||||
nsAString::const_iterator majorTypeStart, majorTypeEnd,
|
||||
minorTypeStart, minorTypeEnd,
|
||||
descriptionStart, descriptionEnd;
|
||||
|
||||
|
||||
do {
|
||||
CopyASCIItoUTF16(cBuf, buf);
|
||||
// read through, building up an entry. If we finish an entry, check for
|
||||
@ -531,7 +531,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
minorTypeStart, minorTypeEnd,
|
||||
extensions,
|
||||
descriptionStart, descriptionEnd);
|
||||
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// We sometimes get things like RealPlayer appending
|
||||
// "normal" entries to "Netscape" .mime.types files. Try
|
||||
@ -549,7 +549,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
minorTypeStart,
|
||||
minorTypeEnd, extensions,
|
||||
descriptionStart, descriptionEnd);
|
||||
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// We sometimes get things like StarOffice prepending
|
||||
// "normal" entries to "Netscape" .mime.types files. Try
|
||||
@ -562,7 +562,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
descriptionStart, descriptionEnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
Substring(majorTypeStart,
|
||||
majorTypeEnd).Equals(aMajorType,
|
||||
@ -578,7 +578,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
} else if (NS_FAILED(rv)) {
|
||||
LOG(("Failed to parse entry: %s\n", NS_LossyConvertUTF16toASCII(entry).get()));
|
||||
}
|
||||
|
||||
|
||||
entry.Truncate();
|
||||
}
|
||||
}
|
||||
@ -601,7 +601,7 @@ nsOSHelperAppService::GetExtensionsAndDescriptionFromMimetypesFile(const nsAStri
|
||||
* type=foo/bar; options exts="baz" description="Some type"
|
||||
*
|
||||
* and
|
||||
*
|
||||
*
|
||||
* type=foo/bar; options description="Some type" exts="baz"
|
||||
*/
|
||||
// static
|
||||
@ -616,12 +616,12 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
nsAString::const_iterator& aDescriptionEnd) {
|
||||
LOG(("-- ParseNetscapeMIMETypesEntry\n"));
|
||||
NS_ASSERTION(!aEntry.IsEmpty(), "Empty Netscape MIME types entry being parsed.");
|
||||
|
||||
|
||||
nsAString::const_iterator start_iter, end_iter, match_start, match_end;
|
||||
|
||||
aEntry.BeginReading(start_iter);
|
||||
aEntry.EndReading(end_iter);
|
||||
|
||||
|
||||
// skip trailing whitespace
|
||||
do {
|
||||
--end_iter;
|
||||
@ -633,15 +633,15 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
++end_iter;
|
||||
match_start = start_iter;
|
||||
match_end = end_iter;
|
||||
|
||||
|
||||
// Get the major and minor types
|
||||
// First the major type
|
||||
if (! FindInReadable(NS_LITERAL_STRING("type="), match_start, match_end)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
match_start = match_end;
|
||||
|
||||
|
||||
while (match_end != end_iter &&
|
||||
*match_end != '/') {
|
||||
++match_end;
|
||||
@ -649,7 +649,7 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
if (match_end == end_iter) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
aMajorTypeStart = match_start;
|
||||
aMajorTypeEnd = match_end;
|
||||
|
||||
@ -657,9 +657,9 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
if (++match_end == end_iter) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
match_start = match_end;
|
||||
|
||||
|
||||
while (match_end != end_iter &&
|
||||
!nsCRT::IsAsciiSpace(*match_end) &&
|
||||
*match_end != ';') {
|
||||
@ -668,13 +668,13 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
if (match_end == end_iter) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
aMinorTypeStart = match_start;
|
||||
aMinorTypeEnd = match_end;
|
||||
|
||||
|
||||
// ignore everything up to the end of the mime type from here on
|
||||
start_iter = match_end;
|
||||
|
||||
|
||||
// get the extensions
|
||||
match_start = match_end;
|
||||
match_end = end_iter;
|
||||
@ -685,7 +685,7 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
(*match_end == '"' && ++match_end == end_iter)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
extStart = match_end;
|
||||
match_start = extStart;
|
||||
match_end = end_iter;
|
||||
@ -695,12 +695,12 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
if (extEnd == extStart) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
--extEnd;
|
||||
} while (extEnd != extStart &&
|
||||
nsCRT::IsAsciiSpace(*extEnd));
|
||||
|
||||
|
||||
if (extEnd != extStart && *extEnd == '"') {
|
||||
--extEnd;
|
||||
}
|
||||
@ -727,12 +727,12 @@ nsOSHelperAppService::ParseNetscapeMIMETypesEntry(const nsAString& aEntry,
|
||||
if (aDescriptionEnd == aDescriptionStart) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
--aDescriptionEnd;
|
||||
} while (aDescriptionEnd != aDescriptionStart &&
|
||||
nsCRT::IsAsciiSpace(*aDescriptionEnd));
|
||||
|
||||
|
||||
if (aDescriptionStart != aDescriptionStart && *aDescriptionEnd == '"') {
|
||||
--aDescriptionEnd;
|
||||
}
|
||||
@ -768,7 +768,7 @@ nsOSHelperAppService::ParseNormalMIMETypesEntry(const nsAString& aEntry,
|
||||
NS_ASSERTION(!aEntry.IsEmpty(), "Empty Normal MIME types entry being parsed.");
|
||||
|
||||
nsAString::const_iterator start_iter, end_iter, iter;
|
||||
|
||||
|
||||
aEntry.BeginReading(start_iter);
|
||||
aEntry.EndReading(end_iter);
|
||||
|
||||
@ -787,7 +787,7 @@ nsOSHelperAppService::ParseNormalMIMETypesEntry(const nsAString& aEntry,
|
||||
do {
|
||||
--end_iter;
|
||||
} while (end_iter != start_iter && nsCRT::IsAsciiSpace(*end_iter));
|
||||
|
||||
|
||||
++end_iter; // point to first whitespace char (or to end of string)
|
||||
iter = start_iter;
|
||||
|
||||
@ -798,17 +798,17 @@ nsOSHelperAppService::ParseNormalMIMETypesEntry(const nsAString& aEntry,
|
||||
nsAString::const_iterator equals_sign_iter(start_iter);
|
||||
if (FindCharInReadable('=', equals_sign_iter, iter))
|
||||
return NS_ERROR_FAILURE; // see bug 136670
|
||||
|
||||
|
||||
aMajorTypeStart = start_iter;
|
||||
aMajorTypeEnd = iter;
|
||||
|
||||
|
||||
// get the minor type
|
||||
if (++iter == end_iter) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
start_iter = iter;
|
||||
|
||||
while (iter != end_iter && !nsCRT::IsAsciiSpace(*iter)) {
|
||||
while (iter != end_iter && !nsCRT::IsAsciiSpace(*iter)) {
|
||||
++iter;
|
||||
}
|
||||
aMinorTypeStart = start_iter;
|
||||
@ -842,7 +842,7 @@ nsOSHelperAppService::LookUpHandlerAndDescription(const nsAString& aMajorType,
|
||||
nsAString& aHandler,
|
||||
nsAString& aDescription,
|
||||
nsAString& aMozillaFlags) {
|
||||
|
||||
|
||||
// The mailcap lookup is two-pass to handle the case of mailcap files
|
||||
// that have something like:
|
||||
//
|
||||
@ -910,7 +910,7 @@ nsOSHelperAppService::DoLookUpHandlerAndDescription(const nsAString& aMajorType,
|
||||
"helpers.private_mailcap_file" : "helpers.global_mailcap_file";
|
||||
const char * filenameEnvVar = aUserData ?
|
||||
"PERSONAL_MAILCAP" : "MAILCAP";
|
||||
|
||||
|
||||
rv = GetFileLocation(filenamePref, filenameEnvVar, mailcapFileName);
|
||||
if (NS_SUCCEEDED(rv) && !mailcapFileName.IsEmpty()) {
|
||||
rv = GetHandlerAndDescriptionFromMailcapFile(mailcapFileName,
|
||||
@ -946,7 +946,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
bool more = false;
|
||||
|
||||
|
||||
nsCOMPtr<nsIFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
@ -1020,7 +1020,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
LOG(("The real handler is: '%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(Substring(start_iter,
|
||||
semicolon_iter)).get()));
|
||||
|
||||
|
||||
// XXX ugly hack. Just grab the executable name
|
||||
nsAString::const_iterator end_handler_iter = semicolon_iter;
|
||||
nsAString::const_iterator end_executable_iter = start_iter;
|
||||
@ -1029,9 +1029,9 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
++end_executable_iter;
|
||||
}
|
||||
// XXX End ugly hack
|
||||
|
||||
|
||||
aHandler = Substring(start_iter, end_executable_iter);
|
||||
|
||||
|
||||
nsAString::const_iterator start_option_iter, end_optionname_iter, equal_sign_iter;
|
||||
bool equalSignFound;
|
||||
while (match &&
|
||||
@ -1068,7 +1068,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
while (end_optionname_iter != equal_sign_iter &&
|
||||
!nsCRT::IsAsciiSpace(*end_optionname_iter)) {
|
||||
++end_optionname_iter;
|
||||
}
|
||||
}
|
||||
nsDependentSubstring optionName(start_option_iter, end_optionname_iter);
|
||||
if (equalSignFound) {
|
||||
// This is an option that has a name and value
|
||||
@ -1118,7 +1118,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (match) { // we did not fail any test clauses; all is good
|
||||
// get out of here
|
||||
@ -1133,7 +1133,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
|
||||
}
|
||||
// zero out the entry for the next cycle
|
||||
entry.Truncate();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!more) {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
@ -1186,7 +1186,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppP
|
||||
NS_WARNING("Empty filename passed in.");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
// first check if the base class implementation finds anything
|
||||
nsresult rv = nsExternalHelperAppService::GetFileTokenForPath(platformAppPath, aFile);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
@ -1203,7 +1203,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppP
|
||||
nsCOMPtr<nsIFile> localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
|
||||
|
||||
if (!localFile) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
bool exists = false;
|
||||
// ugly hack. Walk the PATH variable...
|
||||
char* unixpath = PR_GetEnv("PATH");
|
||||
@ -1238,7 +1238,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppP
|
||||
} else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
||||
*aFile = localFile;
|
||||
NS_IF_ADDREF(*aFile);
|
||||
|
||||
@ -1250,13 +1250,13 @@ nsOSHelperAppService::GetFromExtension(const nsCString& aFileExt) {
|
||||
// if the extension is empty, return immediately
|
||||
if (aFileExt.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
|
||||
LOG(("Here we do an extension lookup for '%s'\n", aFileExt.get()));
|
||||
|
||||
nsAutoString majorType, minorType,
|
||||
mime_types_description, mailcap_description,
|
||||
handler, mozillaFlags;
|
||||
|
||||
|
||||
nsresult rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt),
|
||||
majorType,
|
||||
minorType,
|
||||
@ -1264,7 +1264,7 @@ nsOSHelperAppService::GetFromExtension(const nsCString& aFileExt) {
|
||||
true);
|
||||
|
||||
if (NS_FAILED(rv) || majorType.IsEmpty()) {
|
||||
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
LOG(("Looking in GNOME registry\n"));
|
||||
nsRefPtr<nsMIMEInfoBase> gnomeInfo =
|
||||
@ -1281,7 +1281,7 @@ nsOSHelperAppService::GetFromExtension(const nsCString& aFileExt) {
|
||||
mime_types_description,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
@ -1300,7 +1300,7 @@ nsOSHelperAppService::GetFromExtension(const nsCString& aFileExt) {
|
||||
|
||||
nsAutoCString mimeType(asciiMajorType + NS_LITERAL_CSTRING("/") + asciiMinorType);
|
||||
nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix(mimeType);
|
||||
|
||||
|
||||
mimeInfo->AppendExtension(aFileExt);
|
||||
nsHashtable typeOptions; // empty hash table
|
||||
rv = LookUpHandlerAndDescription(majorType, minorType, typeOptions,
|
||||
@ -1321,11 +1321,11 @@ nsOSHelperAppService::GetFromExtension(const nsCString& aFileExt) {
|
||||
if (NS_SUCCEEDED(rv) && handler.IsEmpty()) {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIFile> handlerFile;
|
||||
rv = GetFileTokenForPath(handler.get(), getter_AddRefs(handlerFile));
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mimeInfo->SetDefaultApplication(handlerFile);
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
@ -1345,7 +1345,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
// if the type is empty, return immediately
|
||||
if (aMIMEType.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
|
||||
LOG(("Here we do a mimetype lookup for '%s'\n", aMIMEType.get()));
|
||||
|
||||
// extract the major and minor types
|
||||
@ -1358,7 +1358,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
mimeType.EndReading(end_iter);
|
||||
|
||||
// XXX FIXME: add typeOptions parsing in here
|
||||
nsHashtable typeOptions;
|
||||
nsHashtable typeOptions;
|
||||
nsresult rv = ParseMIMEType(start_iter, majorTypeStart, majorTypeEnd,
|
||||
minorTypeStart, minorTypeEnd, end_iter);
|
||||
|
||||
@ -1378,7 +1378,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
mailcap_description,
|
||||
mozillaFlags,
|
||||
true);
|
||||
|
||||
|
||||
LOG(("Private Handler/Description results: handler='%s', description='%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(handler).get(),
|
||||
NS_LossyConvertUTF16toASCII(mailcap_description).get()));
|
||||
@ -1389,7 +1389,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
// No useful data yet. Check the GNOME registry. Unfortunately, newer
|
||||
// GNOME versions no longer have type-to-extension mappings, so we might
|
||||
// get back a MIMEInfo without any extensions set. In that case we'll have
|
||||
// to look in our mime.types files for the extensions.
|
||||
// to look in our mime.types files for the extensions.
|
||||
LOG(("Looking in GNOME registry\n"));
|
||||
gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
|
||||
if (gnomeInfo && gnomeInfo->HasExtensions()) {
|
||||
@ -1445,13 +1445,13 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
mailcap_description,
|
||||
mozillaFlags,
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOG(("Handler/Description results: handler='%s', description='%s', mozillaFlags='%s'\n",
|
||||
NS_LossyConvertUTF16toASCII(handler).get(),
|
||||
NS_LossyConvertUTF16toASCII(mailcap_description).get(),
|
||||
NS_LossyConvertUTF16toASCII(mozillaFlags).get()));
|
||||
|
||||
|
||||
mailcap_description.Trim(" \t\"");
|
||||
mozillaFlags.Trim(" \t");
|
||||
|
||||
@ -1460,7 +1460,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
// No real useful info
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix(aMIMEType);
|
||||
|
||||
mimeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
|
||||
@ -1475,7 +1475,7 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) {
|
||||
if (!handler.IsEmpty()) {
|
||||
rv = GetFileTokenForPath(handler.get(), getter_AddRefs(handlerFile));
|
||||
}
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mimeInfo->SetDefaultApplication(handlerFile);
|
||||
mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
|
||||
@ -1519,12 +1519,12 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aType,
|
||||
if (!aFileExt.IsEmpty())
|
||||
retval->AppendExtension(aFileExt);
|
||||
}
|
||||
|
||||
|
||||
return retval.forget();
|
||||
}
|
||||
|
||||
// Copy the attributes of retval (mimeinfo from type) onto miByExt, to
|
||||
// return it
|
||||
// return it
|
||||
// but reset to just collected mDefaultAppDescription (from ext)
|
||||
nsAutoString byExtDefault;
|
||||
miByExt->GetDefaultDescription(byExtDefault);
|
||||
@ -1568,4 +1568,3 @@ nsOSHelperAppService::GetProtocolHandlerInfoFromOS(const nsACString &aScheme,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ public:
|
||||
nsresult OSProtocolHandlerExists(const char * aProtocolScheme, bool * aHandlerExists);
|
||||
NS_IMETHOD GetApplicationDescription(const nsACString& aScheme, nsAString& _retval);
|
||||
|
||||
// GetFileTokenForPath must be implemented by each platform.
|
||||
// platformAppPath --> a platform specific path to an application that we got out of the
|
||||
// GetFileTokenForPath must be implemented by each platform.
|
||||
// platformAppPath --> a platform specific path to an application that we got out of the
|
||||
// rdf data source. This can be a mac file spec, a unix path or a windows path depending on the platform
|
||||
// aFile --> an nsIFile representation of that platform application path.
|
||||
virtual nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile);
|
||||
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsMIMEInfoBase> GetFromType(const nsCString& aMimeType);
|
||||
already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsCString& aFileExt);
|
||||
@ -112,7 +112,7 @@ private:
|
||||
nsAString& aHandler,
|
||||
nsAString& aDescription,
|
||||
nsAString& aMozillaFlags);
|
||||
|
||||
|
||||
static nsresult DoLookUpHandlerAndDescription(const nsAString& aMajorType,
|
||||
const nsAString& aMinorType,
|
||||
nsHashtable& aTypeOptions,
|
||||
@ -120,7 +120,7 @@ private:
|
||||
nsAString& aDescription,
|
||||
nsAString& aMozillaFlags,
|
||||
bool aUserData);
|
||||
|
||||
|
||||
static nsresult GetHandlerAndDescriptionFromMailcapFile(const nsAString& aFilename,
|
||||
const nsAString& aMajorType,
|
||||
const nsAString& aMinorType,
|
||||
|
Loading…
Reference in New Issue
Block a user