diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index e43fd034447..0b0d27c1c03 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -104,7 +104,6 @@ #include "nsIHttpChannel.h" #include "nsCPrefetchService.h" -#include "nsIWebShell.h" #include "nsIDocShell.h" #include "nsIWebNavigation.h" #include "nsIDocument.h" @@ -237,7 +236,7 @@ public: NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW - nsresult Init(nsIDocument* aDoc, nsIURI* aURL, nsIWebShell* aContainer, + nsresult Init(nsIDocument* aDoc, nsIURI* aURL, nsISupports* aContainer, nsIChannel* aChannel); // nsISupports @@ -311,7 +310,7 @@ public: PRBool aNotify = PR_FALSE); nsresult CreateContentObject(const nsIParserNode& aNode, nsHTMLTag aNodeType, nsIDOMHTMLFormElement* aForm, - nsIWebShell* aWebShell, + nsIDocShell* aDocShell, nsIHTMLContent** aResult); inline PRInt32 GetNotificationInterval() @@ -345,7 +344,7 @@ public: nsCOMPtr mNodeInfoManager; nsIURI* mDocumentURI; nsIURI* mDocumentBaseURL; - nsIWebShell* mWebShell; + nsCOMPtr mDocShell; nsIParser* mParser; // back off timer notification after count @@ -900,7 +899,7 @@ SetForm(nsIHTMLContent* aContent, nsIDOMHTMLFormElement* aForm) static nsresult MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo, - nsIDOMHTMLFormElement* aForm, nsIWebShell* aWebShell, + nsIDOMHTMLFormElement* aForm, nsIDocShell* aDocShell, nsIHTMLContent** aResult, PRBool aInsideNoXXXTag, PRBool aFromParser); @@ -911,7 +910,7 @@ nsresult HTMLContentSink::CreateContentObject(const nsIParserNode& aNode, nsHTMLTag aNodeType, nsIDOMHTMLFormElement* aForm, - nsIWebShell* aWebShell, + nsIDocShell* aDocShell, nsIHTMLContent** aResult) { nsresult rv = NS_OK; @@ -954,7 +953,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode, } // Make the content object - rv = MakeContentObject(aNodeType, nodeInfo, aForm, aWebShell, aResult, + rv = MakeContentObject(aNodeType, nodeInfo, aForm, aDocShell, aResult, !!mInsideNoXXXTag, PR_TRUE); if (aNodeType == eHTMLTag_textarea && !mSkippedContent.IsEmpty()) { @@ -1111,7 +1110,7 @@ nsHTMLElementFactory::CreateInstanceByTag(nsINodeInfo *aNodeInfo, // XXX compare switch statement against nsHTMLTags.h's list nsresult MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo, - nsIDOMHTMLFormElement* aForm, nsIWebShell* aWebShell, + nsIDOMHTMLFormElement* aForm, nsIDocShell* aDocShell, nsIHTMLContent** aResult, PRBool aInsideNoXXXTag, PRBool aFromParser) { @@ -1567,7 +1566,7 @@ SinkContext::OpenContainer(const nsIParserNode& aNode) nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); nsIHTMLContent* content; rv = mSink->CreateContentObject(aNode, nodeType, mSink->mCurrentForm, - mSink->mFrameset ? mSink->mWebShell : nsnull, + mSink->mFrameset ? mSink->mDocShell : nsnull, &content); NS_ENSURE_SUCCESS(rv, rv); @@ -1804,7 +1803,7 @@ SinkContext::AddLeaf(const nsIParserNode& aNode) nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); nsCOMPtr content; rv = mSink->CreateContentObject(aNode, nodeType, - mSink->mCurrentForm, mSink->mWebShell, + mSink->mCurrentForm, mSink->mDocShell, getter_AddRefs(content)); NS_ENSURE_SUCCESS(rv, rv); @@ -2257,7 +2256,7 @@ nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, nsIDocument* aDoc, nsIURI* aURL, - nsIWebShell* aWebShell, + nsISupports* aContainer, nsIChannel* aChannel) { NS_ENSURE_ARG_POINTER(aResult); @@ -2269,7 +2268,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, return NS_ERROR_OUT_OF_MEMORY; } - nsresult rv = it->Init(aDoc, aURL, aWebShell, aChannel); + nsresult rv = it->Init(aDoc, aURL, aContainer, aChannel); if (NS_FAILED(rv)) { delete it; @@ -2309,7 +2308,6 @@ HTMLContentSink::~HTMLContentSink() NS_IF_RELEASE(mHTMLDocument); NS_IF_RELEASE(mDocumentURI); NS_IF_RELEASE(mDocumentBaseURL); - NS_IF_RELEASE(mWebShell); NS_IF_RELEASE(mParser); NS_IF_RELEASE(mCSSLoader); @@ -2365,7 +2363,7 @@ NS_IMPL_ISUPPORTS6(HTMLContentSink, #endif static PRBool -IsScriptEnabled(nsIDocument *aDoc, nsIWebShell *aContainer) +IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer) { NS_ENSURE_TRUE(aDoc && aContainer, PR_TRUE); @@ -2406,7 +2404,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIWebShell *aContainer) nsresult HTMLContentSink::Init(nsIDocument* aDoc, nsIURI* aURL, - nsIWebShell* aContainer, + nsISupports* aContainer, nsIChannel* aChannel) { MOZ_TIMER_DEBUGLOG(("Reset and start: nsHTMLContentSink::Init(), this=%p\n", @@ -2441,8 +2439,7 @@ HTMLContentSink::Init(nsIDocument* aDoc, NS_ADDREF(aURL); mDocumentBaseURL = aURL; NS_ADDREF(aURL); - mWebShell = aContainer; - NS_ADDREF(aContainer); + mDocShell = do_QueryInterface(aContainer); mObservers = nsnull; @@ -2459,18 +2456,19 @@ HTMLContentSink::Init(nsIDocument* aDoc, NS_ENSURE_SUCCESS(rv, rv); loader->AddObserver(this); - PRBool enabled = PR_TRUE; - nsCOMPtr docShell(do_QueryInterface(mWebShell)); - NS_ASSERTION(docShell, "oops no docshell!"); - if (docShell) { - docShell->GetAllowSubframes(&enabled); - if (enabled) { + NS_WARN_IF_FALSE(mDocShell, "oops no docshell!"); + + // Find out if subframes are enabled + if (mDocShell) { + PRBool subFramesEnabled = PR_TRUE; + mDocShell->GetAllowSubframes(&subFramesEnabled); + if (subFramesEnabled) { mFlags |= NS_SINK_FLAG_FRAMES_ENABLED; } } // Find out if scripts are enabled, if not, show