Bug 401907, Running Help->Check for updates... leaks, r+sr=bz, a=beltzner

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-11-27 12:02:42 -08:00
Родитель 9b30e47d4e
Коммит 56023cc878
4 изменённых файлов: 61 добавлений и 2 удалений

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

@ -567,12 +567,12 @@ nsXBLContentSink::ConstructBinding()
return NS_ERROR_OUT_OF_MEMORY;
rv = mBinding->Init(cid, mDocInfo, binding);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(mDocInfo->SetPrototypeBinding(cid, mBinding))) {
if (!mFoundFirstBinding) {
mFoundFirstBinding = PR_TRUE;
mDocInfo->SetFirstPrototypeBinding(mBinding);
}
mDocInfo->SetPrototypeBinding(cid, mBinding);
binding->UnsetAttr(kNameSpaceID_None, nsGkAtoms::id, PR_FALSE);
} else {
delete mBinding;

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

@ -576,6 +576,7 @@ nsXBLDocumentInfo::SetPrototypeBinding(const nsACString& aRef, nsXBLPrototypeBin
const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
nsCStringKey key(flat.get());
NS_ENSURE_STATE(!mBindingTable->Get(&key));
mBindingTable->Put(&key, aBinding);
return NS_OK;

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

@ -56,6 +56,7 @@ _TEST_FILES = \
test_bug397934.xhtml \
test_bug398135.xhtml \
test_bug400705.xhtml \
test_bug401907.xhtml \
test_bug403162.xhtml \
bug310107-resource.xhtml \
$(NULL)

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

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=401907
-->
<head>
<title>Test for Bug 401907</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="binding">
<implementation>
<constructor>
ok(true, "First binding with ID 'binding' should be used!");
window.testRun = true;
if (window.needsFinish) {
SimpleTest.finish();
}
</constructor>
</implementation>
</binding>
<binding id="binding">
<implementation>
<constructor>
ok(false, "First binding with ID 'binding' should be used!");
window.testRun = true;
if (window.needsFinish) {
SimpleTest.finish();
}
</constructor>
</implementation>
</binding>
</bindings>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=401907">Mozilla Bug 401907</a>
<p id="display"></p>
<div id="content">
<div style="-moz-binding: url(#binding)">Bound element</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for Bug 401907 **/
if (!window.testRun) {
window.needsFinish = true;
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
</pre>
</body>
</html>