Bug 569644 - Query the plugin host directly when searching for MIME types, rather than using Gecko-Content-Viewer category manager registration, r=bz

This commit is contained in:
Benjamin Smedberg
2010-06-10 12:42:16 -04:00
parent 20cccc67ea
commit aee583b4ff
12 changed files with 163 additions and 169 deletions

View File

@@ -49,6 +49,7 @@
#include "nsIBrowserDOMWindow.h"
#include "nsIComponentManager.h"
#include "nsIContent.h"
#include "nsIContentUtils.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
@@ -6187,17 +6188,11 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// too, of course.
mFiredUnloadEvent = PR_FALSE;
// one helper factory, please
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
if (!catMan)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIContentUtils> cutils = do_GetService("@mozilla.org/content/contentutils;1");
if (!cutils)
return NS_ERROR_FAILURE;
nsXPIDLCString contractId;
rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html", getter_Copies(contractId));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIDocumentLoaderFactory> docFactory(do_GetService(contractId));
nsCOMPtr<nsIDocumentLoaderFactory> docFactory = cutils->FindInternalContentViewer("text/html");
if (docFactory) {
// generate (about:blank) document to load
docFactory->CreateBlankDocument(mLoadGroup, aPrincipal,
@@ -7177,19 +7172,13 @@ nsDocShell::NewContentViewerObj(const char *aContentType,
{
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
nsresult rv;
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
nsXPIDLCString contractId;
rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, getter_Copies(contractId));
// Create an instance of the document-loader-factory
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory;
if (NS_SUCCEEDED(rv))
docLoaderFactory = do_GetService(contractId.get());
nsCOMPtr<nsIContentUtils> cutils = do_GetService("@mozilla.org/content/contentutils;1");
if (!cutils) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
cutils->FindInternalContentViewer(aContentType);
if (!docLoaderFactory) {
return NS_ERROR_FAILURE;
}