From fdd13237fcff2692404313b731a4ee0cba9e8ecb Mon Sep 17 00:00:00 2001 From: Andreas Farre Date: Fri, 3 Sep 2021 12:20:05 +0000 Subject: [PATCH] Bug 1728727 - Remove unused code in TabListener. r=kashav Differential Revision: https://phabricator.services.mozilla.com/D124316 --- .../sessionstore/SessionStoreListener.cpp | 55 +------------------ .../sessionstore/SessionStoreListener.h | 8 +-- 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/toolkit/components/sessionstore/SessionStoreListener.cpp b/toolkit/components/sessionstore/SessionStoreListener.cpp index 37ab181f47a8..ed06d8e7a79d 100644 --- a/toolkit/components/sessionstore/SessionStoreListener.cpp +++ b/toolkit/components/sessionstore/SessionStoreListener.cpp @@ -44,8 +44,7 @@ ContentSessionStore::ContentSessionStore(nsIDocShell* aDocShell) mPrivateChanged(false), mIsPrivate(false), mDocCapChanged(false), - mSHistoryChanged(false), - mSHistoryChangedFromParent(false) { + mSHistoryChanged(false) { MOZ_ASSERT(mDocShell); // Check that value at startup as it might have // been set before the frame script was loaded. @@ -106,11 +105,6 @@ void ContentSessionStore::SetSHistoryChanged() { mSHistoryChanged = mozilla::SessionHistoryInParent(); } -// Request "collect sessionHistory" from the parent process -void ContentSessionStore::SetSHistoryFromParentChanged() { - mSHistoryChangedFromParent = mozilla::SessionHistoryInParent(); -} - void ContentSessionStore::OnDocumentStart() { nsCString caps = CollectDocShellCapabilities(); if (!mDocCaps.Equals(caps)) { @@ -390,53 +384,6 @@ nsresult TabListener::Observe(nsISupports* aSubject, const char* aTopic, return NS_ERROR_UNEXPECTED; } -nsCString CollectPosition(Document& aDocument) { - PresShell* presShell = aDocument.GetPresShell(); - if (!presShell) { - return ""_ns; - } - nsPoint scrollPos = presShell->GetVisualViewportOffset(); - int scrollX = nsPresContext::AppUnitsToIntCSSPixels(scrollPos.x); - int scrollY = nsPresContext::AppUnitsToIntCSSPixels(scrollPos.y); - if ((scrollX != 0) || (scrollY != 0)) { - return nsPrintfCString("%d,%d", scrollX, scrollY); - } - - return ""_ns; -} - -int CollectPositions(BrowsingContext* aBrowsingContext, - nsTArray& aPositions, - nsTArray& aPositionDescendants) { - if (aBrowsingContext->CreatedDynamically()) { - return 0; - } - - nsPIDOMWindowOuter* window = aBrowsingContext->GetDOMWindow(); - if (!window) { - return 0; - } - - Document* document = window->GetDoc(); - if (!document) { - return 0; - } - - /* Collect data from current frame */ - aPositions.AppendElement(CollectPosition(*document)); - aPositionDescendants.AppendElement(0); - unsigned long currentIdx = aPositions.Length() - 1; - - /* Collect data from all child frame */ - // This is not going to work for fission. Bug 1572084 for tracking it. - for (auto& child : aBrowsingContext->Children()) { - aPositionDescendants[currentIdx] += - CollectPositions(child, aPositions, aPositionDescendants); - } - - return aPositionDescendants[currentIdx] + 1; -} - bool TabListener::ForceFlushFromParent() { if (!XRE_IsParentProcess()) { return false; diff --git a/toolkit/components/sessionstore/SessionStoreListener.h b/toolkit/components/sessionstore/SessionStoreListener.h index 9245f3697283..3d45f68ac509 100644 --- a/toolkit/components/sessionstore/SessionStoreListener.h +++ b/toolkit/components/sessionstore/SessionStoreListener.h @@ -33,19 +33,16 @@ class ContentSessionStore { void SetSHistoryChanged(); // request "collect sessionHistory" which is happened in the parent process - void SetSHistoryFromParentChanged(); bool GetAndClearSHistoryChanged() { bool ret = mSHistoryChanged; mSHistoryChanged = false; - mSHistoryChangedFromParent = false; return ret; } void OnDocumentStart(); void OnDocumentEnd(); bool UpdateNeeded() { - return mPrivateChanged || mDocCapChanged || mSHistoryChanged || - mSHistoryChangedFromParent; + return mPrivateChanged || mDocCapChanged || mSHistoryChanged; } private: @@ -63,9 +60,6 @@ class ContentSessionStore { // 2. webProgress changes to STATE_STOP // 3. receiving "DOMTitleChanged" event bool mSHistoryChanged; - // mSHistoryChangedFromParent means there are history changes which - // are found by session history listener in the parent process. - bool mSHistoryChangedFromParent; }; class TabListener : public nsIDOMEventListener,