Bug 1728727 - Remove unused code in TabListener. r=kashav

Differential Revision: https://phabricator.services.mozilla.com/D124316
This commit is contained in:
Andreas Farre 2021-09-03 12:20:05 +00:00
Родитель 3bc6e00826
Коммит fdd13237fc
2 изменённых файлов: 2 добавлений и 61 удалений

Просмотреть файл

@ -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<nsCString>& aPositions,
nsTArray<int32_t>& 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;

Просмотреть файл

@ -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,