diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 9312ae7474c..bb4268fa9fe 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -366,6 +366,7 @@ public: NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0; NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0; + NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup) = 0; NS_IMETHOD AddReference(void *aKey, nsISupports *aReference) = 0; NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference) = 0; diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 913bb0c6e81..6ef113d8910 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -242,6 +242,7 @@ public: NS_IMETHOD GetArena(nsIArena** aArena); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); + NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup); NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index fcddcf5964a..cf9e2de2103 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -324,6 +324,25 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return result; } + return BaseResetToURI(aURL); +} + + +NS_IMETHODIMP +nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup) +{ + nsresult result = nsDocument::ResetToURI(aURI, aLoadGroup); + if (NS_SUCCEEDED(result)) + result = BaseResetToURI(aURI); + return result; +} + + +nsresult +nsHTMLDocument::BaseResetToURI(nsIURI *aURL) +{ + nsresult result = NS_OK; + InvalidateHashTables(); PrePopulateHashTables(); @@ -376,6 +395,7 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return result; } + NS_IMETHODIMP nsHTMLDocument::CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -3728,12 +3748,13 @@ nsHTMLDocument::RemoveDocWriteDummyRequest(void) rv = GetDocumentLoadGroup(getter_AddRefs(loadGroup)); if (NS_FAILED(rv)) return rv; + // note there can be a write request without a load group if + // this is a synchronously constructed about:blank document if (loadGroup && mDocWriteDummyRequest) { rv = loadGroup->RemoveRequest(mDocWriteDummyRequest, nsnull, NS_OK); if (NS_FAILED(rv)) return rv; - - mDocWriteDummyRequest = nsnull; } + mDocWriteDummyRequest = nsnull; return rv; } diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 194d8beaffa..cd54fce33a6 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -63,6 +63,7 @@ class nsIHTMLStyleSheet; class nsIHTMLCSSStyleSheet; class nsIParser; class nsICSSLoader; +class nsIURI; class nsHTMLDocument : public nsMarkupDocument, public nsIHTMLDocument, @@ -80,6 +81,7 @@ public: NS_IMETHOD_(nsrefcnt) Release(void); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); + NS_IMETHOD ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup); NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -215,6 +217,8 @@ protected: nsresult AddDocWriteDummyRequest(void); nsresult RemoveDocWriteDummyRequest(void); + nsresult BaseResetToURI(nsIURI* aURI); + nsIHTMLStyleSheet* mAttrStyleSheet; nsIHTMLCSSStyleSheet* mStyleAttrStyleSheet; nsIURI* mBaseURL; diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index d1380a76442..4dd6b41b787 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -637,6 +637,13 @@ nsXULDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP +nsXULDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup) +{ + NS_NOTREACHED("ResetToURI"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP nsXULDocument::GetArena(nsIArena** aArena) { diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index f904c98330d..9061cd856cb 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -143,6 +143,7 @@ public: NS_IMETHOD GetArena(nsIArena** aArena); NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup); + NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup); NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel *channel,