diff -r 46868b4f4bfd -r f4f4388b26a8 firefox-shell-bmo624267.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/firefox-shell-bmo624267.patch Wed Jan 12 22:45:15 2011 +0100 @@ -0,0 +1,82 @@ +# HG changeset patch +# Parent 6c4a0e0acb3a071dbfde60e975f68f18c85bbff8 +# User timeless@mozdev.org +Bug 624267 Crash on Ubuntu [@ nsGNOMEShellService::SetDefaultBrowser ] +r=roc + +diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp +--- a/browser/components/shell/src/nsGNOMEShellService.cpp ++++ b/browser/components/shell/src/nsGNOMEShellService.cpp +@@ -214,30 +214,31 @@ nsGNOMEShellService::SetDefaultBrowser(P + #endif + + nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); +- +- nsCAutoString appKeyValue(mAppPath); +- appKeyValue.Append(" \"%s\""); +- unsigned int i; +- +- for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) { +- if (appProtocols[i].essential || aClaimAllTypes) { +- gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name), +- appKeyValue); ++ if (gconf) { ++ nsCAutoString appKeyValue(mAppPath); ++ appKeyValue.Append(" \"%s\""); ++ for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) { ++ if (appProtocols[i].essential || aClaimAllTypes) { ++ gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name), ++ appKeyValue); ++ } + } + } + + // set handler for .html and xhtml files and MIME types: + if (aClaimAllTypes) { ++ nsresult rv; + nsCOMPtr giovfs = +- do_GetService(NS_GIOSERVICE_CONTRACTID); ++ do_GetService(NS_GIOSERVICE_CONTRACTID, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr bundleService = +- do_GetService(NS_STRINGBUNDLE_CONTRACTID); +- NS_ENSURE_TRUE(bundleService, NS_ERROR_OUT_OF_MEMORY); ++ do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr brandBundle; +- bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle)); +- NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE); ++ rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle)); ++ NS_ENSURE_SUCCESS(rv, rv); + + nsString brandShortName, brandFullName; + brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(), +@@ -247,17 +248,16 @@ nsGNOMEShellService::SetDefaultBrowser(P + + // use brandShortName as the application id. + NS_ConvertUTF16toUTF8 id(brandShortName); +- if (giovfs) { +- nsCOMPtr appInfo; +- giovfs->CreateAppFromCommand(mAppPath, +- id, +- getter_AddRefs(appInfo)); ++ nsCOMPtr appInfo; ++ rv = giovfs->CreateAppFromCommand(mAppPath, ++ id, ++ getter_AddRefs(appInfo)); ++ NS_ENSURE_SUCCESS(rv, rv); + +- // Add mime types for html, xhtml extension and set app to just created appinfo. +- for (i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) { +- appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType)); +- appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions)); +- } ++ // Add mime types for html, xhtml extension and set app to just created appinfo. ++ for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) { ++ appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType)); ++ appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions)); + } + } +