~ubuntu-branches/ubuntu/feisty/firefox/feisty-security

« back to all changes in this revision

Viewing changes to uriloader/exthandler/beos/nsOSHelperAppService.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2007-10-19 01:09:21 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20071019010921-8sglgxbi6kj1pemg
Tags: 2.0.0.8+1nobinonly-0ubuntu1
* New security/stability upstream release (v2.0.0.8)
* MFSA 2007-29 aka CVE-2007-5339 (browser), CVE-2007-5340 (javascript)
* MFSA 2007-30 aka CVE-2007-1095
* MFSA 2007-31 aka CVE-2007-2292
* MFSA 2007-32 aka CVE-2007-3511, CVE-2006-2894
* MFSA 2007-33 aka CVE-2007-5334
* MFSA 2007-34 aka CVE-2007-5337
* MFSA 2007-35 aka CVE-2007-5338
* MFSA 2007-36 aka CVE-2007-4841 (windows only)

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
                // Get the Spec
107
107
                nsCAutoString spec;
108
108
                aURL->GetSpec(spec);
109
 
                char* arg[1];
110
 
                arg[0] = (char *) spec.get();
 
109
                const char* args[] = { spec.get() };
111
110
                
112
111
                //Launch the app                
113
112
                BMimeType protocol;
117
116
                        if(protocol.IsInstalled())
118
117
                        {
119
118
                                isInstalled = true;     
120
 
                                be_roster->Launch(protoStr.String(), 1, arg);
 
119
                                be_roster->Launch(protoStr.String(), NS_ARRAY_LENGTH(args), (char **)args);
121
120
                        }
122
121
                }
123
122
                if ((!isInstalled) && (!strcmp("mailto", scheme.get())))
124
 
                        be_roster->Launch("text/x-email", 1, arg);
 
123
                        be_roster->Launch("text/x-email", NS_ARRAY_LENGTH(args), (char **)args);
125
124
        }
126
125
        return rv;
127
126
}
214
213
 
215
214
        LOG(("Here we do an extension lookup for '%s'\n", aFileExt));
216
215
 
217
 
        BString fileExtToUse(aFileExt);
218
 
        if (fileExtToUse.ByteAt(0) != '.')
219
 
                fileExtToUse.Prepend(".");
220
 
 
221
 
 
222
 
        BMessage mimeData;
223
 
        BMessage extData;
224
 
        BMimeType mimeType;
225
 
        int32 mimeIndex = 0;
226
 
        int32 extIndex = 0;
227
 
        bool found = false;
228
 
        BString mimeStr;
229
 
        BString extStr;
230
 
        // Get a list of all registered MIME types
231
 
        if (BMimeType::GetInstalledTypes(&mimeData) == B_OK) {
232
 
                // check to see if the given MIME type is registerred
233
 
                while (!found && mimeData.FindString("types",mimeIndex,&mimeStr) == B_OK) {
234
 
                        if ((mimeType.SetTo(mimeStr.String()) == B_OK) &&
235
 
                                (mimeType.GetFileExtensions(&extData) == B_OK)) {
236
 
                                extIndex = 0;
237
 
                                while (!found && extData.FindString("extensions",extIndex,&extStr) == B_OK) {
238
 
                                        if (extStr.ByteAt(0) != '.')
239
 
                                                extStr.Prepend(".");
240
 
                                        if (fileExtToUse.ICompare(extStr) == 0)
241
 
                                                found = true;
242
 
                                        else
243
 
                                                extIndex++;
244
 
                                }
245
 
                        }
246
 
                        mimeIndex++;
247
 
                }
248
 
                if (found) {
249
 
                        return SetMIMEInfoForType(mimeStr.String(), _retval);
250
 
                }
251
 
        }
252
 
 
 
216
        BMimeType mimeType, tmpType;
 
217
 
 
218
        if( B_OK == mimeType.GuessMimeType(aFileExt, &tmpType))
 
219
                return SetMIMEInfoForType(tmpType.Type(), _retval);
 
220
        
253
221
        // Extension not found
254
222
        return NS_ERROR_FAILURE;
255
223
}
261
229
                return NS_ERROR_INVALID_ARG;
262
230
 
263
231
        LOG(("Here we do a mimetype lookup for '%s'\n", aMIMEType));
264
 
 
265
 
        BMessage data;
266
 
        int32 index = 0;
267
 
        bool found = false;
268
 
        BString strData;
269
 
        // Get a list of all registerred MIME types
270
 
        if (BMimeType::GetInstalledTypes(&data) == B_OK) {
271
 
                // check to see if the given MIME type is registerred
272
 
                while (!found && data.FindString("types",index,&strData) == B_OK) {
273
 
                        if (strData == aMIMEType)
274
 
                                found = true;
275
 
                        else
276
 
                                index++;
277
 
                }
278
 
                if (found) {
279
 
                        return SetMIMEInfoForType(aMIMEType, _retval);
280
 
                }
281
 
        }
282
 
 
 
232
        
 
233
        BMimeType mimeType(aMIMEType);
 
234
        if (mimeType.IsInstalled())
 
235
                return SetMIMEInfoForType(aMIMEType, _retval);
 
236
        
283
237
        return NS_ERROR_FAILURE;
284
238
}
285
239