Bug 455736: Getting an app cache should not EnsureContentViewer(). r+sr=bz

This commit is contained in:
Dave Camp 2008-09-28 16:42:18 -07:00
Родитель 968bf2248f
Коммит fa39c74867
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -460,8 +460,7 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
mContentViewer->GetDOMDocument((nsIDOMDocument **) aSink); mContentViewer->GetDOMDocument((nsIDOMDocument **) aSink);
return *aSink ? NS_OK : NS_NOINTERFACE; return *aSink ? NS_OK : NS_NOINTERFACE;
} }
else if (aIID.Equals(NS_GET_IID(nsIApplicationCacheContainer)) && else if (aIID.Equals(NS_GET_IID(nsIApplicationCacheContainer))) {
NS_SUCCEEDED(EnsureContentViewer())) {
*aSink = nsnull; *aSink = nsnull;
// Return the toplevel document as an // Return the toplevel document as an
@ -469,7 +468,17 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
nsCOMPtr<nsIDocShellTreeItem> rootItem; nsCOMPtr<nsIDocShellTreeItem> rootItem;
GetSameTypeRootTreeItem(getter_AddRefs(rootItem)); GetSameTypeRootTreeItem(getter_AddRefs(rootItem));
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootItem); nsCOMPtr<nsIDocShell> rootDocShell = do_QueryInterface(rootItem);
if (!rootDocShell)
return NS_ERROR_NO_INTERFACE;
nsCOMPtr<nsIContentViewer> contentViewer;
rootDocShell->GetContentViewer(getter_AddRefs(contentViewer));
if (!contentViewer)
return NS_ERROR_NO_INTERFACE;
nsCOMPtr<nsIDOMDocument> domDoc;
contentViewer->GetDOMDocument(getter_AddRefs(domDoc));
NS_ASSERTION(domDoc, "Should have a document."); NS_ASSERTION(domDoc, "Should have a document.");
if (!domDoc) if (!domDoc)
return NS_ERROR_NO_INTERFACE; return NS_ERROR_NO_INTERFACE;