Bug 1340926 part 3 - Deprecate usage of xml:base. r=ehsan
MozReview-Commit-ID: EpuKLrCj0qc
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -383,30 +383,33 @@ nsIContent::GetBaseURI(bool aTryUseXHRDo
// Otherwise check for xml:base attribute
elem->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr);
if (!attr.IsEmpty()) {
baseAttrs.AppendElement(attr);
}
elem = elem->GetParent();
} while(elem);
- // Now resolve against all xml:base attrs
- for (uint32_t i = baseAttrs.Length() - 1; i != uint32_t(-1); --i) {
- nsCOMPtr<nsIURI> newBase;
- nsresult rv = NS_NewURI(getter_AddRefs(newBase), baseAttrs[i],
- doc->GetDocumentCharacterSet().get(), base);
- // Do a security check, almost the same as nsDocument::SetBaseURL()
- // Only need to do this on the final uri
- if (NS_SUCCEEDED(rv) && i == 0) {
- rv = nsContentUtils::GetSecurityManager()->
- CheckLoadURIWithPrincipal(NodePrincipal(), newBase,
- nsIScriptSecurityManager::STANDARD);
- }
- if (NS_SUCCEEDED(rv)) {
- base.swap(newBase);
+ if (!baseAttrs.IsEmpty()) {
+ doc->WarnOnceAbout(nsIDocument::eXMLBaseAttribute);
+ // Now resolve against all xml:base attrs
+ for (uint32_t i = baseAttrs.Length() - 1; i != uint32_t(-1); --i) {
+ nsCOMPtr<nsIURI> newBase;
+ nsresult rv = NS_NewURI(getter_AddRefs(newBase), baseAttrs[i],
+ doc->GetDocumentCharacterSet().get(), base);
+ // Do a security check, almost the same as nsDocument::SetBaseURL()
+ // Only need to do this on the final uri
+ if (NS_SUCCEEDED(rv) && i == 0) {
+ rv = nsContentUtils::GetSecurityManager()->
+ CheckLoadURIWithPrincipal(NodePrincipal(), newBase,
+ nsIScriptSecurityManager::STANDARD);
+ }
+ if (NS_SUCCEEDED(rv)) {
+ base.swap(newBase);
+ }
}
}
return base.forget();
}
//----------------------------------------------------------------------
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -46,8 +46,9 @@ DEPRECATED_OPERATION(WebrtcDeprecatedPre
DEPRECATED_OPERATION(RTCPeerConnectionGetStreams)
DEPRECATED_OPERATION(AppCache)
DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
DEPRECATED_OPERATION(PrefixedFullscreenAPI)
DEPRECATED_OPERATION(LenientSetter)
DEPRECATED_OPERATION(FileLastModifiedDate)
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
+DEPRECATED_OPERATION(XMLBaseAttribute)
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -318,8 +318,10 @@ LargeAllocationNonGetRequest=A Large-All
LargeAllocationNotOnlyToplevelInTabGroup=A Large-Allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener.
# LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfilled in a secure context.
# LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name.
LargeAllocationNonWin32=This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocation process creation is disabled on non-Win32 platforms.
# LOCALIZATION NOTE: Do not translate URL.createObjectURL(MediaStream).
URLCreateObjectURL_MediaStream=URL.createObjectURL(MediaStream) is deprecated and will be removed soon.
+# LOCALIZATION NOTE: Do not translate xml:base.
+XMLBaseAttributeWarning=Use of xml:base attribute is deprecated and will be removed soon. Please remove any use of it.