Crash [@ MaybeSetForm] with html5.enable == false and <form><legend>

This commit is contained in:
Phil Ringnalda 2010-06-06 16:49:00 -05:00
parent 0444dac3c3
commit bcd7a93200
3 changed files with 45 additions and 1 deletions

View File

@ -497,7 +497,6 @@ MaybeSetForm(nsGenericHTMLElement* aContent, nsHTMLTag aNodeType,
case eHTMLTag_button:
case eHTMLTag_fieldset:
case eHTMLTag_label:
case eHTMLTag_legend:
case eHTMLTag_object:
case eHTMLTag_input:
case eHTMLTag_select:

View File

@ -98,6 +98,7 @@ _TEST_FILES = test_bug1682.html \
test_bug486741.html \
test_bug497242.xhtml \
test_bug512367.html \
test_bug570375.html \
test_bug340017.xhtml \
test_bug499092.html \
bug499092.xml \

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=570375
-->
<head>
<title>Test for Bug 570375</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=570375">Mozilla Bug 570375</a>
<p id="display">
<iframe id="testiframe"></iframe>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 570375
Don't crash loading <form><legend> with the html5 parser preffed off.
**/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.enable");
prefs.setBoolPref("html5.enable", false);
$("testiframe").onload = function () {
ok(true, "Shouldn't crash loading a form containing a legend with the html5 parser preffed off");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.enable", gOriginalHtml5Pref);
}
$("testiframe").src = "data:text/html,<form><legend>";
</script>
</pre>
</body>
</html>