diff options
Diffstat (limited to 'dom/xul/nsXULElement.cpp')
-rw-r--r-- | dom/xul/nsXULElement.cpp | 52 |
1 files changed, 10 insertions, 42 deletions
diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index e351a46eb..a854f53ec 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -174,33 +174,6 @@ nsXULElement::~nsXULElement() { } -nsXULElement::nsXULSlots::nsXULSlots() - : nsXULElement::nsDOMSlots() -{ -} - -nsXULElement::nsXULSlots::~nsXULSlots() -{ - NS_IF_RELEASE(mControllers); // Forces release - nsCOMPtr<nsIFrameLoader> frameLoader = do_QueryInterface(mFrameLoaderOrOpener); - if (frameLoader) { - static_cast<nsFrameLoader*>(frameLoader.get())->Destroy(); - } -} - -void -nsXULElement::nsXULSlots::Traverse(nsCycleCollectionTraversalCallback &cb) -{ - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mFrameLoaderOrOpener"); - cb.NoteXPCOMChild(mFrameLoaderOrOpener); -} - -nsINode::nsSlots* -nsXULElement::CreateSlots() -{ - return new nsXULSlots(); -} - void nsXULElement::MaybeUpdatePrivateLifetime() { @@ -326,12 +299,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement, nsStyledElement) - { - nsXULSlots* slots = static_cast<nsXULSlots*>(tmp->GetExistingSlots()); - if (slots) { - slots->Traverse(cb); - } - } + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULElement, @@ -895,9 +863,9 @@ nsXULElement::UnbindFromTree(bool aDeep, bool aNullParent) // mDocument in nsGlobalWindow::SetDocShell, but I'm not // sure whether that would fix all possible cycles through // mControllers.) - nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingDOMSlots()); + nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots(); if (slots) { - NS_IF_RELEASE(slots->mControllers); + slots->mControllers = nullptr; RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(); if (frameLoader) { frameLoader->Destroy(); @@ -1241,9 +1209,9 @@ nsXULElement::RemoveBroadcaster(const nsAString & broadcasterId) void nsXULElement::DestroyContent() { - nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingDOMSlots()); + nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots(); if (slots) { - NS_IF_RELEASE(slots->mControllers); + slots->mControllers = nullptr; RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(); if (frameLoader) { frameLoader->Destroy(); @@ -1473,7 +1441,7 @@ nsIControllers* nsXULElement::GetControllers(ErrorResult& rv) { if (! Controllers()) { - nsDOMSlots* slots = DOMSlots(); + nsExtendedDOMSlots* slots = ExtendedDOMSlots(); rv = NS_NewXULControllers(nullptr, NS_GET_IID(nsIControllers), reinterpret_cast<void**>(&slots->mControllers)); @@ -1578,7 +1546,7 @@ nsXULElement::LoadSrc() RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(); if (!frameLoader) { // Check if we have an opener we need to be setting - nsXULSlots* slots = static_cast<nsXULSlots*>(Slots()); + nsExtendedDOMSlots* slots = ExtendedDOMSlots(); nsCOMPtr<nsPIDOMWindowOuter> opener = do_QueryInterface(slots->mFrameLoaderOrOpener); if (!opener) { // If we are a content-primary xul-browser, we want to take the opener property! @@ -1624,7 +1592,7 @@ nsXULElement::GetFrameLoaderXPCOM(nsIFrameLoader **aFrameLoader) already_AddRefed<nsFrameLoader> nsXULElement::GetFrameLoader() { - nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingSlots()); + nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots(); if (!slots) return nullptr; @@ -1646,7 +1614,7 @@ nsXULElement::GetParentApplication(mozIApplication** aApplication) void nsXULElement::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv) { - nsXULSlots* slots = static_cast<nsXULSlots*>(Slots()); + nsExtendedDOMSlots* slots = ExtendedDOMSlots(); MOZ_ASSERT(!slots->mFrameLoaderOrOpener, "A frameLoader or opener is present when calling PresetOpenerWindow"); slots->mFrameLoaderOrOpener = aWindow; @@ -1662,7 +1630,7 @@ nsXULElement::SetIsPrerendered() void nsXULElement::InternalSetFrameLoader(nsIFrameLoader* aNewFrameLoader) { - nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingDOMSlots()); + nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots(); MOZ_ASSERT(slots); slots->mFrameLoaderOrOpener = aNewFrameLoader; |