зеркало из https://github.com/mozilla/gecko-dev.git
Bug 371846: Kill unneccesary ownership management code in nsBindingManager::SetAnonymousNodesFor. r=smaug sr=jst
This commit is contained in:
Родитель
ededf7a1cc
Коммит
989b3a3171
|
@ -3035,7 +3035,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
|
|||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
cb.NoteXPCOMChild(slots->mAttributeMap.get());
|
||||
cb.NoteXPCOMChild(slots->mControllers);
|
||||
if (tmp->IsNodeOfType(nsINode::eXUL))
|
||||
cb.NoteXPCOMChild(slots->mControllers);
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
|
|
@ -591,31 +591,6 @@ nsBindingManager::SetAnonymousNodesFor(nsIContent* aContent,
|
|||
delete aList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// If there are any items in aList that are already in aContent's
|
||||
// AnonymousNodesList, we need to make sure they don't get deleted as
|
||||
// the lists are swapped. So, get the current list and check.
|
||||
// FIXME: This is O(n*m) where n and m are the insertion point list
|
||||
// lengths. But, there usually aren't many insertion points.
|
||||
|
||||
if (mAnonymousNodesTable.ops) {
|
||||
nsAnonymousContentList *oldList =
|
||||
NS_STATIC_CAST(nsAnonymousContentList*,
|
||||
LookupObject(mAnonymousNodesTable, aContent));
|
||||
if (oldList) {
|
||||
PRInt32 i = 0;
|
||||
while (i < oldList->GetInsertionPointCount()) {
|
||||
nsXBLInsertionPoint *point = oldList->GetInsertionPointAt(i);
|
||||
if (aList->IndexOf(point) != -1) {
|
||||
// We don't want this point to be deleted, so remove it
|
||||
// from the old list.
|
||||
oldList->RemoveInsertionPointAt(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SetOrRemoveObject(mAnonymousNodesTable, aContent, contentList);
|
||||
|
|
|
@ -47,6 +47,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
test_bug296375.xul \
|
||||
test_bug366770.html \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=296375
|
||||
-->
|
||||
<window title="Mozilla Bug 296375"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<title>Test for Bug 296375</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=296375">Mozilla Bug 296375</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<button id="b" label="crash"/>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 296375 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function () {
|
||||
document.addBinding(document.getElementById("b"),
|
||||
"chrome://global/content/bindings/checkbox.xml#checkbox");
|
||||
ok(true, "addBinding didn't cause a crash");
|
||||
});
|
||||
addLoadEvent(SimpleTest.finish);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
Загрузка…
Ссылка в новой задаче