tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit eda45505a425ddf1969bb6561e689f9a497e70fb
parent 1a8c62b86277005f907151bc5389cf5c5091e76f
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Sun,  2 Nov 2025 10:34:32 +0000

Bug 1997769 - Remove unnecessary weak reference nsCaret::mPresShell. r=layout-reviewers,TYLin

Differential Revision: https://phabricator.services.mozilla.com/D270955

Diffstat:
Mlayout/base/nsCaret.cpp | 10----------
Mlayout/base/nsCaret.h | 1-
2 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp @@ -57,10 +57,6 @@ nsCaret::~nsCaret() { StopBlinking(); } nsresult nsCaret::Init(PresShell* aPresShell) { NS_ENSURE_ARG(aPresShell); - mPresShell = - do_GetWeakReference(aPresShell); // the presshell owns us, so no addref - NS_ASSERTION(mPresShell, "Hey, pres shell should support weak refs"); - RefPtr<Selection> selection = aPresShell->GetSelection(nsISelectionController::SELECTION_NORMAL); if (!selection) { @@ -127,7 +123,6 @@ void nsCaret::Terminate() { mDomSelectionWeak->RemoveSelectionListener(this); } mDomSelectionWeak = nullptr; - mPresShell = nullptr; mCaretPosition = {}; } @@ -632,11 +627,6 @@ void nsCaret::StopBlinking() { size_t nsCaret::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t total = aMallocSizeOf(this); - if (mPresShell) { - // We only want the size of the nsWeakReference object, not the PresShell - // (since we don't own the PresShell). - total += mPresShell->SizeOfOnlyThis(aMallocSizeOf); - } if (mBlinkTimer) { total += mBlinkTimer->SizeOfIncludingThis(aMallocSizeOf); } diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h @@ -198,7 +198,6 @@ class nsCaret final : public nsISelectionListener { // invalidates paint as needed. void UpdateCaretPositionFromSelectionIfNeeded(); - nsWeakPtr mPresShell; mozilla::WeakPtr<mozilla::dom::Selection> mDomSelectionWeak; nsCOMPtr<nsITimer> mBlinkTimer;