Skip to content

Commit

Permalink
Merge pull request #129 from buttercookie42/historysize
Browse files Browse the repository at this point in the history
Bug 1542673, increase history.state size limit
  • Loading branch information
MrAlex94 authored Jun 21, 2022
2 parents 090feb2 + 89ee8ab commit 6cb6e7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12190,9 +12190,9 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
}

// Check that the state object isn't too long.
// Default max length: 640k bytes.
// Default max length: 2097152 (0x200000) bytes.
int32_t maxStateObjSize =
Preferences::GetInt("browser.history.maxStateObjectSize", 0xA0000);
Preferences::GetInt("browser.history.maxStateObjectSize", 2097152);
if (maxStateObjSize < 0) {
maxStateObjSize = 0;
}
Expand Down
8 changes: 7 additions & 1 deletion docshell/test/browser/file_multiple_pushState.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ <h1>Ohai</h1>
</body>
<script type="text/javascript">
window.history.pushState({}, "", "/bar/ABC?key=baz");
window.history.pushState({}, "", "/bar/ABC/DEF?key=baz");
let data = new Array(100000).join("a");
window.history.pushState({ data }, "", "/bar/ABC/DEF?key=baz");
// Test also Gecko specific state object size limit.
try {
let largeData = new Array(10000000).join("a");
window.history.pushState({ largeData }, "", "/bar/ABC/DEF/GHI?key=baz");
} catch (ex) {}
</script>
</html>
2 changes: 1 addition & 1 deletion modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4973,7 +4973,7 @@ pref("html5.flushtimer.initialdelay", 120);
pref("html5.flushtimer.subsequentdelay", 120);

// Push/Pop/Replace State prefs
pref("browser.history.maxStateObjectSize", 655360);
pref("browser.history.maxStateObjectSize", 2097152);

pref("browser.meta_refresh_when_inactive.disabled", false);

Expand Down

0 comments on commit 6cb6e7c

Please sign in to comment.