diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index a508a493eb8b..144a85ac6b41 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -4393,8 +4393,12 @@ nsDocShell::CreateAboutBlankContentViewer() nsCOMPtr catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID)); if (!catMan) return NS_ERROR_FAILURE; + nsXPIDLCString contractId; - catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html", getter_Copies(contractId)); + rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html", getter_Copies(contractId)); + if (NS_FAILED(rv)) + return rv; + nsCOMPtr docFactory(do_GetService(contractId)); if (docFactory) { @@ -4533,8 +4537,11 @@ nsDocShell::NewContentViewerObj(const char *aContentType, nsCOMPtr catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; + nsXPIDLCString contractId; - catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, getter_Copies(contractId)); + rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, getter_Copies(contractId)); + if (NS_FAILED(rv)) + return rv; // Create an instance of the document-loader-factory nsCOMPtr @@ -4551,8 +4558,11 @@ nsDocShell::NewContentViewerObj(const char *aContentType, if (NS_ERROR_PLUGINS_PLUGINSNOTCHANGED == pluginManager->ReloadPlugins(PR_FALSE)) return NS_ERROR_FAILURE; - catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, + rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, getter_Copies(contractId)); + if (NS_FAILED(rv)) + return rv; + docLoaderFactory = do_GetService(contractId.get()); if (!docLoaderFactory)