From 675dce947209afa61950777a7e13016604b3fdb1 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 06:11:43 -0400 Subject: Bug 1382357 - Wait to destroy frames until after we've successfully fetched the binding Tag #1375 --- dom/xbl/nsXBLService.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'dom/xbl/nsXBLService.cpp') diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index 1475b1368..3f98eefe0 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -115,7 +115,15 @@ public: if (!doc) return; - // Destroy the frames for mBoundElement. + // Get the binding. + bool ready = false; + nsXBLService::GetInstance()->BindingReady(mBoundElement, mBindingURI, &ready); + if (!ready) + return; + + // Destroy the frames for mBoundElement. Do this after getting the binding, + // since if the binding fetch fails then we don't want to destroy the + // frames. nsIContent* destroyedFramesFor = nullptr; nsIPresShell* shell = doc->GetShell(); if (shell) { @@ -123,12 +131,6 @@ public: } MOZ_ASSERT(!mBoundElement->GetPrimaryFrame()); - // Get the binding. - bool ready = false; - nsXBLService::GetInstance()->BindingReady(mBoundElement, mBindingURI, &ready); - if (!ready) - return; - // If |mBoundElement| is (in addition to having binding |mBinding|) // also a descendant of another element with binding |mBinding|, // then we might have just constructed it due to the -- cgit v1.2.3 From e482e335bb8de6630a171cd0a784b420d91106b2 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 06:14:10 -0400 Subject: Bug 1389743 - Only reconstruct frames synchronously from ContentRemoved when called from frame construction Tag #1375 --- dom/xbl/nsXBLService.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'dom/xbl/nsXBLService.cpp') diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index 3f98eefe0..ef0d20564 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -124,38 +124,10 @@ public: // Destroy the frames for mBoundElement. Do this after getting the binding, // since if the binding fetch fails then we don't want to destroy the // frames. - nsIContent* destroyedFramesFor = nullptr; - nsIPresShell* shell = doc->GetShell(); - if (shell) { - shell->DestroyFramesFor(mBoundElement, &destroyedFramesFor); + if (nsIPresShell* shell = doc->GetShell()) { + shell->DestroyFramesFor(mBoundElement->AsElement()); } MOZ_ASSERT(!mBoundElement->GetPrimaryFrame()); - - // If |mBoundElement| is (in addition to having binding |mBinding|) - // also a descendant of another element with binding |mBinding|, - // then we might have just constructed it due to the - // notification of its parent. (We can know about both if the - // binding loads were triggered from the DOM rather than frame - // construction.) So we have to check both whether the element - // has a primary frame and whether it's in the frame manager maps - // before sending a ContentInserted notification, or bad things - // will happen. - MOZ_ASSERT(shell == doc->GetShell()); - if (shell) { - nsIFrame* childFrame = mBoundElement->GetPrimaryFrame(); - if (!childFrame) { - // Check to see if it's in the undisplayed content map... - nsFrameManager* fm = shell->FrameManager(); - nsStyleContext* sc = fm->GetUndisplayedContent(mBoundElement); - if (!sc) { - // or in the display:contents map. - sc = fm->GetDisplayContentsStyleFor(mBoundElement); - } - if (!sc) { - shell->CreateFramesFor(destroyedFramesFor); - } - } - } } nsXBLBindingRequest(nsIURI* aURI, nsIContent* aBoundElement) -- cgit v1.2.3 From 96dfc63bc583454fb895c7a23f685995f5410388 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 06:41:41 -0400 Subject: Bug 1411754 - Rename PresShell::DestroyFramesFor to DestroyFramesForAndRestyle Tag #1375 --- dom/xbl/nsXBLService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dom/xbl/nsXBLService.cpp') diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index ef0d20564..b50b2c6fe 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -125,7 +125,7 @@ public: // since if the binding fetch fails then we don't want to destroy the // frames. if (nsIPresShell* shell = doc->GetShell()) { - shell->DestroyFramesFor(mBoundElement->AsElement()); + shell->DestroyFramesForAndRestyle(mBoundElement->AsElement()); } MOZ_ASSERT(!mBoundElement->GetPrimaryFrame()); } -- cgit v1.2.3