Bug 1340926 part 3 - Deprecate usage of xml:base. r=Ehsan,francois

MozReview-Commit-ID: EpuKLrCj0qc

--HG--
extra : rebase_source : 051f300371d27d4dcdbcb8e70b54c3196155780e
This commit is contained in:
Xidorn Quan 2017-02-20 12:41:11 +11:00
parent c0c5866f64
commit fc22390de5
3 changed files with 20 additions and 14 deletions

View File

@ -388,20 +388,23 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
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);
}
}
}

View File

@ -51,3 +51,4 @@ DEPRECATED_OPERATION(LenientSetter)
DEPRECATED_OPERATION(FileLastModifiedDate)
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
DEPRECATED_OPERATION(XMLBaseAttribute)

View File

@ -323,3 +323,5 @@ GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfille
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.