browser_toolbox_options_disable_cache-02.js (1699B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 requestLongerTimeout(2); 7 8 // Tests that disabling the cache for a tab works as it should when toolboxes 9 // are toggled. 10 /* import-globals-from helper_disable_cache.js */ 11 loadHelperScript("helper_disable_cache.js"); 12 13 add_task(async function () { 14 // Disable rcwn to make cache behavior deterministic. 15 await pushPref("network.http.rcwn.enabled", false); 16 17 // Ensure that the setting is cleared after the test. 18 registerCleanupFunction(() => { 19 info("Resetting devtools.cache.disabled to false."); 20 Services.prefs.setBoolPref("devtools.cache.disabled", false); 21 }); 22 23 // Initialise tabs: 1 and 2 with a toolbox, 3 and 4 without. 24 for (const tab of tabs) { 25 await initTab(tab, tab.startToolbox); 26 } 27 28 // Disable cache in tab 0 29 await setDisableCacheCheckboxChecked(tabs[0], true); 30 31 // Open toolbox in tab 2 and ensure the cache is then disabled. 32 tabs[2].toolbox = await gDevTools.showToolboxForTab(tabs[2].tab, { 33 toolId: "options", 34 }); 35 await checkCacheEnabled(tabs[2], false); 36 37 // Close toolbox in tab 2 and ensure the cache is enabled again 38 await tabs[2].toolbox.destroy(); 39 await checkCacheEnabled(tabs[2], true); 40 41 // Open toolbox in tab 2 and ensure the cache is then disabled. 42 tabs[2].toolbox = await gDevTools.showToolboxForTab(tabs[2].tab, { 43 toolId: "options", 44 }); 45 await checkCacheEnabled(tabs[2], false); 46 47 // Check the checkbox in tab 2 and ensure cache is enabled for all tabs. 48 await setDisableCacheCheckboxChecked(tabs[2], false); 49 await checkCacheStateForAllTabs([true, true, true, true]); 50 51 await finishUp(); 52 });