Bug 669012 - Part a: ignore for and event attributes for SVG elements; r=smaug+hsivonen.

This commit is contained in:
Ms2ger 2011-11-16 08:50:18 +01:00
parent 98a2a7433a
commit 921d8dd46e
3 changed files with 50 additions and 0 deletions

View File

@ -196,6 +196,10 @@ IsScriptEventHandler(nsIScriptElement *aScriptElement)
nsCOMPtr<nsIContent> contElement = do_QueryInterface(aScriptElement);
NS_ASSERTION(contElement, "nsIScriptElement isn't nsIContent");
if (!contElement->IsHTML()) {
return false;
}
nsAutoString forAttr, eventAttr;
if (!contElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_for, forAttr) ||
!contElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, eventAttr)) {

View File

@ -270,6 +270,7 @@ _TEST_FILES = \
test_bug664299.html \
test_bug666200.html \
test_bug666666.html \
test_bug669012.html \
test_bug674558.html \
test_bug583533.html \
test_restore_from_parser_fragment.html \

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=669012
-->
<head>
<title>Test for Bug 669012</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=669012">Mozilla Bug 669012</a>
<p id="display"></p>
<div id="content" style="display: none">
<script>
var run = 0;
</script>
<svg>
<script>
run++;
ok(true, "Should run SVG script without attributes")
</script>
<script for=window event=onload>
run++;
ok(true, "Should run SVG script with for=window event=onload")
</script>
<script for=window event=foo>
run++;
ok(true, "Should run SVG script with for=window event=foo")
</script>
<script for=foo event=onload>
run++;
ok(true, "Should run SVG script with for=foo event=onload")
</script>
</svg>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 669012 **/
is(run, 4, "Should have run all tests")
</script>
</pre>
</body>
</html>