Bug 1064211 - Keep CustomElementData alive while on processing stack. r=mrbkap

This commit is contained in:
William Chen 2014-10-16 11:53:36 -07:00
parent a4109cfb8e
commit b9df016d99
3 changed files with 9 additions and 9 deletions

View File

@ -412,7 +412,7 @@ public:
/**
* Web components custom element data.
*/
nsAutoPtr<CustomElementData> mCustomElementData;
nsRefPtr<CustomElementData> mCustomElementData;
};
protected:

View File

@ -5844,12 +5844,7 @@ nsDocument::ProcessTopElementQueue(bool aIsBaseQueue)
{
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
if (sProcessingStack.isNothing()) {
// If XPCOM shutdown has reset the processing stack, don't do anything.
return;
}
nsTArray<CustomElementData*>& stack = *sProcessingStack;
nsTArray<nsRefPtr<CustomElementData>>& stack = *sProcessingStack;
uint32_t firstQueue = stack.LastIndexOf((CustomElementData*) nullptr);
if (aIsBaseQueue && firstQueue != 0) {
@ -5886,7 +5881,7 @@ nsDocument::RegisterEnabled()
}
// static
Maybe<nsTArray<mozilla::dom::CustomElementData*>>
Maybe<nsTArray<nsRefPtr<mozilla::dom::CustomElementData>>>
nsDocument::sProcessingStack;
// static

View File

@ -325,6 +325,8 @@ private:
// being created flag.
struct CustomElementData
{
NS_INLINE_DECL_REFCOUNTING(CustomElementData)
explicit CustomElementData(nsIAtom* aType);
// Objects in this array are transient and empty after each microtask
// checkpoint.
@ -346,6 +348,9 @@ struct CustomElementData
// Empties the callback queue.
void RunCallbackQueue();
private:
virtual ~CustomElementData() {}
};
// The required information for a custom element as defined in:
@ -1520,7 +1525,7 @@ private:
// CustomElementData in this array, separated by nullptr that
// represent the boundaries of the items in the stack. The first
// queue in the stack is the base element queue.
static mozilla::Maybe<nsTArray<mozilla::dom::CustomElementData*>> sProcessingStack;
static mozilla::Maybe<nsTArray<nsRefPtr<mozilla::dom::CustomElementData>>> sProcessingStack;
// Flag to prevent re-entrance into base element queue as described in the
// custom elements speicification.