Bug 1268981 - Make sure the bfcache is enabled during the mobile session store form data test. r=margaret

Without the bfcache, the inner value will not be restored after a page navigation, therefore we need to make sure that the bfcache isn't disabled by a stray memory pressure event before or during the test.

MozReview-Commit-ID: 3k1EgGDEPb

--HG--
extra : transplant_source : %E7%C9%BCD%E3%A4P%7F%A8%04%F4%CE%96bw%D6PU%97%01
This commit is contained in:
Jan Henning 2016-04-30 16:46:57 +02:00
Родитель f6cdeb3863
Коммит e3e61e5c24
3 изменённых файлов: 15 добавлений и 1 удалений

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

@ -135,6 +135,7 @@ pref("browser.display.remotetabs.timeout", 10);
pref("browser.sessionhistory.max_total_viewers", 1);
pref("browser.sessionhistory.max_entries", 50);
pref("browser.sessionhistory.contentViewerTimeout", 360);
pref("browser.sessionhistory.bfcacheIgnoreMemoryPressure", false);
/* session store */
pref("browser.sessionstore.resume_session_once", false);

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

@ -37,7 +37,9 @@ var MemoryObserver = {
defaults.setIntPref("image.mem.max_decoded_image_kb", 0);
// Stop using the bfcache
defaults.setIntPref("browser.sessionhistory.max_total_viewers", 0);
if (!Services.prefs.getBoolPref("browser.sessionhistory.bfcacheIgnoreMemoryPressure")) {
defaults.setIntPref("browser.sessionhistory.max_total_viewers", 0);
}
},
zombify: function(tab) {

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

@ -193,6 +193,17 @@ add_task(function* test_formdata_navigation() {
const OUTER_VALUE = "browser_formdata_" + Math.random();
const INNER_VALUE = "browser_formdata_" + Math.random();
// Make sure the bfcache remains enabled during this test,
// otherwise the inner value will not be restored correctly.
Services.prefs.setBoolPref("browser.sessionhistory.bfcacheIgnoreMemoryPressure", true);
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers", 1);
SimpleTest.registerCleanupFunction(function() {
// Turn the bfcache memory pressure protection back off once we're finished.
Services.prefs.clearUserPref("browser.sessionhistory.bfcacheIgnoreMemoryPressure");
Services.prefs.clearUserPref("browser.sessionhistory.max_total_viewers");
});
// Creates a tab, loads a page with some form fields, modifies their values,
// navigates to a different page and back again and closes the tab.
function createNavigateAndRemoveTab() {