зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1565767 part 1. Stop returning addrefed URIs from GetBaseURI(). r=peterv
We only needed this for xml:base. Differential Revision: https://phabricator.services.mozilla.com/D37969 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7322b26929
Коммит
dfc54dca0e
|
@ -182,7 +182,7 @@ nsresult Attr::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
nsIURI* Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
Element* parent = GetElement();
|
||||
|
||||
return parent ? parent->GetBaseURI(aTryUseXHRDocBaseURI) : nullptr;
|
||||
|
|
|
@ -67,8 +67,7 @@ class Attr final : public nsINode {
|
|||
// nsINode interface
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const override;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
|
|
@ -5705,15 +5705,12 @@ void Document::ReleaseCapture() const {
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Document::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsIURI* Document::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
if (aTryUseXHRDocBaseURI && mChromeXHRDocBaseURI) {
|
||||
uri = mChromeXHRDocBaseURI;
|
||||
} else {
|
||||
uri = GetDocBaseURI();
|
||||
return mChromeXHRDocBaseURI;
|
||||
}
|
||||
|
||||
return uri.forget();
|
||||
return GetDocBaseURI();
|
||||
}
|
||||
|
||||
void Document::SetBaseURI(nsIURI* aURI) {
|
||||
|
|
|
@ -666,7 +666,9 @@ class Document : public nsINode,
|
|||
virtual void NotifyPossibleTitleChange(bool aBoundTitleElement);
|
||||
|
||||
/**
|
||||
* Return the URI for the document. May return null.
|
||||
* Return the URI for the document. May return null. If it ever stops being
|
||||
* able to return null, we can make sure nsINode::GetBaseURI/GetBaseURIObject
|
||||
* also never return null.
|
||||
*
|
||||
* The value returned corresponds to the "document's address" in
|
||||
* HTML5. As such, it may change over the lifetime of the document, for
|
||||
|
@ -901,8 +903,7 @@ class Document : public nsINode,
|
|||
return GetFallbackBaseURI();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const final;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const final;
|
||||
|
||||
void SetBaseURI(nsIURI* aURI);
|
||||
|
||||
|
|
|
@ -327,19 +327,14 @@ nsAtom* nsIContent::GetLang() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsIContent::GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI) const {
|
||||
nsIURI* nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
|
||||
if (SVGUseElement* use = GetContainingSVGUseShadowHost()) {
|
||||
if (URLExtraData* data = use->GetContentURLData()) {
|
||||
return do_AddRef(data->BaseURI());
|
||||
return data->BaseURI();
|
||||
}
|
||||
}
|
||||
|
||||
Document* doc = OwnerDoc();
|
||||
// Start with document base
|
||||
nsCOMPtr<nsIURI> base = doc->GetBaseURI(aTryUseXHRDocBaseURI);
|
||||
|
||||
return base.forget();
|
||||
return OwnerDoc()->GetBaseURI(aTryUseXHRDocBaseURI);
|
||||
}
|
||||
|
||||
nsIURI* nsIContent::GetBaseURIForStyleAttr() const {
|
||||
|
|
|
@ -810,7 +810,7 @@ void Location::Assign(const nsAString& aUrl, nsIPrincipal& aSubjectPrincipal,
|
|||
DoSetHref(aUrl, aSubjectPrincipal, false, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> Location::GetSourceBaseURL() {
|
||||
nsIURI* Location::GetSourceBaseURL() {
|
||||
Document* doc = GetEntryDocument();
|
||||
// If there's no entry document, we either have no Script Entry Point or one
|
||||
// that isn't a DOM Window. This doesn't generally happen with the DOM, but
|
||||
|
|
|
@ -152,7 +152,7 @@ class Location final : public nsISupports, public nsWrapperCache {
|
|||
|
||||
// Get the base URL we should be using for our relative URL
|
||||
// resolution for SetHref/Assign/Replace.
|
||||
already_AddRefed<nsIURI> GetSourceBaseURL();
|
||||
nsIURI* GetSourceBaseURL();
|
||||
|
||||
// Check whether it's OK to load the given url with the given subject
|
||||
// principal, and if so construct the right nsDocShellLoadInfo for the load
|
||||
|
|
|
@ -675,8 +675,7 @@ class nsIContent : public nsINode {
|
|||
}
|
||||
|
||||
// Overloaded from nsINode
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const override;
|
||||
nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
// Returns base URI for style attribute.
|
||||
nsIURI* GetBaseURIForStyleAttr() const;
|
||||
|
|
|
@ -611,7 +611,7 @@ nsresult nsINode::GetBaseURI(nsAString& aURI) const {
|
|||
|
||||
void nsINode::GetBaseURIFromJS(nsAString& aURI, CallerType aCallerType,
|
||||
ErrorResult& aRv) const {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI(aCallerType == CallerType::System);
|
||||
nsIURI* baseURI = GetBaseURI(aCallerType == CallerType::System);
|
||||
nsAutoCString spec;
|
||||
if (baseURI) {
|
||||
nsresult res = baseURI->GetSpec(spec);
|
||||
|
@ -623,9 +623,7 @@ void nsINode::GetBaseURIFromJS(nsAString& aURI, CallerType aCallerType,
|
|||
CopyUTF8toUTF16(spec, aURI);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsINode::GetBaseURIObject() const {
|
||||
return GetBaseURI(true);
|
||||
}
|
||||
nsIURI* nsINode::GetBaseURIObject() const { return GetBaseURI(true); }
|
||||
|
||||
void nsINode::LookupPrefix(const nsAString& aNamespaceURI, nsAString& aPrefix) {
|
||||
Element* element = GetNameSpaceElement();
|
||||
|
|
|
@ -1211,14 +1211,12 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
/**
|
||||
* 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.
|
||||
* content carries a local base for backward compatibility.
|
||||
*
|
||||
* @return the base URI
|
||||
* @return the base URI. May return null.
|
||||
*/
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(
|
||||
bool aTryUseXHRDocBaseURI = false) const = 0;
|
||||
already_AddRefed<nsIURI> GetBaseURIObject() const;
|
||||
virtual nsIURI* GetBaseURI(bool aTryUseXHRDocBaseURI = false) const = 0;
|
||||
nsIURI* GetBaseURIObject() const;
|
||||
|
||||
/**
|
||||
* Return true if the node may be apz aware. There are two cases. One is that
|
||||
|
|
|
@ -3225,7 +3225,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::PrivateModeChanged(bool aEnabled) {
|
|||
return mInstance ? mInstance->PrivateModeStateChanged(aEnabled) : NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> nsPluginInstanceOwner::GetBaseURI() const {
|
||||
nsIURI* nsPluginInstanceOwner::GetBaseURI() const {
|
||||
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
|
||||
if (!content) {
|
||||
return nullptr;
|
||||
|
|
|
@ -251,7 +251,7 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
|
||||
bool UseAsyncRendering();
|
||||
|
||||
already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
nsIURI* GetBaseURI() const;
|
||||
|
||||
bool GetCompositionString(uint32_t aIndex, nsTArray<uint8_t>* aString,
|
||||
int32_t* aLength);
|
||||
|
|
|
@ -1063,8 +1063,8 @@ namespace {
|
|||
|
||||
class MOZ_STACK_CLASS MappedAttrParser {
|
||||
public:
|
||||
MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI,
|
||||
already_AddRefed<nsIURI> aBaseURI, SVGElement* aElement);
|
||||
MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI, nsIURI* aBaseURI,
|
||||
SVGElement* aElement);
|
||||
~MappedAttrParser();
|
||||
|
||||
// Parses a mapped attribute value.
|
||||
|
@ -1096,8 +1096,7 @@ class MOZ_STACK_CLASS MappedAttrParser {
|
|||
};
|
||||
|
||||
MappedAttrParser::MappedAttrParser(css::Loader* aLoader, nsIURI* aDocURI,
|
||||
already_AddRefed<nsIURI> aBaseURI,
|
||||
SVGElement* aElement)
|
||||
nsIURI* aBaseURI, SVGElement* aElement)
|
||||
: mLoader(aLoader),
|
||||
mDocURI(aDocURI),
|
||||
mBaseURI(aBaseURI),
|
||||
|
|
|
@ -208,7 +208,7 @@ uint32_t WebBrowserPersistLocalDocument::GetPersistFlags() const {
|
|||
return mPersistFlags;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> WebBrowserPersistLocalDocument::GetBaseURI() const {
|
||||
nsIURI* WebBrowserPersistLocalDocument::GetBaseURI() const {
|
||||
return mDocument->GetBaseURI();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class WebBrowserPersistLocalDocument final
|
|||
|
||||
NotNull<const Encoding*> GetCharacterSet() const;
|
||||
uint32_t GetPersistFlags() const;
|
||||
already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
nsIURI* GetBaseURI() const;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIWEBBROWSERPERSISTDOCUMENT
|
||||
|
|
Загрузка…
Ссылка в новой задаче