summaryrefslogtreecommitdiffstats
path: root/docshell/base/nsDocShell.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-02-16 12:13:16 +0000
committerMoonchild <moonchild@palemoon.org>2021-02-16 12:13:16 +0000
commit2103a2283b68d0bc147905259f5d7ac94bce6f60 (patch)
treefbf66b790e1af8580d54a22473759ca514587482 /docshell/base/nsDocShell.h
parent8f663e3bcd14cb2a6a25771f51620233f276ec05 (diff)
downloadUXP-2103a2283b68d0bc147905259f5d7ac94bce6f60.tar
UXP-2103a2283b68d0bc147905259f5d7ac94bce6f60.tar.gz
UXP-2103a2283b68d0bc147905259f5d7ac94bce6f60.tar.lz
UXP-2103a2283b68d0bc147905259f5d7ac94bce6f60.tar.xz
UXP-2103a2283b68d0bc147905259f5d7ac94bce6f60.zip
Issue #1688 - Add flood guard to state change logic.
Diffstat (limited to 'docshell/base/nsDocShell.h')
-rw-r--r--docshell/base/nsDocShell.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index 93a1ba68d..019a7e4ab 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -1049,6 +1049,15 @@ private:
// as constants in the nsIDocShell.idl file.
uint32_t mTouchEventsOverride;
+ // Keep track how how many history state changes we're getting, to catch &
+ // prevent flooding.
+ int32_t mStateFloodGuardCount;
+ mozilla::TimeStamp mStateFloodGuardUpdated;
+ bool mStateFloodGuardReported;
+ // We have a limit of pushing 50 states to history every 10 seconds.
+ const int32_t kStateUpdateLimit = 50;
+ const double kRefreshTimeSecs = 10.0;
+
// Separate function to do the actual name (i.e. not _top, _self etc.)
// searching for FindItemWithName.
nsresult DoFindItemWithName(const nsAString& aName,
@@ -1064,6 +1073,10 @@ private:
void MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
const nsString& aKeyword);
+ // Helper method for AddState which checks for excessive calls to PushState or
+ // ReplaceState.
+ bool IsStateChangeFlooding();
+
#ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks
static unsigned long gNumberOfDocShells;