Bug 903372 - Remove support for xml:base
MozReview-Commit-ID: JL2SD1xJ0m9
--- a/browser/components/feeds/FeedWriter.js
+++ b/browser/components/feeds/FeedWriter.js
@@ -98,19 +98,16 @@ FeedWriter.prototype = {
},
_setContentText(id, text) {
let element = this._document.getElementById(id);
let textNode = text.createDocumentFragment(element);
while (element.hasChildNodes())
element.firstChild.remove();
element.appendChild(textNode);
- if (text.base) {
- element.setAttributeNS(XML_NS, "base", text.base.spec);
- }
},
/**
* Safely sets the href attribute on an anchor tag, providing the URI
* specified can be loaded according to rules.
* @param element
* The element to set a URI attribute on
* @param attribute
@@ -287,18 +284,16 @@ FeedWriter.prototype = {
let entryContainer = this._document.createElementNS(HTML_NS, "div");
entryContainer.className = "entry";
// If the entry has a title, make it a link
if (entry.title) {
let a = this._document.createElementNS(HTML_NS, "a");
let span = this._document.createElementNS(HTML_NS, "span");
a.appendChild(span);
- if (entry.title.base)
- span.setAttributeNS(XML_NS, "base", entry.title.base.spec);
span.appendChild(entry.title.createDocumentFragment(a));
// Entries are not required to have links, so entry.link can be null.
if (entry.link)
this._safeSetURIAttribute(a, "href", entry.link.spec);
let title = this._document.createElementNS(HTML_NS, "h3");
title.appendChild(a);
@@ -313,20 +308,16 @@ FeedWriter.prototype = {
entryContainer.appendChild(title);
}
let body = this._document.createElementNS(HTML_NS, "div");
let summary = entry.summary || entry.content;
let docFragment = null;
if (summary) {
- if (summary.base)
- body.setAttributeNS(XML_NS, "base", summary.base.spec);
- else
- LOG("no base?");
docFragment = summary.createDocumentFragment(body);
if (docFragment)
body.appendChild(docFragment);
// If the entry doesn't have a title, append a # permalink
// See http://scripting.com/rss.xml for an example
if (!entry.title && entry.link) {
let a = this._document.createElementNS(HTML_NS, "a");
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -355,81 +355,25 @@ nsIContent::GetLang() const
already_AddRefed<nsIURI>
nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
- // XXX Ignore xml:base as we are removing it.
if (URLExtraData* data = useElement->GetContentURLData()) {
return do_AddRef(data->BaseURI());
}
}
nsIDocument* doc = OwnerDoc();
// Start with document base
nsCOMPtr<nsIURI> base = doc->GetBaseURI(aTryUseXHRDocBaseURI);
- // Collect array of xml:base attribute values up the parent chain. This
- // is slightly slower for the case when there are xml:base attributes, but
- // faster for the far more common case of there not being any such
- // attributes.
- // Also check for SVG elements which require special handling
- AutoTArray<nsString, 5> baseAttrs;
- nsString attr;
- const nsIContent *elem = this;
- do {
- // First check for SVG specialness (why is this SVG specific?)
- if (elem->IsSVGElement()) {
- nsIContent* bindingParent = elem->GetBindingParent();
- if (bindingParent) {
- nsXBLBinding* binding = bindingParent->GetXBLBinding();
- if (binding) {
- // XXX sXBL/XBL2 issue
- // If this is an anonymous XBL element use the binding
- // document for the base URI.
- // XXX Will fail with xml:base
- base = binding->PrototypeBinding()->DocURI();
- break;
- }
- }
- }
-
- // Otherwise check for xml:base attribute
- if (elem->IsElement()) {
- elem->AsElement()->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr);
- if (!attr.IsEmpty()) {
- baseAttrs.AppendElement(attr);
- }
- }
- elem = elem->GetParent();
- } while(elem);
-
- 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(), 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();
}
nsIURI*
nsIContent::GetBaseURIForStyleAttr() const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -34,10 +34,9 @@ DEPRECATED_OPERATION(RTCPeerConnectionGe
DEPRECATED_OPERATION(AppCache)
DEPRECATED_OPERATION(AppCacheInsecure)
DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
DEPRECATED_OPERATION(PrefixedFullscreenAPI)
DEPRECATED_OPERATION(LenientSetter)
DEPRECATED_OPERATION(FileLastModifiedDate)
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
-DEPRECATED_OPERATION(XMLBaseAttribute)
DEPRECATED_OPERATION(WindowContentUntrusted)
--- a/dom/base/test/test_base.xhtml
+++ b/dom/base/test/test_base.xhtml
@@ -16,34 +16,34 @@
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
is(document.baseURI, "http://mochi.test:8888/tests/dom/base/",
"document base");
is(document.body.baseURI, "http://mochi.test:8888/tests/dom/base/",
"body base");
var expected =
- ["http://mochi.test:8888/tests/dom/base/supercalifragilisticexpialidocious",
- "http://mochi.test:8888/tests/dom/base/supercalifragilisticexpialidocious",
- "http://mochi.test:8888/tests/dom/base/hello/",
- "http://mochi.test:8888/tests/dom/base/hello/world",
- "http://mochi.test:8888/tests/dom/base/hello/world#iamtheverymodelofamodernmajorgeneral",
- "http://mochi.test:8888/tests/dom/base/hello/world#iamtheverymodelofamodernmajorgeneral",
+ ["http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
];
var node = document.getElementById("1");
while(node) {
is(node.baseURI, expected.shift(), "node base");
node = node.firstChild;
}
is(expected.length, 0, "found all expected nodes");
var svgExpected =
- ["http://mochi.test:8888/tests/dom/base/test/file_base_xbl.xml",
- "http://mochi.test:8888/tests/dom/base/test/file_base_xbl.xml",
- "http://mochi.test:8888/tests/dom/base/test/file_base_xbl.xml#shesellsseashellsbytheseashore",
+ ["http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
+ "http://mochi.test:8888/tests/dom/base/",
];
node = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById("bound"))[0];
while(node) {
is(node.baseURI, svgExpected.shift(), "node base");
node = node.firstChild;
}
is(svgExpected.length, 0, "found all expected nodes");
--- a/dom/html/test/test_bug481335.xhtml
+++ b/dom/html/test/test_bug481335.xhtml
@@ -58,21 +58,22 @@ function checkLinkColor(aElmId, aExpecte
setTimeout(continueTest, 0);
return false;
}
is(getColor(), aExpectedColor, aMessage);
return true;
}
function* testIterator() {
+ let path = "http://mochi.test:8888/tests/dom/html/test/";
// After first load
$("newparent").appendChild($("t"));
- is($("t").href, "http://www.example.com/" + rand,
+ is($("t").href, path + rand,
"Unexpected href after move");
- is($("t").href, "http://www.example.com/" + rand,
+ is($("t").href, path + rand,
"Unexpected cached href after move");
while (!checkLinkColor("t", unvisitedColor, "Should be unvisited now"))
yield undefined;
$("i").src = $("t").href;
yield undefined;
// After second load
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -322,18 +322,16 @@ GeolocationInsecureRequestIsForbidden=A
# 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_MediaStreamWarning=URL.createObjectURL(MediaStream) is deprecated and will be removed soon.
# LOCALIZATION NOTE: Do not translate MozAutoGainControl or autoGainControl.
MozAutoGainControlWarning=mozAutoGainControl is deprecated. Use autoGainControl instead.
# LOCALIZATION NOTE: Do not translate mozNoiseSuppression or noiseSuppression.
MozNoiseSuppressionWarning=mozNoiseSuppression is deprecated. Use noiseSuppression instead.
-# 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.
# LOCALIZATION NOTE: Do not translate "content", "Window", and "window.top"
WindowContentUntrustedWarning=The ‘content’ attribute of Window objects is deprecated. Please use ‘window.top’ instead.
# LOCALIZATION NOTE: The first %S is the tag name of the element that starts the loop, the second %S is the element's ID.
SVGRefLoopWarning=The SVG <%S> with ID “%S” has a reference loop.
# LOCALIZATION NOTE: The first %S is the tag name of the element in the chain where the chain was broken, the second %S is the element's ID.
SVGRefChainLengthExceededWarning=An SVG <%S> reference chain which is too long was abandoned at the element with ID “%S”.
# LOCALIZATION NOTE: Do not translate "<script>".
ScriptSourceEmpty=‘%S’ attribute of <script> element is empty.
--- a/dom/xhr/tests/test_XHRDocURI.html
+++ b/dom/xhr/tests/test_XHRDocURI.html
@@ -33,31 +33,25 @@ function startTest() {
gen = runTest();
gen.next();
});
}
function testXMLDocURI(aDoc, aExpects) {
is(aDoc.documentURI, aExpects.documentURI, "wrong url");
is(aDoc.baseURI, aExpects.baseURI, "wrong base");
- is(aDoc.documentElement.baseURI, aExpects.elementBaseURI,
- "wrong base (xml:base)");
}
function testChromeXMLDocURI(aDoc, aExpects) {
is(aDoc.documentURI, aExpects.documentURI, "wrong url");
is(aDoc.documentURIObject.spec, aExpects.documentURI,
"wrong url (.documentObjectURI)");
is(aDoc.baseURI, aExpects.baseURI, "wrong base");
is(aDoc.baseURIObject.spec, aExpects.baseURI,
"wrong base (.baseURIObject)");
- is(aDoc.documentElement.baseURI, aExpects.elementBaseURI,
- "wrong base (xml:base)");
- is(aDoc.documentElement.baseURIObject.spec, aExpects.elementBaseURI,
- "wrong base (.baseURIObject, xml:base)");
}
function testHTMLDocURI(aDoc, aExpects) {
is(aDoc.documentURI, aExpects.documentURI, "wrong url");
is(aDoc.baseURI, aExpects.baseURI, "wrong base");
var base = aDoc.createElement("base");
var newBaseURI = "http://www.example.com/";
@@ -69,28 +63,16 @@ function testHTMLDocURI(aDoc, aExpects)
function testChromeHTMLDocURI(aDoc, aNonChromeBaseURI, aExpects) {
is(aDoc.documentURI, aExpects.documentURI, "wrong url");
is(aDoc.documentURIObject.spec, aExpects.documentURI,
"wrong url (.documentURIObject)");
is(aDoc.baseURI, aExpects.baseURI, "wrong base");
is(aDoc.baseURIObject.spec, aExpects.baseURI,
"wrong url (.baseURIObject)");
- aDoc.body.setAttributeNS("http://www.w3.org/XML/1998/namespace", "base",
- aNonChromeBaseURI);
- is(aDoc.body.baseURI, aNonChromeBaseURI,
- "wrong base (doc base and xml:base are same)");
- is(aDoc.body.baseURIObject.spec, aNonChromeBaseURI,
- "wrong base (.baseURIObject, doc base and xml:base are same)")
- var attr = aDoc.getElementById("data").getAttributeNode("id");
- is(attr.baseURI, aNonChromeBaseURI,
- "wrong attr base (doc base and xml:base are same)")
- is(attr.baseURIObject.spec, aNonChromeBaseURI,
- "wrong attr base (.baseURIObject, doc base and xml:base are same)")
-
var base = aDoc.createElement("base");
var newBaseURI = "http://www.example.com/";
base.href = newBaseURI;
aDoc.head.appendChild(base);
is(aDoc.baseURI, newBaseURI, "wrong base (after <base> changed)");
is(aDoc.baseURIObject.spec, newBaseURI,
"wrong base (.baseURIObject, after <base> changed)");
}