mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1406395 - P3: Backout changeset b679806ce7e3 (bug 1384661 part 1). r=smaug
This commit is contained in:
parent
cd138502d8
commit
4986b193f1
@ -493,43 +493,42 @@ NeedsScriptTraverse(nsINode* aNode)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsChildContentList)
|
||||
|
||||
// If nsAttrChildContentList is changed so that any additional fields are
|
||||
// If nsChildContentList is changed so that any additional fields are
|
||||
// traversed by the cycle collector, then CAN_SKIP must be updated to
|
||||
// check that the additional fields are null.
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsChildContentList)
|
||||
|
||||
// nsAttrChildContentList only ever has a single child, its wrapper, so if
|
||||
// nsChildContentList only ever has a single child, its wrapper, so if
|
||||
// the wrapper is known-live, the list can't be part of a garbage cycle.
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsChildContentList)
|
||||
return tmp->HasKnownLiveWrapper();
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsChildContentList)
|
||||
return tmp->HasKnownLiveWrapperAndDoesNotNeedTracing(tmp);
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
||||
|
||||
// CanSkipThis returns false to avoid problems with incomplete unlinking.
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsAttrChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsChildContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsAttrChildContentList)
|
||||
NS_INTERFACE_TABLE_HEAD(nsChildContentList)
|
||||
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
||||
NS_INTERFACE_TABLE(nsAttrChildContentList, nsINodeList, nsIDOMNodeList)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsAttrChildContentList)
|
||||
NS_INTERFACE_TABLE(nsChildContentList, nsINodeList, nsIDOMNodeList)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsChildContentList)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
JSObject*
|
||||
nsAttrChildContentList::WrapObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> aGivenProto)
|
||||
nsChildContentList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return NodeListBinding::Wrap(cx, this, aGivenProto);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAttrChildContentList::GetLength(uint32_t* aLength)
|
||||
nsChildContentList::GetLength(uint32_t* aLength)
|
||||
{
|
||||
*aLength = mNode ? mNode->GetChildCount() : 0;
|
||||
|
||||
@ -537,7 +536,7 @@ nsAttrChildContentList::GetLength(uint32_t* aLength)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAttrChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsINode* node = Item(aIndex);
|
||||
if (!node) {
|
||||
@ -550,7 +549,7 @@ nsAttrChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsAttrChildContentList::Item(uint32_t aIndex)
|
||||
nsChildContentList::Item(uint32_t aIndex)
|
||||
{
|
||||
if (mNode) {
|
||||
return mNode->GetChildAt(aIndex);
|
||||
@ -560,7 +559,7 @@ nsAttrChildContentList::Item(uint32_t aIndex)
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsAttrChildContentList::IndexOf(nsIContent* aContent)
|
||||
nsChildContentList::IndexOf(nsIContent* aContent)
|
||||
{
|
||||
if (mNode) {
|
||||
return mNode->IndexOf(aContent);
|
||||
|
@ -20,20 +20,19 @@ class nsINode;
|
||||
* and Item to its existing child list.
|
||||
* @see nsIDOMNodeList
|
||||
*/
|
||||
class nsAttrChildContentList final : public nsINodeList
|
||||
class nsChildContentList final : public nsINodeList
|
||||
{
|
||||
public:
|
||||
explicit nsAttrChildContentList(nsINode* aNode)
|
||||
explicit nsChildContentList(nsINode* aNode)
|
||||
: mNode(aNode)
|
||||
{
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsAttrChildContentList)
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList)
|
||||
|
||||
// nsWrapperCache
|
||||
virtual JSObject* WrapObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
// nsIDOMNodeList interface
|
||||
NS_DECL_NSIDOMNODELIST
|
||||
@ -53,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
~nsAttrChildContentList() {}
|
||||
~nsChildContentList() {}
|
||||
|
||||
// The node whose children make up the list.
|
||||
// This is a non-owning ref which is safe because it's set to nullptr by
|
||||
|
@ -409,7 +409,7 @@ nsINode::ChildNodes()
|
||||
{
|
||||
nsSlots* slots = Slots();
|
||||
if (!slots->mChildNodes) {
|
||||
slots->mChildNodes = new nsAttrChildContentList(this);
|
||||
slots->mChildNodes = new nsChildContentList(this);
|
||||
}
|
||||
|
||||
return slots->mChildNodes;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
class nsAttrAndChildArray;
|
||||
class nsAttrChildContentList;
|
||||
class nsChildContentList;
|
||||
struct nsCSSSelectorList;
|
||||
class nsDOMAttributeMap;
|
||||
class nsIAnimationObserver;
|
||||
@ -1114,7 +1114,7 @@ public:
|
||||
* @see nsIDOMNodeList
|
||||
* @see nsGenericHTMLElement::GetChildNodes
|
||||
*/
|
||||
RefPtr<nsAttrChildContentList> mChildNodes;
|
||||
RefPtr<nsChildContentList> mChildNodes;
|
||||
|
||||
/**
|
||||
* Weak reference to this node. This is cleared by the destructor of
|
||||
|
Loading…
Reference in New Issue
Block a user