Bug 721452, crash writing to startup cache when empty handler is used, r=bz

This commit is contained in:
Neil Deakin 2012-02-13 14:24:28 -05:00
parent 0740a53911
commit ba93add056
3 changed files with 27 additions and 1 deletions

View File

@ -1074,7 +1074,7 @@ nsXBLPrototypeHandler::Write(nsIScriptContext* aContext, nsIObjectOutputStream*
{
// Make sure we don't write out NS_HANDLER_TYPE_XUL types, as they are used
// for <keyset> elements.
if (mType & NS_HANDLER_TYPE_XUL)
if ((mType & NS_HANDLER_TYPE_XUL) || !mEventName)
return NS_OK;
XBLBindingSerializeDetails type = XBLBinding_Serialize_Handler;

View File

@ -79,6 +79,7 @@ _CHROME_FILES = \
test_bug378518.xul \
test_bug398135.xul \
test_bug398492.xul \
test_bug721452.xul \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
ok(true, "Handler with empty action didn't crash")
</script>
<body xmlns="http://www.w3.org/1999/xhtml"/>
<box style="-moz-binding: url(#binding)"/>
<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
<xbl:binding id="binding">
<xbl:content/>
<xbl:handlers>
<xbl:handler nt="action" action=""/>
</xbl:handlers>
</xbl:binding>
</xbl:bindings>
</window>