1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
Index: mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp,v
retrieving revision 1.58.20.1
retrieving revision 1.58
diff -d -u -p -r1.58.20.1 -r1.58
--- mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp 16 Apr 2007 18:54:53 -0000 1.58.20.1
+++ mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp 25 Oct 2004 07:46:01 -0000 1.58
@@ -1506,8 +1506,13 @@ nsOSHelperAppService::GetFromType(const
nsDependentSubstring majorType(majorTypeStart, majorTypeEnd);
nsDependentSubstring minorType(minorTypeStart, minorTypeEnd);
+ nsAutoString extensions, mime_types_description;
+ LookUpExtensionsAndDescription(majorType,
+ minorType,
+ extensions,
+ mime_types_description);
+
- // First check the user's private mailcap file
nsAutoString mailcap_description, handler, mozillaFlags;
DoLookUpHandlerAndDescription(majorType,
minorType,
@@ -1516,46 +1521,23 @@ nsOSHelperAppService::GetFromType(const
mailcap_description,
mozillaFlags,
PR_TRUE);
-
- LOG(("Private Handler/Description results: handler='%s', description='%s'\n",
- NS_LossyConvertUTF16toASCII(handler).get(),
- NS_LossyConvertUTF16toASCII(mailcap_description).get()));
+
+ if (handler.IsEmpty() && extensions.IsEmpty() &&
+ mailcap_description.IsEmpty() && mime_types_description.IsEmpty()) {
+ // No useful data yet
+
#ifdef MOZ_WIDGET_GTK2
- nsMIMEInfoBase *gnomeInfo = nsnull;
- if (handler.IsEmpty()) {
- // 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.
LOG(("Looking in GNOME registry\n"));
- gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
- if (gnomeInfo && gnomeInfo->HasExtensions()) {
- LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n"));
+ nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType.get()).get();
+ if (gnomeInfo) {
+ LOG(("Got MIMEInfo from GNOME registry\n"));
return gnomeInfo;
}
- }
#endif
-
- // Now look up our extensions
- nsAutoString extensions, mime_types_description;
- LookUpExtensionsAndDescription(majorType,
- minorType,
- extensions,
- mime_types_description);
-
-#ifdef MOZ_WIDGET_GTK2
- if (gnomeInfo) {
- LOG(("Got MIMEInfo from GNOME registry without extensions; setting them "
- "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get()));
-
- NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
- gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
- return gnomeInfo;
}
-#endif
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
minorType,
typeOptions,
@@ -1565,7 +1547,7 @@ nsOSHelperAppService::GetFromType(const
PR_FALSE);
}
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
NS_LITERAL_STRING("*"),
typeOptions,
@@ -1575,7 +1557,7 @@ nsOSHelperAppService::GetFromType(const
PR_TRUE);
}
- if (handler.IsEmpty()) {
+ if (handler.IsEmpty() && mailcap_description.IsEmpty()) {
DoLookUpHandlerAndDescription(majorType,
NS_LITERAL_STRING("*"),
typeOptions,
|