Make SVGValidator reject foreignobject tags, not just their contents. Fixes Firefox inconsistency

BUG=
R=terry@google.com

Review URL: https://codereview.chromium.org//1063213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44949 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
alanknight@google.com 2015-04-07 20:59:02 +00:00
parent a5ff948486
commit 6d9f24b919
5 changed files with 22 additions and 6 deletions

View file

@ -38181,6 +38181,12 @@ class _SvgNodeValidator implements NodeValidator {
if (element is svg.ScriptElement) {
return false;
}
// Firefox 37 has issues with creating foreign elements inside a
// foreignobject tag as SvgElement. We don't want foreignobject contents
// anyway, so just remove the whole tree outright.
if (element is svg.ForeignObjectElement) {
return false;
}
if (element is svg.SvgElement) {
return true;
}

View file

@ -40404,6 +40404,12 @@ class _SvgNodeValidator implements NodeValidator {
if (element is svg.ScriptElement) {
return false;
}
// Firefox 37 has issues with creating foreign elements inside a
// foreignobject tag as SvgElement. We don't want foreignobject contents
// anyway, so just remove the whole tree outright.
if (element is svg.ForeignObjectElement) {
return false;
}
if (element is svg.SvgElement) {
return true;
}

View file

@ -378,9 +378,6 @@ postmessage_structured_test: Skip # Test cannot run under CSP restrictions (tim
[ $compiler == dart2js && ($runtime == drt || $runtime ==chrome) ]
wheelevent_test: Fail # Issue 12958
[ $compiler == dart2js && $runtime == ff && $system == windows ]
node_validator_test: Fail # Issue 22564
[ $compiler == dart2js && $runtime == chrome]
svgelement_test/supported_altGlyph: RuntimeError # Issue 22154

View file

@ -369,15 +369,16 @@ main() {
testHtml('blocks foreignObject content',
validator,
'<svg xmlns="http://www.w3.org/2000/svg>'
'<svg xmlns="http://www.w3.org/2000/svg">'
'<foreignobject width="100" height="150">'
'<body xmlns="http://www.w3.org/1999/xhtml">'
'<div>Some content</div>'
'</body>'
'</foreignobject>'
'<number>42</number>'
'</svg>',
'<svg xmlns="http://www.w3.org/2000/svg>'
'<foreignobject width="100" height="150"></foreignobject>'
'<svg xmlns="http://www.w3.org/2000/svg">'
'<number>42</number>'
'</svg>');
});

View file

@ -453,6 +453,12 @@ class _SvgNodeValidator implements NodeValidator {
if (element is svg.ScriptElement) {
return false;
}
// Firefox 37 has issues with creating foreign elements inside a
// foreignobject tag as SvgElement. We don't want foreignobject contents
// anyway, so just remove the whole tree outright.
if (element is svg.ForeignObjectElement) {
return false;
}
if (element is svg.SvgElement) {
return true;
}