Backed out changeset 2e7615b554ee (bug 1355441) for crashing at nsHtml5TreeBuilder::getUnusedStackNode() intermittent failures

This commit is contained in:
Iris Hsiao
2017-05-09 17:11:28 +08:00
parent b1f0122521
commit 314d76a0b8
10 changed files with 192 additions and 486 deletions

View File

@@ -86,101 +86,90 @@ nsHtml5StackNode::isHtmlIntegrationPoint()
}
nsHtml5StackNode::nsHtml5StackNode(int32_t idxInTreeBuilder)
: idxInTreeBuilder(idxInTreeBuilder),
refcount(0)
nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
: flags(flags),
name(name),
popName(popName),
ns(ns),
node(node),
attributes(attributes),
refcount(1)
{
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
void
nsHtml5StackNode::setValues(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node)
: flags(elementName->getFlags())
, name(elementName->getName())
, popName(elementName->getName())
, ns(kNameSpaceID_XHTML)
, node(node)
, attributes(nullptr)
, refcount(1)
{
MOZ_ASSERT(isUnused());
this->flags = flags;
this->name = name;
this->popName = popName;
this->ns = ns;
this->node = node;
this->attributes = attributes;
this->refcount = 1;
MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(),
"Don't use this constructor for custom elements.");
}
void
nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node)
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes)
: flags(elementName->getFlags())
, name(elementName->getName())
, popName(elementName->getName())
, ns(kNameSpaceID_XHTML)
, node(node)
, attributes(attributes)
, refcount(1)
{
MOZ_ASSERT(isUnused());
this->flags = elementName->getFlags();
this->name = elementName->getName();
this->popName = elementName->getName();
this->ns = kNameSpaceID_XHTML;
this->node = node;
this->attributes = nullptr;
this->refcount = 1;
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
MOZ_COUNT_CTOR(nsHtml5StackNode);
MOZ_ASSERT(elementName->isInterned(),
"Don't use this constructor for custom elements.");
}
void
nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes)
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName)
: flags(elementName->getFlags())
, name(elementName->getName())
, popName(popName)
, ns(kNameSpaceID_XHTML)
, node(node)
, attributes(nullptr)
, refcount(1)
{
MOZ_ASSERT(isUnused());
this->flags = elementName->getFlags();
this->name = elementName->getName();
this->popName = elementName->getName();
this->ns = kNameSpaceID_XHTML;
this->node = node;
this->attributes = attributes;
this->refcount = 1;
MOZ_ASSERT(elementName->isInterned(), "Don't use this constructor for custom elements.");
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
void
nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName)
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
nsIAtom* popName,
nsIContentHandle* node)
: flags(prepareSvgFlags(elementName->getFlags()))
, name(elementName->getName())
, popName(popName)
, ns(kNameSpaceID_SVG)
, node(node)
, attributes(nullptr)
, refcount(1)
{
MOZ_ASSERT(isUnused());
this->flags = elementName->getFlags();
this->name = elementName->getName();
this->popName = popName;
this->ns = kNameSpaceID_XHTML;
this->node = node;
this->attributes = nullptr;
this->refcount = 1;
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
void
nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
nsIAtom* popName,
nsIContentHandle* node)
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName,
bool markAsIntegrationPoint)
: flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint))
, name(elementName->getName())
, popName(popName)
, ns(kNameSpaceID_MathML)
, node(node)
, attributes(nullptr)
, refcount(1)
{
MOZ_ASSERT(isUnused());
this->flags = prepareSvgFlags(elementName->getFlags());
this->name = elementName->getName();
this->popName = popName;
this->ns = kNameSpaceID_SVG;
this->node = node;
this->attributes = nullptr;
this->refcount = 1;
}
void
nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName,
bool markAsIntegrationPoint)
{
MOZ_ASSERT(isUnused());
this->flags = prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint);
this->name = elementName->getName();
this->popName = popName;
this->ns = kNameSpaceID_MathML;
this->node = node;
this->attributes = nullptr;
this->refcount = 1;
MOZ_COUNT_CTOR(nsHtml5StackNode);
}
int32_t
@@ -215,6 +204,7 @@ nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
nsHtml5StackNode::~nsHtml5StackNode()
{
MOZ_COUNT_DTOR(nsHtml5StackNode);
delete attributes;
}
void
@@ -230,22 +220,14 @@ nsHtml5StackNode::retain()
}
void
nsHtml5StackNode::release(nsHtml5TreeBuilder* owningTreeBuilder)
nsHtml5StackNode::release()
{
refcount--;
MOZ_ASSERT(refcount >= 0);
if (!refcount) {
delete attributes;
owningTreeBuilder->notifyUnusedStackNode(idxInTreeBuilder);
delete this;
}
}
bool
nsHtml5StackNode::isUnused()
{
return !refcount;
}
void
nsHtml5StackNode::initializeStatics()
{