зеркало из https://github.com/mozilla/pjs.git
Changed references to nsIContentViewerContainer to nsISupports in the march to get rid of nsIContentViewerContainer. r=pavlov
This commit is contained in:
Родитель
59ee64277a
Коммит
4465f2b8b2
|
@ -953,7 +953,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
}
|
||||
|
||||
// Set the webshell as the default IContentViewerContainer for the loader...
|
||||
mDocLoader->SetContainer(this);
|
||||
mDocLoader->SetContainer(NS_STATIC_CAST(nsIContentViewerContainer*, this));
|
||||
|
||||
//Register ourselves as an observer for the new doc loader
|
||||
mDocLoader->AddObserver((nsIDocumentLoaderObserver*)this);
|
||||
|
@ -1858,7 +1858,7 @@ nsWebShell::SetDocument(nsIDOMDocument *aDOMDoc, nsIDOMElement *aRootNode)
|
|||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
NS_ENSURE_SUCCESS(docFactory->CreateInstanceForDocument(this,
|
||||
NS_ENSURE_SUCCESS(docFactory->CreateInstanceForDocument(NS_STATIC_CAST(nsIContentViewerContainer*, this),
|
||||
doc,
|
||||
"view",
|
||||
getter_AddRefs(documentViewer)),
|
||||
|
@ -2130,7 +2130,7 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
*/
|
||||
rv = mDocLoader->LoadDocument(aUri, // URL string
|
||||
aCommand, // Command
|
||||
this, // Container
|
||||
NS_STATIC_CAST(nsIContentViewerContainer*, this),// Container
|
||||
aPostDataStream, // Post Data
|
||||
nsnull, // Extra Info...
|
||||
aType, // reload type
|
||||
|
|
|
@ -222,43 +222,29 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
nsIDocumentLoaderObserver * aObserver)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIContentViewerContainer *cont = nsnull;
|
||||
nsIWebShell *ws = nsnull;
|
||||
|
||||
if (aLoader == nsnull) {
|
||||
return rv;
|
||||
}
|
||||
rv = aLoader->GetContainer(&cont);
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
rv = aLoader->GetContainer(getter_AddRefs(cont));
|
||||
if (NS_FAILED(rv) || (cont == nsnull)) {
|
||||
return rv;
|
||||
}
|
||||
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
|
||||
if (NS_FAILED(rv) || (ws == nsnull)) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIContentViewer* cv = nsnull;
|
||||
rv = ws->GetContentViewer(&cv);
|
||||
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
|
||||
NS_ENSURE_TRUE(ws, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
rv = ws->GetContentViewer(getter_AddRefs(cv));
|
||||
if (NS_FAILED(rv) || (cv == nsnull)) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIDocumentViewer* docViewer = nsnull;
|
||||
rv = cv->QueryInterface(nsIDocumentViewer::GetIID(), (void**) &docViewer);
|
||||
if (NS_FAILED(rv) || (docViewer == nsnull)) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(cv));
|
||||
NS_ENSURE_TRUE(docViewer, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
rv = docViewer->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || (doc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -279,25 +265,15 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
NS_IF_RELEASE(docURL);
|
||||
nsCRT::free(spec);
|
||||
|
||||
nsIDOMHTMLDocument *htmldoc = nsnull;
|
||||
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, (void**)&htmldoc);
|
||||
if (NS_FAILED(rv) || (htmldoc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmldoc(do_QueryInterface(doc));
|
||||
if (htmldoc == nsnull) {
|
||||
PR_Free(URLName);
|
||||
return rv;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIDOMHTMLCollection* forms = nsnull;
|
||||
rv = htmldoc->GetForms(&forms);
|
||||
nsCOMPtr<nsIDOMHTMLCollection> forms;
|
||||
rv = htmldoc->GetForms(getter_AddRefs(forms));
|
||||
if (NS_FAILED(rv) || (forms == nsnull)) {
|
||||
NS_RELEASE(htmldoc);
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
PR_Free(URLName);
|
||||
return rv;
|
||||
}
|
||||
|
@ -305,25 +281,22 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
PRUint32 numForms;
|
||||
forms->GetLength(&numForms);
|
||||
for (PRUint32 formX = 0; formX < numForms; formX++) {
|
||||
nsIDOMNode* formNode = nsnull;
|
||||
forms->Item(formX, &formNode);
|
||||
nsCOMPtr<nsIDOMNode> formNode;
|
||||
forms->Item(formX, getter_AddRefs(formNode));
|
||||
if (nsnull != formNode) {
|
||||
nsIDOMHTMLFormElement* formElement = nsnull;
|
||||
rv = formNode->QueryInterface(kIDOMHTMLFormElementIID, (void**)&formElement);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != formElement)) {
|
||||
nsIDOMHTMLCollection* elements = nsnull;
|
||||
rv = formElement->GetElements(&elements);
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(formNode));
|
||||
if ((nsnull != formElement)) {
|
||||
nsCOMPtr<nsIDOMHTMLCollection> elements;
|
||||
rv = formElement->GetElements(getter_AddRefs(elements));
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != elements)) {
|
||||
/* got to the form elements at long last */
|
||||
PRUint32 numElements;
|
||||
elements->GetLength(&numElements);
|
||||
for (PRUint32 elementX = 0; elementX < numElements; elementX++) {
|
||||
nsIDOMNode* elementNode = nsnull;
|
||||
elements->Item(elementX, &elementNode);
|
||||
nsCOMPtr<nsIDOMNode> elementNode;
|
||||
elements->Item(elementX, getter_AddRefs(elementNode));
|
||||
if (nsnull != elementNode) {
|
||||
nsIDOMHTMLInputElement *inputElement = nsnull;
|
||||
rv = elementNode->QueryInterface
|
||||
(nsIDOMHTMLInputElement::GetIID(), (void**)&inputElement);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||
nsAutoString type("");
|
||||
rv = inputElement->GetType(type);
|
||||
|
@ -347,25 +320,14 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(inputElement);
|
||||
}
|
||||
NS_RELEASE(elementNode);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(elements);
|
||||
}
|
||||
NS_RELEASE(formElement);
|
||||
}
|
||||
NS_RELEASE(formNode);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(forms);
|
||||
NS_RELEASE(htmldoc);
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
PR_Free(URLName);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsIXULContentSink.h"
|
||||
#include "nsIStreamLoadableDocument.h"
|
||||
#include "nsIDocStreamLoaderFactory.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
|
||||
// Factory code for creating variations on html documents
|
||||
|
||||
|
@ -120,12 +121,12 @@ public:
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
||||
NS_IMETHOD CreateInstanceForDocument(nsIContentViewerContainer* aContainer,
|
||||
NS_IMETHOD CreateInstanceForDocument(nsISupports* aContainer,
|
||||
nsIDocument* aDocument,
|
||||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult);
|
||||
|
@ -134,7 +135,7 @@ public:
|
|||
NS_METHOD CreateInstance(nsIInputStream& aInputStream,
|
||||
const char* aContentType,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
||||
|
@ -143,7 +144,7 @@ public:
|
|||
nsresult CreateDocument(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
const nsCID& aDocumentCID,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
@ -152,14 +153,14 @@ public:
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
||||
nsresult CreateXULDocumentFromStream(nsIInputStream& aXULStream,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
||||
|
@ -225,7 +226,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand,
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
|
@ -293,7 +294,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutDLF::CreateInstanceForDocument(nsIContentViewerContainer* aContainer,
|
||||
nsLayoutDLF::CreateInstanceForDocument(nsISupports* aContainer,
|
||||
nsIDocument* aDocument,
|
||||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
|
@ -321,7 +322,7 @@ nsresult
|
|||
nsLayoutDLF::CreateDocument(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
const nsCID& aDocumentCID,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
|
@ -360,7 +361,8 @@ nsLayoutDLF::CreateDocument(const char* aCommand,
|
|||
// Initialize the document to begin loading the data. An
|
||||
// nsIStreamListener connected to the parser is returned in
|
||||
// aDocListener.
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener);
|
||||
nsCOMPtr<nsIContentViewerContainer> container(do_QueryInterface(aContainer));
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, container, aDocListener);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
|
@ -377,7 +379,7 @@ NS_IMETHODIMP
|
|||
nsLayoutDLF::CreateInstance(nsIInputStream& aInputStream,
|
||||
const char* aContentType,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIContentViewer** aDocViewer)
|
||||
|
||||
|
@ -429,7 +431,7 @@ nsLayoutDLF::CreateRDFDocument(const char* aCommand,
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
|
@ -451,7 +453,8 @@ nsLayoutDLF::CreateRDFDocument(const char* aCommand,
|
|||
* An nsIStreamListener connected to the parser is returned in
|
||||
* aDocListener.
|
||||
*/
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener);
|
||||
nsCOMPtr<nsIContentViewerContainer> container(do_QueryInterface(aContainer));
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, container, aDocListener);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
/*
|
||||
* Bind the document to the Content Viewer...
|
||||
|
@ -467,7 +470,7 @@ nsLayoutDLF::CreateRDFDocument(const char* aCommand,
|
|||
nsresult
|
||||
nsLayoutDLF::CreateXULDocumentFromStream(nsIInputStream& aXULStream,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIContentViewer** aDocViewer)
|
||||
{
|
||||
|
@ -490,7 +493,8 @@ nsLayoutDLF::CreateXULDocumentFromStream(nsIInputStream& aXULStream,
|
|||
if ( NS_FAILED(status) )
|
||||
break;
|
||||
|
||||
status = loader->LoadFromStream(aXULStream, aContainer, aCommand);
|
||||
nsCOMPtr<nsIContentViewerContainer> container(do_QueryInterface(aContainer));
|
||||
status = loader->LoadFromStream(aXULStream, container, aCommand);
|
||||
}
|
||||
while (0);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
nsresult Init(nsDocLoaderImpl* aDocLoader,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -158,9 +158,9 @@ protected:
|
|||
|
||||
protected:
|
||||
char* m_Command;
|
||||
nsIContentViewerContainer* m_Container;
|
||||
nsISupports* m_ExtraInfo;
|
||||
nsIStreamListener* m_NextStream;
|
||||
nsCOMPtr<nsISupports> m_Container;
|
||||
nsCOMPtr<nsISupports> m_ExtraInfo;
|
||||
nsCOMPtr<nsIStreamListener> m_NextStream;
|
||||
nsDocLoaderImpl* m_DocLoader;
|
||||
};
|
||||
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
// nsIDocumentLoader interface
|
||||
NS_IMETHOD LoadDocument(nsIURI * aUri,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsIInputStream* aPostDataStream = nsnull,
|
||||
nsISupports* aExtraInfo = nsnull,
|
||||
nsLoadFlags aType = nsIChannel::LOAD_NORMAL,
|
||||
|
@ -211,8 +211,8 @@ public:
|
|||
NS_IMETHOD AddObserver(nsIDocumentLoaderObserver *aObserver);
|
||||
NS_IMETHOD RemoveObserver(nsIDocumentLoaderObserver *aObserver);
|
||||
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer** aResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aResult);
|
||||
NS_IMETHOD GetContentViewerContainer(PRUint32 aDocumentID,
|
||||
nsIContentViewerContainer** aResult);
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup** aResult);
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
nsresult CreateContentViewer(const char *aCommand,
|
||||
nsIChannel* channel,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
@ -274,7 +274,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIChannel> mDocumentChannel; // [OWNER] ???compare with document
|
||||
nsVoidArray mDocObservers;
|
||||
nsIContentViewerContainer* mContainer; // [WEAK] it owns me!
|
||||
nsISupports* mContainer; // [WEAK] it owns me!
|
||||
|
||||
nsDocLoaderImpl* mParent; // [OWNER] but upside down ownership model
|
||||
// needs to be fixed***
|
||||
|
@ -426,7 +426,7 @@ nsresult
|
|||
nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
||||
nsIChannel* channel,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListenerResult,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
|
@ -452,11 +452,13 @@ nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> container(do_QueryInterface(aContainer));
|
||||
|
||||
// Now create an instance of the content viewer
|
||||
rv = factory->CreateInstance(aCommand,
|
||||
channel, mLoadGroup,
|
||||
aContentType,
|
||||
aContainer,
|
||||
container,
|
||||
aExtraInfo, aDocListenerResult,
|
||||
aDocViewerResult);
|
||||
NS_RELEASE(factory);
|
||||
|
@ -466,7 +468,7 @@ nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
|||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::LoadDocument(nsIURI * aUri,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsISupports* aExtraInfo,
|
||||
nsLoadFlags aType,
|
||||
|
@ -611,7 +613,7 @@ nsDocLoaderImpl::RemoveObserver(nsIDocumentLoaderObserver* aObserver)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
nsDocLoaderImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
// This is a weak reference...
|
||||
mContainer = aContainer;
|
||||
|
@ -620,17 +622,14 @@ nsDocLoaderImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::GetContainer(nsIContentViewerContainer** aResult)
|
||||
nsDocLoaderImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
if (nsnull == aResult) {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
} else {
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
return rv;
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -957,29 +956,23 @@ nsDocumentBindInfo::nsDocumentBindInfo()
|
|||
NS_INIT_REFCNT();
|
||||
|
||||
m_Command = nsnull;
|
||||
m_Container = nsnull;
|
||||
m_ExtraInfo = nsnull;
|
||||
m_NextStream = nsnull;
|
||||
m_DocLoader = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocumentBindInfo::Init(nsDocLoaderImpl* aDocLoader,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo)
|
||||
{
|
||||
m_NextStream = nsnull;
|
||||
m_Command = (nsnull != aCommand) ? PL_strdup(aCommand) : nsnull;
|
||||
|
||||
m_DocLoader = aDocLoader;
|
||||
NS_ADDREF(m_DocLoader);
|
||||
|
||||
m_Container = aContainer;
|
||||
NS_IF_ADDREF(m_Container);
|
||||
m_Container = aContainer; // This does an addref
|
||||
|
||||
m_ExtraInfo = aExtraInfo;
|
||||
NS_IF_ADDREF(m_ExtraInfo);
|
||||
m_ExtraInfo = aExtraInfo; // This does an addref
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -992,9 +985,6 @@ nsDocumentBindInfo::~nsDocumentBindInfo()
|
|||
m_Command = nsnull;
|
||||
|
||||
NS_RELEASE (m_DocLoader);
|
||||
NS_IF_RELEASE(m_NextStream);
|
||||
NS_IF_RELEASE(m_Container);
|
||||
NS_IF_RELEASE(m_ExtraInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1138,7 +1128,7 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
aContentType,
|
||||
m_Container,
|
||||
m_ExtraInfo,
|
||||
&m_NextStream,
|
||||
getter_AddRefs(m_NextStream),
|
||||
&viewer);
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
@ -1146,9 +1136,11 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("DocLoaderFactory: Unable to create ContentViewer for command=%s, content-type=%s\n", m_Command ? m_Command : "(null)", aContentType);
|
||||
if ( m_Container ) {
|
||||
nsCOMPtr<nsIContentViewerContainer>
|
||||
cvContainer(do_QueryInterface(m_Container));
|
||||
if ( cvContainer ) {
|
||||
// Give content container a chance to do something with this URL.
|
||||
rv = m_Container->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command );
|
||||
rv = cvContainer->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command );
|
||||
}
|
||||
// Stop the binding.
|
||||
// This crashes on Unix/Mac... Stop();
|
||||
|
@ -1158,10 +1150,12 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
/*
|
||||
* Give the document container the new viewer...
|
||||
*/
|
||||
if (m_Container) {
|
||||
nsCOMPtr<nsIContentViewerContainer>
|
||||
cvContainer(do_QueryInterface(m_Container));
|
||||
if (cvContainer) {
|
||||
viewer->SetContainer(m_Container);
|
||||
|
||||
rv = m_Container->Embed(viewer, m_Command, m_ExtraInfo);
|
||||
rv = cvContainer->Embed(viewer, m_Command, m_ExtraInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
goto done;
|
||||
}
|
||||
|
@ -1213,11 +1207,9 @@ NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIChannel* channel, nsISupports *
|
|||
* Currently this can happen if javascript loads a new URL
|
||||
* (via nsIWebShell::LoadURL) during the parse phase...
|
||||
*/
|
||||
nsIStreamListener* listener = m_NextStream;
|
||||
nsCOMPtr<nsIStreamListener> listener(m_NextStream);
|
||||
|
||||
NS_ADDREF(listener);
|
||||
rv = listener->OnDataAvailable(channel, ctxt, aStream, sourceOffset, aLength);
|
||||
NS_RELEASE(listener);
|
||||
} else {
|
||||
rv = NS_BINDING_FAILED;
|
||||
}
|
||||
|
@ -1261,7 +1253,7 @@ NS_METHOD nsDocumentBindInfo::OnStopRequest(nsIChannel* channel, nsISupports *ct
|
|||
rv = m_NextStream->OnStopRequest(channel, ctxt, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(m_NextStream);
|
||||
m_NextStream = nsnull; // Release our stream we are holding
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
class nsIInputStream;
|
||||
class nsIContentViewer;
|
||||
class nsIContentViewerContainer;
|
||||
|
||||
/* 9188bc80-f92e-11d2-81ef-0060083a0bcf */
|
||||
#define NS_IDOCSTREAMLOADERFACTORY_IID \
|
||||
|
@ -44,7 +43,7 @@ public:
|
|||
NS_IMETHOD CreateInstance(nsIInputStream& aInputStream,
|
||||
const char* aContentType,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIContentViewer** aDocViewer) = 0;
|
||||
};
|
||||
|
|
|
@ -70,12 +70,12 @@ public:
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListenerResult,
|
||||
nsIContentViewer** aDocViewerResult) = 0;
|
||||
|
||||
NS_IMETHOD CreateInstanceForDocument(nsIContentViewerContainer* aContainer,
|
||||
NS_IMETHOD CreateInstanceForDocument(nsISupports* aContainer,
|
||||
nsIDocument* aDocument,
|
||||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult) = 0;
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
NS_IMETHOD LoadDocument(nsIURI * aUri,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsIInputStream* aPostDataStream = nsnull,
|
||||
nsISupports* aExtraInfo = nsnull,
|
||||
nsLoadFlags aType = nsIChannel::LOAD_NORMAL,
|
||||
|
@ -121,9 +121,9 @@ public:
|
|||
|
||||
NS_IMETHOD RemoveObserver(nsIDocumentLoaderObserver *aObserver) = 0;
|
||||
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer) = 0;
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer) = 0;
|
||||
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer** aResult) = 0;
|
||||
NS_IMETHOD GetContainer(nsISupports** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetContentViewerContainer(PRUint32 aDocumentID, nsIContentViewerContainer** aResult) = 0;
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
nsresult Init(nsDocLoaderImpl* aDocLoader,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -158,9 +158,9 @@ protected:
|
|||
|
||||
protected:
|
||||
char* m_Command;
|
||||
nsIContentViewerContainer* m_Container;
|
||||
nsISupports* m_ExtraInfo;
|
||||
nsIStreamListener* m_NextStream;
|
||||
nsCOMPtr<nsISupports> m_Container;
|
||||
nsCOMPtr<nsISupports> m_ExtraInfo;
|
||||
nsCOMPtr<nsIStreamListener> m_NextStream;
|
||||
nsDocLoaderImpl* m_DocLoader;
|
||||
};
|
||||
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
// nsIDocumentLoader interface
|
||||
NS_IMETHOD LoadDocument(nsIURI * aUri,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsIInputStream* aPostDataStream = nsnull,
|
||||
nsISupports* aExtraInfo = nsnull,
|
||||
nsLoadFlags aType = nsIChannel::LOAD_NORMAL,
|
||||
|
@ -211,8 +211,8 @@ public:
|
|||
NS_IMETHOD AddObserver(nsIDocumentLoaderObserver *aObserver);
|
||||
NS_IMETHOD RemoveObserver(nsIDocumentLoaderObserver *aObserver);
|
||||
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer** aResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aResult);
|
||||
NS_IMETHOD GetContentViewerContainer(PRUint32 aDocumentID,
|
||||
nsIContentViewerContainer** aResult);
|
||||
NS_IMETHOD GetLoadGroup(nsILoadGroup** aResult);
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
nsresult CreateContentViewer(const char *aCommand,
|
||||
nsIChannel* channel,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer);
|
||||
|
@ -274,7 +274,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIChannel> mDocumentChannel; // [OWNER] ???compare with document
|
||||
nsVoidArray mDocObservers;
|
||||
nsIContentViewerContainer* mContainer; // [WEAK] it owns me!
|
||||
nsISupports* mContainer; // [WEAK] it owns me!
|
||||
|
||||
nsDocLoaderImpl* mParent; // [OWNER] but upside down ownership model
|
||||
// needs to be fixed***
|
||||
|
@ -426,7 +426,7 @@ nsresult
|
|||
nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
||||
nsIChannel* channel,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListenerResult,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
|
@ -452,11 +452,13 @@ nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> container(do_QueryInterface(aContainer));
|
||||
|
||||
// Now create an instance of the content viewer
|
||||
rv = factory->CreateInstance(aCommand,
|
||||
channel, mLoadGroup,
|
||||
aContentType,
|
||||
aContainer,
|
||||
container,
|
||||
aExtraInfo, aDocListenerResult,
|
||||
aDocViewerResult);
|
||||
NS_RELEASE(factory);
|
||||
|
@ -466,7 +468,7 @@ nsDocLoaderImpl::CreateContentViewer(const char *aCommand,
|
|||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::LoadDocument(nsIURI * aUri,
|
||||
const char* aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsISupports* aExtraInfo,
|
||||
nsLoadFlags aType,
|
||||
|
@ -611,7 +613,7 @@ nsDocLoaderImpl::RemoveObserver(nsIDocumentLoaderObserver* aObserver)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
nsDocLoaderImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
// This is a weak reference...
|
||||
mContainer = aContainer;
|
||||
|
@ -620,17 +622,14 @@ nsDocLoaderImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocLoaderImpl::GetContainer(nsIContentViewerContainer** aResult)
|
||||
nsDocLoaderImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
if (nsnull == aResult) {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
} else {
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
return rv;
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -957,29 +956,23 @@ nsDocumentBindInfo::nsDocumentBindInfo()
|
|||
NS_INIT_REFCNT();
|
||||
|
||||
m_Command = nsnull;
|
||||
m_Container = nsnull;
|
||||
m_ExtraInfo = nsnull;
|
||||
m_NextStream = nsnull;
|
||||
m_DocLoader = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocumentBindInfo::Init(nsDocLoaderImpl* aDocLoader,
|
||||
const char *aCommand,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo)
|
||||
{
|
||||
m_NextStream = nsnull;
|
||||
m_Command = (nsnull != aCommand) ? PL_strdup(aCommand) : nsnull;
|
||||
|
||||
m_DocLoader = aDocLoader;
|
||||
NS_ADDREF(m_DocLoader);
|
||||
|
||||
m_Container = aContainer;
|
||||
NS_IF_ADDREF(m_Container);
|
||||
m_Container = aContainer; // This does an addref
|
||||
|
||||
m_ExtraInfo = aExtraInfo;
|
||||
NS_IF_ADDREF(m_ExtraInfo);
|
||||
m_ExtraInfo = aExtraInfo; // This does an addref
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -992,9 +985,6 @@ nsDocumentBindInfo::~nsDocumentBindInfo()
|
|||
m_Command = nsnull;
|
||||
|
||||
NS_RELEASE (m_DocLoader);
|
||||
NS_IF_RELEASE(m_NextStream);
|
||||
NS_IF_RELEASE(m_Container);
|
||||
NS_IF_RELEASE(m_ExtraInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1138,7 +1128,7 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
aContentType,
|
||||
m_Container,
|
||||
m_ExtraInfo,
|
||||
&m_NextStream,
|
||||
getter_AddRefs(m_NextStream),
|
||||
&viewer);
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
@ -1146,9 +1136,11 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("DocLoaderFactory: Unable to create ContentViewer for command=%s, content-type=%s\n", m_Command ? m_Command : "(null)", aContentType);
|
||||
if ( m_Container ) {
|
||||
nsCOMPtr<nsIContentViewerContainer>
|
||||
cvContainer(do_QueryInterface(m_Container));
|
||||
if ( cvContainer ) {
|
||||
// Give content container a chance to do something with this URL.
|
||||
rv = m_Container->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command );
|
||||
rv = cvContainer->HandleUnknownContentType( (nsIDocumentLoader*) m_DocLoader, channel, aContentType, m_Command );
|
||||
}
|
||||
// Stop the binding.
|
||||
// This crashes on Unix/Mac... Stop();
|
||||
|
@ -1158,10 +1150,12 @@ nsDocumentBindInfo::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
|||
/*
|
||||
* Give the document container the new viewer...
|
||||
*/
|
||||
if (m_Container) {
|
||||
nsCOMPtr<nsIContentViewerContainer>
|
||||
cvContainer(do_QueryInterface(m_Container));
|
||||
if (cvContainer) {
|
||||
viewer->SetContainer(m_Container);
|
||||
|
||||
rv = m_Container->Embed(viewer, m_Command, m_ExtraInfo);
|
||||
rv = cvContainer->Embed(viewer, m_Command, m_ExtraInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
goto done;
|
||||
}
|
||||
|
@ -1213,11 +1207,9 @@ NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIChannel* channel, nsISupports *
|
|||
* Currently this can happen if javascript loads a new URL
|
||||
* (via nsIWebShell::LoadURL) during the parse phase...
|
||||
*/
|
||||
nsIStreamListener* listener = m_NextStream;
|
||||
nsCOMPtr<nsIStreamListener> listener(m_NextStream);
|
||||
|
||||
NS_ADDREF(listener);
|
||||
rv = listener->OnDataAvailable(channel, ctxt, aStream, sourceOffset, aLength);
|
||||
NS_RELEASE(listener);
|
||||
} else {
|
||||
rv = NS_BINDING_FAILED;
|
||||
}
|
||||
|
@ -1261,7 +1253,7 @@ NS_METHOD nsDocumentBindInfo::OnStopRequest(nsIChannel* channel, nsISupports *ct
|
|||
rv = m_NextStream->OnStopRequest(channel, ctxt, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(m_NextStream);
|
||||
m_NextStream = nsnull; // Release our stream we are holding
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -953,7 +953,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
}
|
||||
|
||||
// Set the webshell as the default IContentViewerContainer for the loader...
|
||||
mDocLoader->SetContainer(this);
|
||||
mDocLoader->SetContainer(NS_STATIC_CAST(nsIContentViewerContainer*, this));
|
||||
|
||||
//Register ourselves as an observer for the new doc loader
|
||||
mDocLoader->AddObserver((nsIDocumentLoaderObserver*)this);
|
||||
|
@ -1858,7 +1858,7 @@ nsWebShell::SetDocument(nsIDOMDocument *aDOMDoc, nsIDOMElement *aRootNode)
|
|||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
NS_ENSURE_SUCCESS(docFactory->CreateInstanceForDocument(this,
|
||||
NS_ENSURE_SUCCESS(docFactory->CreateInstanceForDocument(NS_STATIC_CAST(nsIContentViewerContainer*, this),
|
||||
doc,
|
||||
"view",
|
||||
getter_AddRefs(documentViewer)),
|
||||
|
@ -2130,7 +2130,7 @@ nsWebShell::DoLoadURL(nsIURI * aUri,
|
|||
*/
|
||||
rv = mDocLoader->LoadDocument(aUri, // URL string
|
||||
aCommand, // Command
|
||||
this, // Container
|
||||
NS_STATIC_CAST(nsIContentViewerContainer*, this),// Container
|
||||
aPostDataStream, // Post Data
|
||||
nsnull, // Extra Info...
|
||||
aType, // reload type
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
@ -373,20 +372,10 @@ NS_METHOD nsMenuItem::DoCommand()
|
|||
if(!mWebShell || !mDOMElement)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
//g_print("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
//g_print("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
@ -442,20 +441,9 @@ NS_METHOD nsMenuItem::DoCommand()
|
|||
if(!mWebShell || !mDOMElement)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
//g_print("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
//g_print("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -413,18 +413,9 @@ NS_METHOD nsMenuItem::DoCommand()
|
|||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
|
|
@ -290,18 +290,9 @@ nsresult nsMenuItem::DoCommand()
|
|||
// code copied from windows
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "nsIPopUpMenu.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -502,18 +501,9 @@ NS_METHOD nsMenuItem::DoCommand()
|
|||
if(!mWebShell || !mDOMElement)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsQEventHandler.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
@ -384,22 +383,9 @@ NS_METHOD nsMenuItem::DoCommand()
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer)
|
||||
{
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
//g_print("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer))))
|
||||
{
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
//g_print("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -349,18 +349,9 @@ NS_IMETHODIMP nsMenuItem::DoCommand()
|
|||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -965,18 +965,12 @@ void nsWebShellWindow::DynamicLoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aP
|
|||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
// do a resize
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return;
|
||||
}
|
||||
if( NS_FAILED(mWebShell->GetContentViewer(getter_AddRefs(contentViewer))))
|
||||
{
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "Error Getting contentViewer");
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
@ -1205,18 +1199,9 @@ nsWebShellWindow::GetPresShell(nsIPresShell** aPresShell)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -133,18 +133,9 @@ NS_IMETHODIMP nsXULCommand::DoCommand()
|
|||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> contentViewerContainer;
|
||||
contentViewerContainer = do_QueryInterface(mWebShell);
|
||||
if (!contentViewerContainer) {
|
||||
NS_ERROR("Webshell doesn't support the content viewer container interface");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
if (NS_FAILED(rv = contentViewerContainer->GetContentViewer(getter_AddRefs(contentViewer)))) {
|
||||
NS_ERROR("Unable to retrieve content viewer.");
|
||||
return rv;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(mWebShell->GetContentViewer(getter_AddRefs(contentViewer)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer;
|
||||
docViewer = do_QueryInterface(contentViewer);
|
||||
|
|
|
@ -1401,19 +1401,17 @@ nsBrowserAppCore::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL,
|
|||
|
||||
// Check if this notification is for a frame
|
||||
PRBool isFrame=PR_FALSE;
|
||||
nsIContentViewerContainer * container=nsnull;
|
||||
aLoader->GetContainer(&container);
|
||||
nsCOMPtr<nsISupports> container;
|
||||
aLoader->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(container));
|
||||
if (ws) {
|
||||
nsIWebShell * parent=nsnull;
|
||||
ws->GetParent(parent);
|
||||
nsCOMPtr<nsIWebShell> parent;
|
||||
ws->GetParent(*getter_AddRefs(parent));
|
||||
if (parent)
|
||||
isFrame = PR_TRUE;
|
||||
NS_IF_RELEASE(parent);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(container);
|
||||
|
||||
if (!isFrame) {
|
||||
nsAutoString kStartDocumentLoad("StartDocumentLoad");
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsNeckoUtil.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
@ -947,12 +946,12 @@ public:
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListenerResult,
|
||||
nsIContentViewer** aDocViewerResult);
|
||||
|
||||
NS_IMETHOD CreateInstanceForDocument(nsIContentViewerContainer* aContainer,
|
||||
NS_IMETHOD CreateInstanceForDocument(nsISupports* aContainer,
|
||||
nsIDocument* aDocument,
|
||||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult);
|
||||
|
@ -1027,7 +1026,7 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
|
|||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
const char* aContentType,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsISupports* aContainer,
|
||||
nsISupports* aExtraInfo,
|
||||
nsIStreamListener** aDocListenerResult,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
|
@ -1086,7 +1085,7 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryViewerFactory::CreateInstanceForDocument(nsIContentViewerContainer* aContainer,
|
||||
nsDirectoryViewerFactory::CreateInstanceForDocument(nsISupports* aContainer,
|
||||
nsIDocument* aDocument,
|
||||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
|
|
Загрузка…
Ссылка в новой задаче