summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/CustomElementRegistry.cpp')
-rw-r--r--dom/base/CustomElementRegistry.cpp77
1 files changed, 7 insertions, 70 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index 3d5432b07..2d7907bd7 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -21,39 +21,6 @@ CustomElementCallback::Call()
{
IgnoredErrorResult rv;
switch (mType) {
- case nsIDocument::eCreated:
- {
- // For the duration of this callback invocation, the element is being created
- // flag must be set to true.
- mOwnerData->mElementIsBeingCreated = true;
-
- // The callback hasn't actually been invoked yet, but we need to flip
- // this now in order to enqueue the connected callback. This is a spec
- // bug (w3c bug 27437).
- mOwnerData->mCreatedCallbackInvoked = true;
-
- // If ELEMENT is connected, enqueue connected callback for ELEMENT.
- nsIDocument* document = mThisObject->GetComposedDoc();
- if (document) {
- NodeInfo* ni = mThisObject->NodeInfo();
-
- // We need to do this because at this point, CustomElementDefinition is
- // not set to CustomElementData yet, so EnqueueLifecycleCallback will
- // fail to find the CE definition for this custom element.
- // This will go away eventually since there is no created callback in v1.
- CustomElementDefinition* definition =
- nsContentUtils::LookupCustomElementDefinition(document,
- ni->LocalName(), ni->NamespaceID(),
- mOwnerData->GetCustomElementType());
-
- nsContentUtils::EnqueueLifecycleCallback(
- nsIDocument::eConnected, mThisObject, nullptr, nullptr, definition);
- }
-
- static_cast<LifecycleCreatedCallback *>(mCallback.get())->Call(mThisObject, rv);
- mOwnerData->mElementIsBeingCreated = false;
- break;
- }
case nsIDocument::eConnected:
static_cast<LifecycleConnectedCallback *>(mCallback.get())->Call(mThisObject, rv);
break;
@@ -83,12 +50,10 @@ CustomElementCallback::Traverse(nsCycleCollectionTraversalCallback& aCb) const
CustomElementCallback::CustomElementCallback(Element* aThisObject,
nsIDocument::ElementCallbackType aCallbackType,
- mozilla::dom::CallbackFunction* aCallback,
- CustomElementData* aOwnerData)
+ mozilla::dom::CallbackFunction* aCallback)
: mThisObject(aThisObject),
mCallback(aCallback),
- mType(aCallbackType),
- mOwnerData(aOwnerData)
+ mType(aCallbackType)
{
}
@@ -131,9 +96,7 @@ CustomElementData::CustomElementData(nsIAtom* aType)
}
CustomElementData::CustomElementData(nsIAtom* aType, State aState)
- : mElementIsBeingCreated(false)
- , mCreatedCallbackInvoked(true)
- , mState(aState)
+ : mState(aState)
, mType(aType)
{
}
@@ -359,18 +322,12 @@ CustomElementRegistry::CreateCustomElementCallback(
{
MOZ_ASSERT(aDefinition, "CustomElementDefinition should not be null");
- RefPtr<CustomElementData> elementData = aCustomElement->GetCustomElementData();
- MOZ_ASSERT(elementData, "CustomElementData should exist");
+ MOZ_ASSERT(aCustomElement->GetCustomElementData(),
+ "CustomElementData should exist");
// Let CALLBACK be the callback associated with the key NAME in CALLBACKS.
CallbackFunction* func = nullptr;
switch (aType) {
- case nsIDocument::eCreated:
- if (aDefinition->mCallbacks->mCreatedCallback.WasPassed()) {
- func = aDefinition->mCallbacks->mCreatedCallback.Value();
- }
- break;
-
case nsIDocument::eConnected:
if (aDefinition->mCallbacks->mConnectedCallback.WasPassed()) {
func = aDefinition->mCallbacks->mConnectedCallback.Value();
@@ -401,17 +358,9 @@ CustomElementRegistry::CreateCustomElementCallback(
return nullptr;
}
- if (aType == nsIDocument::eCreated) {
- elementData->mCreatedCallbackInvoked = false;
- } else if (!elementData->mCreatedCallbackInvoked) {
- // Callbacks other than created callback must not be enqueued
- // until after the created callback has been invoked.
- return nullptr;
- }
-
// Add CALLBACK to ELEMENT's callback queue.
auto callback =
- MakeUnique<CustomElementCallback>(aCustomElement, aType, func, elementData);
+ MakeUnique<CustomElementCallback>(aCustomElement, aType, func);
if (aArgs) {
callback->SetArgs(*aArgs);
@@ -520,9 +469,7 @@ static const char* kLifeCycleCallbackNames[] = {
"connectedCallback",
"disconnectedCallback",
"adoptedCallback",
- "attributeChangedCallback",
- // The life cycle callbacks from v0 spec.
- "createdCallback"
+ "attributeChangedCallback"
};
static void
@@ -986,11 +933,6 @@ CustomElementRegistry::Upgrade(Element* aElement,
// Step 9.
aElement->SetCustomElementDefinition(aDefinition);
-
- // This is for old spec.
- nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eCreated,
- aElement, nullptr,
- nullptr, aDefinition);
}
//-----------------------------------------------------
@@ -1162,11 +1104,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CustomElementDefinition)
cb.NoteXPCOMChild(callbacks->mAttributeChangedCallback.Value());
}
- if (callbacks->mCreatedCallback.WasPassed()) {
- NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mCreatedCallback");
- cb.NoteXPCOMChild(callbacks->mCreatedCallback.Value());
- }
-
if (callbacks->mConnectedCallback.WasPassed()) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mConnectedCallback");
cb.NoteXPCOMChild(callbacks->mConnectedCallback.Value());