Issue #unknown, Reload Flooding prevention.

This commit is contained in:
roytam1 2021-12-14 22:54:20 +08:00
commit 26ae6482f6
3 changed files with 55 additions and 0 deletions

View file

@ -1058,6 +1058,15 @@ private:
const int32_t kStateUpdateLimit = 50;
const double kRefreshTimeSecs = 10.0;
// Keep track how how many history state changes we're getting, to catch &
// prevent flooding.
int32_t mReloadFloodGuardCount;
mozilla::TimeStamp mReloadFloodGuardUpdated;
bool mReloadFloodGuardReported;
// We have a limit of reloading 50 times every 10 seconds.
const int32_t kReloadLimit = 50;
const double kReloadTimeSecs = 10.0;
// Separate function to do the actual name (i.e. not _top, _self etc.)
// searching for FindItemWithName.
nsresult DoFindItemWithName(const nsAString& aName,
@ -1077,6 +1086,9 @@ private:
// ReplaceState.
bool IsStateChangeFlooding();
// Helper method for Reload which checks for excessive calls to Reload.
bool IsReloadFlooding();
#ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks
static unsigned long gNumberOfDocShells;