diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 62738afe629f..396903971228 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -11114,7 +11114,9 @@ nsDocShell::AddState(JS::Handle aData, const nsAString& aTitle, } // Check that the state object isn't too long. - int32_t maxStateObjSize = StaticPrefs::browser_history_maxStateObjectSize(); + // Default max length: 2097152 (0x200000) bytes. + int32_t maxStateObjSize = + Preferences::GetInt("browser.history.maxStateObjectSize", 2097152); if (maxStateObjSize < 0) { maxStateObjSize = 0; } diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini index e5b1a36d743c..2e6d9f7c1da0 100644 --- a/docshell/test/navigation/mochitest.ini +++ b/docshell/test/navigation/mochitest.ini @@ -170,7 +170,6 @@ support-files = file_sessionhistory_iframe_removal.html [test_bug1326251.html] skip-if = toolkit == 'android' || sessionHistoryInParent # It relies on the bfcache [test_bug1379762.html] -[test_state_size.html] [test_static_and_dynamic.html] skip-if = true # This was disabled for a few years now anyway, bug 1677544 [test_sibling-matching-parent.html] diff --git a/docshell/test/navigation/test_state_size.html b/docshell/test/navigation/test_state_size.html deleted file mode 100644 index f089a460eccd..000000000000 --- a/docshell/test/navigation/test_state_size.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Test the max size of the data parameter of push/replaceState - - - - - -

- -

-
-
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 019bb07661e8..f69b662d12b8 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -1174,12 +1174,6 @@
   value: 2000
   mirror: always
 
-# Max size of push/replaceState data parameter
-- name: browser.history.maxStateObjectSize
-  type: int32_t
-  value: 16777216
-  mirror: always
-
 #ifdef XP_WIN
   # Notify TabUnloader or send the memory pressure if the memory resource
   # notification is signaled AND the available commit space is lower than
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 0033f645bafd..ed580368e3ab 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3756,6 +3756,9 @@ pref("browser.region.update.enabled", true);
 // Enable/Disable the device storage API for content
 pref("device.storage.enabled", false);
 
+// Push/Pop/Replace State prefs
+pref("browser.history.maxStateObjectSize", 2097152);
+
 pref("browser.meta_refresh_when_inactive.disabled", false);
 
 // XPInstall prefs