From 1122c69800af3a20145f8282c0aefe97d5fdaca6 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Mon, 19 Apr 2010 17:40:15 +0200 Subject: [PATCH] Part 1 of fix for bug 560273 (Stop using DOM tearoffs from quickstubs) - add nsINode::GetBaseURI. r=sicking. --HG-- extra : rebase_source : 5a07f12d9d13d92b796fd5f2cb182b069c3f87bf --- content/base/public/nsIContent.h | 10 ----- content/base/public/nsIDocument.h | 9 ++++- content/base/public/nsINode.h | 13 +++++++ content/base/src/nsContentSink.cpp | 4 +- content/base/src/nsContentUtils.cpp | 3 +- content/base/src/nsDOMAttribute.cpp | 17 ++++++--- content/base/src/nsDOMAttribute.h | 1 + content/base/src/nsDOMParser.cpp | 2 +- content/base/src/nsDocument.cpp | 13 ++----- content/base/src/nsGenericDOMDataNode.cpp | 24 +----------- content/base/src/nsGenericDOMDataNode.h | 1 - content/base/src/nsGenericElement.cpp | 38 ++++++++----------- .../canvas/src/nsCanvasRenderingContext2D.cpp | 2 +- content/events/src/nsXMLEventsManager.cpp | 2 +- .../html/content/src/nsGenericHTMLElement.cpp | 2 +- content/html/document/src/nsHTMLDocument.cpp | 20 ---------- content/html/document/src/nsHTMLDocument.h | 3 -- content/xbl/src/nsXBLService.cpp | 2 +- content/xml/content/src/nsXMLStylesheetPI.cpp | 4 +- content/xml/document/src/nsXMLContentSink.cpp | 2 +- content/xml/document/src/nsXMLDocument.cpp | 2 +- content/xslt/src/base/txURIUtils.cpp | 2 +- content/xslt/src/xslt/txMozillaXMLOutput.cpp | 2 +- docshell/base/nsDocShell.cpp | 2 +- dom/base/nsGlobalWindow.cpp | 4 +- dom/base/nsLocation.cpp | 2 +- dom/src/threads/nsDOMWorkerScriptLoader.cpp | 2 +- .../windowwatcher/src/nsWindowWatcher.cpp | 2 +- layout/forms/nsIsIndexFrame.cpp | 2 +- layout/generic/nsObjectFrame.cpp | 2 +- modules/plugin/base/src/nsPluginHost.cpp | 4 +- parser/html/nsHtml5TreeOpExecutor.cpp | 2 +- parser/htmlparser/src/nsParser.cpp | 2 +- 33 files changed, 82 insertions(+), 120 deletions(-) diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 9e29acbf2e5..f1909066833 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -637,16 +637,6 @@ public: */ nsIContent *GetFlattenedTreeParent() const; - /** - * Get the base URI for any relative URIs within this piece of - * content. Generally, this is the document's base URI, but certain - * content carries a local base for backward compatibility, and XML - * supports setting a per-node base URI. - * - * @return the base URI - */ - virtual already_AddRefed GetBaseURI() const = 0; - /** * API to check if this is a link that's traversed in response to user input * (e.g. a click event). Specializations for HTML/SVG/generic XML allow for diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 575653406bf..9bc792c3c04 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -241,10 +241,17 @@ public: * unless it's overridden by SetBaseURI, HTML tags, etc.). The * returned URI could be null if there is no document URI. */ - nsIURI* GetBaseURI() const + nsIURI* GetDocBaseURI() const { return mDocumentBaseURI ? mDocumentBaseURI : mDocumentURI; } + virtual already_AddRefed GetBaseURI() const + { + nsCOMPtr uri = GetDocBaseURI(); + + return uri.forget(); + } + virtual nsresult SetBaseURI(nsIURI* aURI) = 0; /** diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 05983a2196e..ac3d9c78d17 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -955,6 +955,19 @@ public: NS_NOTREACHED("SetScriptTypeID not implemented"); return NS_ERROR_NOT_IMPLEMENTED; } + + /** + * Get the base URI for any relative URIs within this piece of + * content. Generally, this is the document's base URI, but certain + * content carries a local base for backward compatibility, and XML + * supports setting a per-node base URI. + * + * @return the base URI + */ + virtual already_AddRefed GetBaseURI() const = 0; + + void GetBaseURI(nsAString &aURI) const; + protected: // Override this function to create a custom slots class. diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index c94f9352382..0445a46754a 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -801,7 +801,7 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement, nsCOMPtr url; nsresult rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, - mDocument->GetBaseURI()); + mDocument->GetDocBaseURI()); if (NS_FAILED(rv)) { // The URI is bad, move along, don't propagate the error (for now) @@ -910,7 +910,7 @@ nsContentSink::PrefetchHref(const nsAString &aHref, nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), aHref, charset.IsEmpty() ? nsnull : PromiseFlatCString(charset).get(), - mDocument->GetBaseURI()); + mDocument->GetDocBaseURI()); if (uri) { nsCOMPtr domNode = do_QueryInterface(aSource); prefetchService->PrefetchURI(uri, mDocumentURI, domNode, aExplicit); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 928d711b4b8..cb5af197dbc 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -908,7 +908,8 @@ nsContentUtils::GetOfflineAppManifest(nsIDocument *aDocument, nsIURI **aURI) } nsContentUtils::NewURIWithDocumentCharset(aURI, manifestSpec, - aDocument, aDocument->GetBaseURI()); + aDocument, + aDocument->GetDocBaseURI()); } /* static */ diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index 9052703592f..4e04bd91dce 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -503,15 +503,20 @@ nsDOMAttribute::IsSupported(const nsAString& aFeature, aFeature, aVersion, aReturn); } +already_AddRefed +nsDOMAttribute::GetBaseURI() const +{ + nsINode *parent = GetContentInternal(); + + return parent ? parent->GetBaseURI() : nsnull; +} + NS_IMETHODIMP nsDOMAttribute::GetBaseURI(nsAString &aURI) { - aURI.Truncate(); - nsresult rv = NS_OK; - nsCOMPtr node(do_QueryInterface(GetContentInternal())); - if (node) - rv = node->GetBaseURI(aURI); - return rv; + nsINode::GetBaseURI(aURI); + + return NS_OK; } NS_IMETHODIMP diff --git a/content/base/src/nsDOMAttribute.h b/content/base/src/nsDOMAttribute.h index b5f8c9ee30a..f71577382dc 100644 --- a/content/base/src/nsDOMAttribute.h +++ b/content/base/src/nsDOMAttribute.h @@ -115,6 +115,7 @@ public: return nsContentUtils::GetContextForEventHandlers(this, aRv); } virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + virtual already_AddRefed GetBaseURI() const; static void Initialize(); static void Shutdown(); diff --git a/content/base/src/nsDOMParser.cpp b/content/base/src/nsDOMParser.cpp index cf5a25bcca2..f8e724ed8e5 100644 --- a/content/base/src/nsDOMParser.cpp +++ b/content/base/src/nsDOMParser.cpp @@ -498,7 +498,7 @@ nsDOMParser::Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj, return NS_ERROR_UNEXPECTED; } - baseURI = doc->GetBaseURI(); + baseURI = doc->GetDocBaseURI(); documentURI = doc->GetDocumentURI(); } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 2b53b2c5570..1a005244a76 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2298,9 +2298,9 @@ nsDocument::StopDocumentLoad() void nsDocument::SetDocumentURI(nsIURI* aURI) { - nsCOMPtr oldBase = nsIDocument::GetBaseURI(); + nsCOMPtr oldBase = GetDocBaseURI(); mDocumentURI = NS_TryToMakeImmutable(aURI); - nsIURI* newBase = nsIDocument::GetBaseURI(); + nsIURI* newBase = GetDocBaseURI(); PRBool equalBases = PR_FALSE; if (oldBase && newBase) { @@ -4804,7 +4804,7 @@ nsDocument::LoadBindingDocument(const nsAString& aURI) nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI, mCharacterSet.get(), - static_cast(this)->GetBaseURI()); + GetDocBaseURI()); NS_ENSURE_SUCCESS(rv, rv); // Figure out the right principal to use @@ -5721,12 +5721,7 @@ nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion, NS_IMETHODIMP nsDocument::GetBaseURI(nsAString &aURI) { - nsCAutoString spec; - if (nsIDocument::GetBaseURI()) { - nsIDocument::GetBaseURI()->GetSpec(spec); - } - - CopyUTF8toUTF16(spec, aURI); + nsINode::GetBaseURI(aURI); return NS_OK; } diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index f93b7f99b47..0eff4b581e0 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -202,21 +202,6 @@ nsGenericDOMDataNode::IsSupported(const nsAString& aFeature, aFeature, aVersion, aReturn); } -nsresult -nsGenericDOMDataNode::GetBaseURI(nsAString& aURI) -{ - nsCOMPtr baseURI = GetBaseURI(); - nsCAutoString spec; - - if (baseURI) { - baseURI->GetSpec(spec); - } - - CopyUTF8toUTF16(spec, aURI); - - return NS_OK; -} - nsresult nsGenericDOMDataNode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix) @@ -830,16 +815,9 @@ nsGenericDOMDataNode::GetBaseURI() const return parent->GetBaseURI(); } - nsIURI *uri; nsIDocument *doc = GetOwnerDoc(); - if (doc) { - NS_IF_ADDREF(uri = doc->GetBaseURI()); - } - else { - uri = nsnull; - } - return uri; + return doc ? doc->GetBaseURI() : nsnull; } PRBool diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 38cb684f269..7db6373e113 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -133,7 +133,6 @@ public: nsresult IsSupported(const nsAString& aFeature, const nsAString& aVersion, PRBool* aReturn); - nsresult GetBaseURI(nsAString& aURI); nsresult LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix); diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index d66dd63bf41..6fea9283bb2 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -588,6 +588,19 @@ nsINode::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) return rv; } +void +nsINode::GetBaseURI(nsAString &aURI) const +{ + nsCOMPtr baseURI = GetBaseURI(); + + nsCAutoString spec; + if (baseURI) { + baseURI->GetSpec(spec); + } + + CopyUTF8toUTF16(spec, aURI); +} + //---------------------------------------------------------------------- PRInt32 @@ -749,14 +762,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff) NS_IMETHODIMP nsNode3Tearoff::GetBaseURI(nsAString& aURI) { - nsCOMPtr baseURI = mContent->GetBaseURI(); - nsCAutoString spec; - - if (baseURI) { - baseURI->GetSpec(spec); - } - - CopyUTF8toUTF16(spec, aURI); + mContent->GetBaseURI(aURI); return NS_OK; } @@ -3210,10 +3216,7 @@ nsGenericElement::GetBaseURI() const GetAttr(kNameSpaceID_XML, nsGkAtoms::base, value); if (value.IsEmpty()) { // No xml:base, so we just use the parent's base URL - nsIURI *base = nsnull; - parentBase.swap(base); - - return base; + return parentBase.forget(); } nsCOMPtr ourBase; @@ -3226,16 +3229,7 @@ nsGenericElement::GetBaseURI() const nsIScriptSecurityManager::STANDARD); } - nsIURI *base; - if (NS_FAILED(rv)) { - base = parentBase; - } else { - base = ourBase; - } - - NS_IF_ADDREF(base); - - return base; + return NS_SUCCEEDED(rv) ? ourBase.forget() : parentBase.forget(); } PRBool diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 5c5dca4e9fc..974cfce74f6 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -1969,7 +1969,7 @@ CreateFontStyleRule(const nsAString& aFont, nsIPrincipal* principal = aNode->NodePrincipal(); nsIDocument* document = aNode->GetOwnerDoc(); nsIURI* docURL = document->GetDocumentURI(); - nsIURI* baseURL = document->GetBaseURI(); + nsIURI* baseURL = document->GetDocBaseURI(); nsresult rv = parser.ParseStyleAttribute(styleAttr, docURL, baseURL, principal, aResult); diff --git a/content/events/src/nsXMLEventsManager.cpp b/content/events/src/nsXMLEventsManager.cpp index ddd97b9b782..c45b083a7ef 100644 --- a/content/events/src/nsXMLEventsManager.cpp +++ b/content/events/src/nsXMLEventsManager.cpp @@ -77,7 +77,7 @@ PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument, nsCOMPtr handlerURI; PRBool equals = PR_FALSE; nsIURI *docURI = aDocument->GetDocumentURI(); - nsIURI *baseURI = aDocument->GetBaseURI(); + nsIURI *baseURI = aDocument->GetDocBaseURI(); rv = NS_NewURI( getter_AddRefs(handlerURI), handlerURIStr, nsnull, baseURI); if (NS_SUCCEEDED(rv)) { nsCOMPtr handlerURL(do_QueryInterface(handlerURI)); diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 51a8e6030c6..1487bbcc936 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1869,7 +1869,7 @@ nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes, nsIDocument* doc = presContext->Document(); nsCOMPtr uri; nsresult rv = nsContentUtils::NewURIWithDocumentCharset( - getter_AddRefs(uri), spec, doc, doc->GetBaseURI()); + getter_AddRefs(uri), spec, doc, doc->GetDocBaseURI()); if (NS_SUCCEEDED(rv)) { // Note that this should generally succeed here, due to the way // |spec| is created. Maybe we should just add an nsStringBuffer diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 0f7f312ae4c..fc3baee5948 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1395,26 +1395,6 @@ nsHTMLDocument::GetElementsByTagName(const nsAString& aTagname, return nsDocument::GetElementsByTagName(tmp, aReturn); } -NS_IMETHODIMP -nsHTMLDocument::GetBaseURI(nsAString &aURI) -{ - aURI.Truncate(); - nsIURI *uri = mDocumentBaseURI; // WEAK - - if (!uri) { - uri = mDocumentURI; - } - - if (uri) { - nsCAutoString spec; - uri->GetSpec(spec); - - CopyUTF8toUTF16(spec, aURI); - } - - return NS_OK; -} - // nsIDOM3Document interface implementation NS_IMETHODIMP nsHTMLDocument::GetXmlEncoding(nsAString& aXmlEncoding) diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 0fbb4f79f4b..05c0c5903d0 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -138,9 +138,6 @@ public: // nsIDOMNode interface NS_FORWARD_NSIDOMNODE(nsDocument::) - // nsIDOM3Node interface - NS_IMETHOD GetBaseURI(nsAString& aBaseURI); - // nsIDOMHTMLDocument interface NS_IMETHOD GetTitle(nsAString & aTitle); NS_IMETHOD SetTitle(const nsAString & aTitle); diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index a1d6da870e3..27cbb4f0ef9 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -1001,7 +1001,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI, nsCOMPtr bindingURI; rv = NS_NewURI(getter_AddRefs(bindingURI), value, doc->GetDocumentCharacterSet().get(), - doc->GetBaseURI()); + doc->GetDocBaseURI()); NS_ENSURE_SUCCESS(rv, rv); PRUint32 count = aDontExtendURIs.Length(); diff --git a/content/xml/content/src/nsXMLStylesheetPI.cpp b/content/xml/content/src/nsXMLStylesheetPI.cpp index 79e73bc3525..4ef0ac68002 100644 --- a/content/xml/content/src/nsXMLStylesheetPI.cpp +++ b/content/xml/content/src/nsXMLStylesheetPI.cpp @@ -180,7 +180,9 @@ nsXMLStylesheetPI::GetStyleSheetURL(PRBool* aIsInline) nsCAutoString charset; nsIDocument *document = GetOwnerDoc(); if (document) { - baseURL = mOverriddenBaseURI ? mOverriddenBaseURI.get() : document->GetBaseURI(); + baseURL = mOverriddenBaseURI ? + mOverriddenBaseURI.get() : + document->GetDocBaseURI(); charset = document->GetDocumentCharacterSet(); } else { baseURL = mOverriddenBaseURI; diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index 7667c23989f..171798fdde3 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -751,7 +751,7 @@ nsXMLContentSink::ProcessStyleLink(nsIContent* aElement, nsCOMPtr url; rv = NS_NewURI(getter_AddRefs(url), aHref, nsnull, - mDocument->GetBaseURI()); + mDocument->GetDocBaseURI()); NS_ENSURE_SUCCESS(rv, rv); // Do security check diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index c50e7b6276f..52d8dff6b12 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -341,7 +341,7 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) nsCAutoString charset; if (callingDoc) { - baseURI = callingDoc->GetBaseURI(); + baseURI = callingDoc->GetDocBaseURI(); charset = callingDoc->GetDocumentCharacterSet(); } diff --git a/content/xslt/src/base/txURIUtils.cpp b/content/xslt/src/base/txURIUtils.cpp index b12c61ff7f8..d43e317f9ea 100644 --- a/content/xslt/src/base/txURIUtils.cpp +++ b/content/xslt/src/base/txURIUtils.cpp @@ -238,7 +238,7 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode) } aNewDoc->Reset(channel, loadGroup); aNewDoc->SetPrincipal(sourcePrincipal); - aNewDoc->SetBaseURI(sourceDoc->GetBaseURI()); + aNewDoc->SetBaseURI(sourceDoc->GetDocBaseURI()); // Copy charset aNewDoc->SetDocumentCharacterSetSource( diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index 774fd51ea42..e69cac80eb4 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -265,7 +265,7 @@ txMozillaXMLOutput::endDocument(nsresult aResult) nsCOMPtr refURI = do_QueryInterface(win->GetDocShell()); if (refURI) { - refURI->SetupRefreshURIFromHeader(mDocument->GetBaseURI(), + refURI->SetupRefreshURIFromHeader(mDocument->GetDocBaseURI(), mRefreshString); } } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 3a6d38a5f24..5c08e393e62 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9254,7 +9254,7 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle, else { // 2a: Resolve aURL relative to mURI - nsIURI* docBaseURI = document->GetBaseURI(); + nsIURI* docBaseURI = document->GetDocBaseURI(); if (!docBaseURI) return NS_ERROR_FAILURE; diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index fae7564ab2a..866a73e8b25 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -5177,7 +5177,7 @@ nsGlobalWindow::FireAbuseEvents(PRBool aBlocked, PRBool aWindow, contextWindow->GetDocument(getter_AddRefs(domdoc)); nsCOMPtr doc(do_QueryInterface(domdoc)); if (doc) - baseURL = doc->GetBaseURI(); + baseURL = doc->GetDocBaseURI(); // use the base URI to build what would have been the popup's URI nsCOMPtr ios(do_GetService(NS_IOSERVICE_CONTRACTID)); @@ -8986,7 +8986,7 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI, sourceWindow->GetDocument(getter_AddRefs(domDoc)); nsCOMPtr doc(do_QueryInterface(domDoc)); if (doc) { - baseURI = doc->GetBaseURI(); + baseURI = doc->GetDocBaseURI(); charset = doc->GetDocumentCharacterSet(); } } diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index a8a5a146d5b..2d45520be51 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -921,7 +921,7 @@ nsLocation::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL) nsCOMPtr doc; nsresult rv = GetSourceDocument(cx, getter_AddRefs(doc)); if (doc) { - NS_IF_ADDREF(*sourceURL = doc->GetBaseURI()); + *sourceURL = doc->GetBaseURI().get(); } else { *sourceURL = nsnull; } diff --git a/dom/src/threads/nsDOMWorkerScriptLoader.cpp b/dom/src/threads/nsDOMWorkerScriptLoader.cpp index f99a2771bc6..2867db5ad4d 100644 --- a/dom/src/threads/nsDOMWorkerScriptLoader.cpp +++ b/dom/src/threads/nsDOMWorkerScriptLoader.cpp @@ -434,7 +434,7 @@ nsDOMWorkerScriptLoader::RunInternal() principal = parentDoc->NodePrincipal(); NS_ENSURE_STATE(principal); - baseURI = parentDoc->GetBaseURI(); + baseURI = parentDoc->GetDocBaseURI(); } } else { diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 99ed6a358ad..d3dcc0725b1 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1387,7 +1387,7 @@ nsWindowWatcher::URIfromURL(const char *aURL, nsCOMPtr doc; doc = do_QueryInterface(domDoc); if (doc) { - baseURI = doc->GetBaseURI(); + baseURI = doc->GetDocBaseURI(); } } } diff --git a/layout/forms/nsIsIndexFrame.cpp b/layout/forms/nsIsIndexFrame.cpp index c05119d1eac..519f2417e0c 100644 --- a/layout/forms/nsIsIndexFrame.cpp +++ b/layout/forms/nsIsIndexFrame.cpp @@ -357,7 +357,7 @@ nsIsIndexFrame::OnSubmit(nsPresContext* aPresContext) if (!document) return NS_OK; // No doc means don't submit, see Bug 28988 // Resolve url to an absolute url - nsIURI *baseURI = document->GetBaseURI(); + nsIURI *baseURI = document->GetDocBaseURI(); if (!baseURI) { NS_ERROR("No Base URL found in Form Submit!\n"); return NS_OK; // No base URL -> exit early, see Bug 30721 diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 36498802919..bff4cd91385 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -3070,7 +3070,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result) nsIDocument* doc = mContent->GetOwnerDoc(); NS_ASSERTION(doc, "Must have an owner doc"); - rv = doc->GetBaseURI()->GetSpec(mDocumentBase); + rv = doc->GetDocBaseURI()->GetSpec(mDocumentBase); } if (NS_SUCCEEDED(rv)) *result = ToNewCString(mDocumentBase); diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp index 3f17a20f7da..122c2d1c93b 100644 --- a/modules/plugin/base/src/nsPluginHost.cpp +++ b/modules/plugin/base/src/nsPluginHost.cpp @@ -4194,7 +4194,7 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL, rv = owner->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { // Create an absolute URL - rv = NS_MakeAbsoluteURI(absUrl, aURL, doc->GetBaseURI()); + rv = NS_MakeAbsoluteURI(absUrl, aURL, doc->GetDocBaseURI()); } } @@ -4314,7 +4314,7 @@ nsPluginHost::DoURLLoadSecurityCheck(nsIPluginInstance *aInstance, // Create an absolute URL for the target in case the target is relative nsCOMPtr targetURL; - NS_NewURI(getter_AddRefs(targetURL), aURL, doc->GetBaseURI()); + NS_NewURI(getter_AddRefs(targetURL), aURL, doc->GetDocBaseURI()); if (!targetURL) return NS_ERROR_FAILURE; diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index dbfb042c418..a417c2883ed 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -829,7 +829,7 @@ nsHtml5TreeOpExecutor::InitializeDocWriteParserState(nsAHtml5TreeBuilderState* a already_AddRefed nsHtml5TreeOpExecutor::ConvertIfNotPreloadedYet(const nsAString& aURL) { - nsIURI* base = mDocument->GetBaseURI(); + nsIURI* base = mDocument->GetDocBaseURI(); const nsCString& charset = mDocument->GetDocumentCharacterSet(); nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, charset.get(), base); diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index e1d4eeec4d2..dc0c8d5f2a9 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -339,7 +339,7 @@ nsPreloadURIs::PreloadURIs(const nsAutoTArrayGetBaseURI(); + nsIURI *base = doc->GetDocBaseURI(); const nsCString &charset = doc->GetDocumentCharacterSet(); nsSpeculativeScriptThread::PreloadedType &alreadyPreloaded = aScriptThread->GetPreloadedURIs();