Bug 723676, crash writing to startup cache when an empty method body is used, r=bz

This commit is contained in:
Neil Deakin 2012-02-13 14:24:28 -05:00
Родитель ba93add056
Коммит 4fcce60342
3 изменённых файлов: 35 добавлений и 5 удалений

Просмотреть файл

@ -289,13 +289,17 @@ nsresult
nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
nsIObjectOutputStream* aStream)
{
nsresult rv = aStream->Write8(XBLBinding_Serialize_Method);
NS_ENSURE_SUCCESS(rv, rv);
if (mJSMethodObject) {
nsresult rv = aStream->Write8(XBLBinding_Serialize_Method);
NS_ENSURE_SUCCESS(rv, rv);
rv = aStream->WriteWStringZ(mName);
NS_ENSURE_SUCCESS(rv, rv);
rv = aStream->WriteWStringZ(mName);
NS_ENSURE_SUCCESS(rv, rv);
return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
return XBL_SerializeFunction(aContext, aStream, mJSMethodObject);
}
return NS_OK;
}
nsresult

Просмотреть файл

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

Просмотреть файл

@ -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, "Method with empty body 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:implementation>
<xbl:method name="init"/>
</xbl:implementation>
</xbl:binding>
</xbl:bindings>
</window>