зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1575870. Remove support for XLink on MathML elements. r=emilio
See https://groups.google.com/forum/#!topic/mozilla.dev.platform/70NFnet82cU This commit introduces a new mathml.xlink.disabled option to disable support for XLink attributes on MathML elements together with a use counter and deprecation warning when support is enabled. For now, support is only disabled in Nighly. In the past, we relied on custom MathML deprecation warnings but those are removed here. Corresponding tests for these legacy warning messages are also removed from test_bug553917.html. link-1.xhtml is run with XLink support enabled (since it check xlink:href) while browser_contentAltClick.js is updated to check whether XLink has any effect on MathML, depending on whether the option is enabled. Differential Revision: https://phabricator.services.mozilla.com/D43332 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7c2f8f4f3c
Коммит
ea067f91f0
|
@ -121,15 +121,21 @@ add_task(async function test_alt_click_shadow_dom() {
|
|||
add_task(async function test_alt_click_on_xlinks() {
|
||||
await setup();
|
||||
|
||||
const allow_mathml_xlink = !SpecialPowers.getBoolPref(
|
||||
"mathml.xlink.disabled"
|
||||
);
|
||||
|
||||
let downloadList = await Downloads.getList(Downloads.ALL);
|
||||
let downloads = [];
|
||||
let downloadView;
|
||||
// When all 2 downloads have been attempted then resolve the promise.
|
||||
let downloadCount = allow_mathml_xlink ? 2 : 1;
|
||||
|
||||
// When all downloads have been attempted then resolve the promise.
|
||||
let finishedAllDownloads = new Promise(resolve => {
|
||||
downloadView = {
|
||||
onDownloadAdded(aDownload) {
|
||||
downloads.push(aDownload);
|
||||
if (downloads.length == 2) {
|
||||
if (downloads.length == downloadCount) {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
|
@ -137,12 +143,12 @@ add_task(async function test_alt_click_on_xlinks() {
|
|||
});
|
||||
await downloadList.addView(downloadView);
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(
|
||||
"#mathxlink",
|
||||
"#svgxlink",
|
||||
{ altKey: true },
|
||||
gBrowser.selectedBrowser
|
||||
);
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(
|
||||
"#svgxlink",
|
||||
"#mathxlink",
|
||||
{ altKey: true },
|
||||
gBrowser.selectedBrowser
|
||||
);
|
||||
|
@ -151,17 +157,19 @@ add_task(async function test_alt_click_on_xlinks() {
|
|||
await finishedAllDownloads;
|
||||
await downloadList.removeView(downloadView);
|
||||
|
||||
is(downloads.length, 2, "2 downloads");
|
||||
is(downloads.length, downloadCount, `${downloadCount} downloads`);
|
||||
is(
|
||||
downloads[0].source.url,
|
||||
"http://mochi.test/moz/",
|
||||
"Downloaded #mathxlink element"
|
||||
);
|
||||
is(
|
||||
downloads[1].source.url,
|
||||
"http://mochi.test/moz/",
|
||||
"Downloaded #svgxlink element"
|
||||
);
|
||||
if (downloadCount > 1) {
|
||||
is(
|
||||
downloads[1].source.url,
|
||||
"http://mochi.test/moz/",
|
||||
"Downloaded #mathxlink element"
|
||||
);
|
||||
}
|
||||
|
||||
await clean_up();
|
||||
});
|
||||
|
|
|
@ -53,3 +53,4 @@ DEPRECATED_OPERATION(MathML_DeprecatedLineThicknessValue)
|
|||
DEPRECATED_OPERATION(MathML_DeprecatedMathSizeValue)
|
||||
DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue)
|
||||
DEPRECATED_OPERATION(MathML_DeprecatedStyleAttribute)
|
||||
DEPRECATED_OPERATION(MathML_DeprecatedXLinkAttribute)
|
||||
|
|
|
@ -396,3 +396,5 @@ MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” ar
|
|||
MathML_DeprecatedMathSpaceValueWarning=“veryverythinmathspace”, “verythinmathspace”, “thinmathspace”, “mediummathspace”, “thickmathspace”, “verythickmathspace” and “veryverythickmathspace” are deprecated values for MathML lengths and will be removed at a future date.
|
||||
# LOCALIZATION NOTE: Do not translate MathML, background, color, fontfamily, fontsize, fontstyle and fontweight.
|
||||
MathML_DeprecatedStyleAttributeWarning=MathML attributes “background”, “color”, “fontfamily”, “fontsize”, “fontstyle” and “fontweight” are deprecated and will be removed at a future date.
|
||||
# LOCALIZATION NOTE: Do not translate MathML and XLink.
|
||||
MathML_DeprecatedXLinkAttributeWarning=XLink attributes “href”, “type”, “show” and “actuate” are deprecated on MathML elements and will be removed at a future date.
|
||||
|
|
|
@ -13,5 +13,4 @@ SubSupMismatch=Invalid markup: Incomplete subscript/superscript pair in <mmultis
|
|||
AttributeParsingError=Error in parsing the value ‘%1$S’ for ‘%2$S’ attribute of <%3$S/>. Attribute ignored.
|
||||
AttributeParsingErrorNoTag=Error in parsing the value ‘%1$S’ for ‘%2$S’ attribute. Attribute ignored.
|
||||
LengthParsingError=Error in parsing MathML attribute value ‘%1$S’ as length. Attribute ignored.
|
||||
DeprecatedSupersededBy=‘%1$S’ is deprecated in MathML 3, superseded by ‘%2$S’.
|
||||
UnitlessValuesAreDeprecated=Unitless values are deprecated in MathML 3.
|
||||
|
|
|
@ -37,17 +37,6 @@ using namespace mozilla::dom;
|
|||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMathMLElement, nsMathMLElementBase, Link)
|
||||
|
||||
static nsresult WarnDeprecated(const char16_t* aDeprecatedAttribute,
|
||||
const char16_t* aFavoredAttribute,
|
||||
Document* aDocument) {
|
||||
AutoTArray<nsString, 2> argv;
|
||||
argv.AppendElement(aDeprecatedAttribute);
|
||||
argv.AppendElement(aFavoredAttribute);
|
||||
return nsContentUtils::ReportToConsole(
|
||||
nsIScriptError::warningFlag, NS_LITERAL_CSTRING("MathML"), aDocument,
|
||||
nsContentUtils::eMATHML_PROPERTIES, "DeprecatedSupersededBy", argv);
|
||||
}
|
||||
|
||||
static nsresult ReportLengthParseError(const nsString& aValue,
|
||||
Document* aDocument) {
|
||||
AutoTArray<nsString, 1> arg = {aValue};
|
||||
|
@ -870,7 +859,7 @@ bool nsMathMLElement::IsLink(nsIURI** aURI) const {
|
|||
// The REC says: "When user agents encounter MathML elements with both href
|
||||
// and xlink:href attributes, the href attribute should take precedence."
|
||||
hasHref = true;
|
||||
} else {
|
||||
} else if (!StaticPrefs::mathml_xlink_disabled()) {
|
||||
// To be a clickable XLink for styling and interaction purposes, we require:
|
||||
//
|
||||
// xlink:href - must be set
|
||||
|
@ -899,6 +888,8 @@ bool nsMathMLElement::IsLink(nsIURI** aURI) const {
|
|||
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate, sActuateVals,
|
||||
eCaseMatters) != Element::ATTR_VALUE_NO_MATCH) {
|
||||
OwnerDoc()->WarnOnceAbout(
|
||||
dom::Document::eMathML_DeprecatedXLinkAttribute);
|
||||
hasHref = true;
|
||||
}
|
||||
}
|
||||
|
@ -918,9 +909,15 @@ bool nsMathMLElement::IsLink(nsIURI** aURI) const {
|
|||
}
|
||||
|
||||
void nsMathMLElement::GetLinkTarget(nsAString& aTarget) {
|
||||
if (StaticPrefs::mathml_xlink_disabled()) {
|
||||
nsMathMLElementBase::GetLinkTarget(aTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
const nsAttrValue* target =
|
||||
mAttrs.GetAttr(nsGkAtoms::target, kNameSpaceID_XLink);
|
||||
if (target) {
|
||||
OwnerDoc()->WarnOnceAbout(dom::Document::eMathML_DeprecatedXLinkAttribute);
|
||||
target->ToString(aTarget);
|
||||
}
|
||||
|
||||
|
@ -928,14 +925,22 @@ void nsMathMLElement::GetLinkTarget(nsAString& aTarget) {
|
|||
static Element::AttrValuesArray sShowVals[] = {nsGkAtoms::_new,
|
||||
nsGkAtoms::replace, nullptr};
|
||||
|
||||
bool hasDeprecatedShowAttribute = true;
|
||||
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show, sShowVals,
|
||||
eCaseMatters)) {
|
||||
case ATTR_MISSING:
|
||||
hasDeprecatedShowAttribute = false;
|
||||
break;
|
||||
case 0:
|
||||
aTarget.AssignLiteral("_blank");
|
||||
return;
|
||||
case 1:
|
||||
return;
|
||||
}
|
||||
if (hasDeprecatedShowAttribute) {
|
||||
OwnerDoc()->WarnOnceAbout(
|
||||
dom::Document::eMathML_DeprecatedXLinkAttribute);
|
||||
}
|
||||
OwnerDoc()->GetBaseTarget(aTarget);
|
||||
}
|
||||
}
|
||||
|
@ -955,9 +960,11 @@ nsresult nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
// that content states have changed will call IntrinsicState, which will try
|
||||
// to get updated information about the visitedness from Link.
|
||||
if (aName == nsGkAtoms::href && (aNameSpaceID == kNameSpaceID_None ||
|
||||
aNameSpaceID == kNameSpaceID_XLink)) {
|
||||
(!StaticPrefs::mathml_xlink_disabled() &&
|
||||
aNameSpaceID == kNameSpaceID_XLink))) {
|
||||
if (aValue && aNameSpaceID == kNameSpaceID_XLink) {
|
||||
WarnDeprecated(u"xlink:href", u"href", OwnerDoc());
|
||||
OwnerDoc()->WarnOnceAbout(
|
||||
dom::Document::eMathML_DeprecatedXLinkAttribute);
|
||||
}
|
||||
// Note: When unsetting href, there may still be another href since there
|
||||
// are 2 possible namespaces.
|
||||
|
|
|
@ -31,14 +31,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
|||
ChildCountIncorrect: {
|
||||
status : [false, false, false, false, false, false],
|
||||
args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
|
||||
/*<math fontfamily="serif"></math>
|
||||
<math color="#112233"></math>
|
||||
<math background="#FFFFFF"></math>
|
||||
<math fontsize="10"></math>
|
||||
<math xlink:href="http://www.mozilla.org"></math>*/
|
||||
DeprecatedSupersededBy: {
|
||||
status: [false],
|
||||
args: [["xlink:href","href"]] },
|
||||
/*<math><mpadded width="BAD!"></mpadded></math>
|
||||
<math><mpadded height="BAD!"></mpadded></math>
|
||||
<math><mpadded voffset="BAD!"></mpadded></math>*/
|
||||
|
@ -132,7 +124,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
|||
status : [!allow_nonzero_unitless_lengths],
|
||||
args : [[]] }};
|
||||
|
||||
var g_errorTypes = ["ChildCountIncorrect","DeprecatedSupersededBy","AttributeParsingError",
|
||||
var g_errorTypes = ["ChildCountIncorrect","AttributeParsingError",
|
||||
"AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors",
|
||||
"UnitlessValuesAreDeprecated"];
|
||||
|
||||
|
@ -197,9 +189,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
|||
<math><msubsup></msubsup></math>
|
||||
<math><munderover></munderover></math>
|
||||
|
||||
<!-- DeprecatedSupersededBy -->
|
||||
<math xlink:href="http://www.mozilla.org"></math>
|
||||
|
||||
<!-- AttributeParsingError -->
|
||||
<math><mpadded width="BAD!"></mpadded></math>
|
||||
<math><mpadded height="BAD!"></mpadded></math>
|
||||
|
|
|
@ -157,7 +157,7 @@ pref(mathml.nonzero_unitless_lengths.disabled,false) == mfrac-linethickness-2.xh
|
|||
== mfrac-linethickness-3.xhtml mfrac-linethickness-3-ref.xhtml
|
||||
pref(mathml.mathspace_names.disabled,false) == mathml-negativespace.html mathml-negativespace-ref.html
|
||||
== negative-mspace-1.html negative-mspace-1-ref.html
|
||||
!= link-1.xhtml link-ref.xhtml
|
||||
pref(mathml.xlink.disabled,false) != link-1.xhtml link-ref.xhtml
|
||||
== munderover-empty-scripts.html munderover-empty-scripts-ref.html
|
||||
pref(mathml.mathspace_names.disabled,false) == positive-namedspace.html positive-namedspace-ref.html
|
||||
== mtable-align-whitespace.html mtable-align-whitespace-ref.html
|
||||
|
|
|
@ -5078,6 +5078,12 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# Whether to disable support for XLink on MathML elements.
|
||||
- name: mathml.xlink.disabled
|
||||
type: bool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "media."
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче