Bug 416383, call nsDOMAttributeMap::DropReference() when unlinking elements ([@nsDOMAttribute::GetValue(nsAString_internal&)]), r+sr=sicking, a=mtschrep

This commit is contained in:
Olli.Pettay@helsinki.fi 2008-02-11 02:36:50 -08:00
Родитель 7adfbe3ebc
Коммит 0e45a254b2
3 изменённых файлов: 52 добавлений и 1 удалений

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

@ -3400,7 +3400,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
slots->mAttributeMap = nsnull;
if (slots->mAttributeMap) {
slots->mAttributeMap->DropReference();
slots->mAttributeMap = nsnull;
}
if (tmp->IsNodeOfType(nsINode::eXUL))
NS_IF_RELEASE(slots->mControllers);
}

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

@ -142,6 +142,7 @@ _TEST_FILES = test_bug5141.html \
test_bug415860.html \
test_bug414190.html \
test_bug414796.html \
test_bug416383.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=416383
-->
<head>
<title>Test for Bug 416383</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/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=416383">Mozilla Bug 416383</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test_parent"><div someattr="foo"></div></div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 416383 **/
function runTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var testParent = document.getElementById("test_parent");
var attrs = testParent.firstChild.attributes;
ok(attrs != null, "Element should have attributes!");
var attr = testParent.firstChild.getAttributeNode("someattr");
ok(attr.value == "foo", "The value of the attribute should be 'foo'!");
testParent.removeChild(testParent.firstChild);
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect();
ok(true, "Browser should not crash!")
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>