Attachment #8918162: P3: Backout changeset b679806ce7e3 (bug 1384661 part 1) for bug #1406395

View | Details | Raw Unified | Return to bug 1406395
Collapse All | Expand All

(-)a/dom/base/FragmentOrElement.cpp (-17 / +16 lines)
Line     Link Here 
 Lines 493-535   NeedsScriptTraverse(nsINode* aNode) Link Here 
493
493
494
//----------------------------------------------------------------------
494
//----------------------------------------------------------------------
495
495
496
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAttrChildContentList)
496
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsChildContentList)
497
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAttrChildContentList)
497
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsChildContentList)
498
498
499
// If nsAttrChildContentList is changed so that any additional fields are
499
// If nsChildContentList is changed so that any additional fields are
500
// traversed by the cycle collector, then CAN_SKIP must be updated to
500
// traversed by the cycle collector, then CAN_SKIP must be updated to
501
// check that the additional fields are null.
501
// check that the additional fields are null.
502
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsAttrChildContentList)
502
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsChildContentList)
503
503
504
// nsAttrChildContentList only ever has a single child, its wrapper, so if
504
// nsChildContentList only ever has a single child, its wrapper, so if
505
// the wrapper is known-live, the list can't be part of a garbage cycle.
505
// the wrapper is known-live, the list can't be part of a garbage cycle.
506
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsAttrChildContentList)
506
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsChildContentList)
507
  return tmp->HasKnownLiveWrapper();
507
  return tmp->HasKnownLiveWrapper();
508
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
508
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
509
509
510
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsAttrChildContentList)
510
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsChildContentList)
511
  return tmp->HasKnownLiveWrapperAndDoesNotNeedTracing(tmp);
511
  return tmp->HasKnownLiveWrapperAndDoesNotNeedTracing(tmp);
512
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
512
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
513
513
514
// CanSkipThis returns false to avoid problems with incomplete unlinking.
514
// CanSkipThis returns false to avoid problems with incomplete unlinking.
515
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsAttrChildContentList)
515
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsChildContentList)
516
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
516
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
517
517
518
NS_INTERFACE_TABLE_HEAD(nsAttrChildContentList)
518
NS_INTERFACE_TABLE_HEAD(nsChildContentList)
519
  NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
519
  NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
520
  NS_INTERFACE_TABLE(nsAttrChildContentList, nsINodeList, nsIDOMNodeList)
520
  NS_INTERFACE_TABLE(nsChildContentList, nsINodeList, nsIDOMNodeList)
521
  NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsAttrChildContentList)
521
  NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsChildContentList)
522
NS_INTERFACE_MAP_END
522
NS_INTERFACE_MAP_END
523
523
524
JSObject*
524
JSObject*
525
nsAttrChildContentList::WrapObject(JSContext *cx,
525
nsChildContentList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
526
                                   JS::Handle<JSObject*> aGivenProto)
527
{
526
{
528
  return NodeListBinding::Wrap(cx, this, aGivenProto);
527
  return NodeListBinding::Wrap(cx, this, aGivenProto);
529
}
528
}
530
529
531
NS_IMETHODIMP
530
NS_IMETHODIMP
532
nsAttrChildContentList::GetLength(uint32_t* aLength)
531
nsChildContentList::GetLength(uint32_t* aLength)
533
{
532
{
534
  *aLength = mNode ? mNode->GetChildCount() : 0;
533
  *aLength = mNode ? mNode->GetChildCount() : 0;
535
534
 Lines 537-543   nsAttrChildContentList::GetLength(uint32 Link Here 
537
}
536
}
538
537
539
NS_IMETHODIMP
538
NS_IMETHODIMP
540
nsAttrChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
539
nsChildContentList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
541
{
540
{
542
  nsINode* node = Item(aIndex);
541
  nsINode* node = Item(aIndex);
543
  if (!node) {
542
  if (!node) {
 Lines 550-556   nsAttrChildContentList::Item(uint32_t aI Link Here 
550
}
549
}
551
550
552
nsIContent*
551
nsIContent*
553
nsAttrChildContentList::Item(uint32_t aIndex)
552
nsChildContentList::Item(uint32_t aIndex)
554
{
553
{
555
  if (mNode) {
554
  if (mNode) {
556
    return mNode->GetChildAt(aIndex);
555
    return mNode->GetChildAt(aIndex);
 Lines 560-566   nsAttrChildContentList::Item(uint32_t aI Link Here 
560
}
559
}
561
560
562
int32_t
561
int32_t
563
nsAttrChildContentList::IndexOf(nsIContent* aContent)
562
nsChildContentList::IndexOf(nsIContent* aContent)
564
{
563
{
565
  if (mNode) {
564
  if (mNode) {
566
    return mNode->IndexOf(aContent);
565
    return mNode->IndexOf(aContent);
(-)a/dom/base/nsChildContentList.h (-6 / +5 lines)
Line     Link Here 
 Lines 20-39   class nsINode; Link Here 
20
 * and Item to its existing child list.
20
 * and Item to its existing child list.
21
 * @see nsIDOMNodeList
21
 * @see nsIDOMNodeList
22
 */
22
 */
23
class nsAttrChildContentList final : public nsINodeList
23
class nsChildContentList final : public nsINodeList
24
{
24
{
25
public:
25
public:
26
  explicit nsAttrChildContentList(nsINode* aNode)
26
  explicit nsChildContentList(nsINode* aNode)
27
    : mNode(aNode)
27
    : mNode(aNode)
28
  {
28
  {
29
  }
29
  }
30
30
31
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32
  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsAttrChildContentList)
32
  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList)
33
33
34
  // nsWrapperCache
34
  // nsWrapperCache
35
  virtual JSObject* WrapObject(JSContext *cx,
35
  virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
36
                               JS::Handle<JSObject*> aGivenProto) override;
37
36
38
  // nsIDOMNodeList interface
37
  // nsIDOMNodeList interface
39
  NS_DECL_NSIDOMNODELIST
38
  NS_DECL_NSIDOMNODELIST
 Lines 53-59   public: Link Here 
53
  }
52
  }
54
53
55
private:
54
private:
56
  ~nsAttrChildContentList() {}
55
  ~nsChildContentList() {}
57
56
58
  // The node whose children make up the list.
57
  // The node whose children make up the list.
59
  // This is a non-owning ref which is safe because it's set to nullptr by
58
  // This is a non-owning ref which is safe because it's set to nullptr by
(-)a/dom/base/nsINode.cpp (-1 / +1 lines)
Line     Link Here 
 Lines 409-415   nsINode::ChildNodes() Link Here 
409
{
409
{
410
  nsSlots* slots = Slots();
410
  nsSlots* slots = Slots();
411
  if (!slots->mChildNodes) {
411
  if (!slots->mChildNodes) {
412
    slots->mChildNodes = new nsAttrChildContentList(this);
412
    slots->mChildNodes = new nsChildContentList(this);
413
  }
413
  }
414
414
415
  return slots->mChildNodes;
415
  return slots->mChildNodes;
(-)a/dom/base/nsINode.h (-2 / +2 lines)
Line     Link Here 
 Lines 36-42    Link Here 
36
#endif
36
#endif
37
37
38
class nsAttrAndChildArray;
38
class nsAttrAndChildArray;
39
class nsAttrChildContentList;
39
class nsChildContentList;
40
struct nsCSSSelectorList;
40
struct nsCSSSelectorList;
41
class nsDOMAttributeMap;
41
class nsDOMAttributeMap;
42
class nsIAnimationObserver;
42
class nsIAnimationObserver;
 Lines 1114-1120   public: Link Here 
1114
     * @see nsIDOMNodeList
1114
     * @see nsIDOMNodeList
1115
     * @see nsGenericHTMLElement::GetChildNodes
1115
     * @see nsGenericHTMLElement::GetChildNodes
1116
     */
1116
     */
1117
    RefPtr<nsAttrChildContentList> mChildNodes;
1117
    RefPtr<nsChildContentList> mChildNodes;
1118
1118
1119
    /**
1119
    /**
1120
     * Weak reference to this node.  This is cleared by the destructor of
1120
     * Weak reference to this node.  This is cleared by the destructor of

Return to bug 1406395