browser_storage_fission_cache.js (1470B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5) 8 // All instances of addPermission and removePermission set up 3rd-party storage 9 // access in a way that allows the test to proceed with TCP enabled. 10 11 add_task(async function () { 12 // open tab 13 const URL = URL_ROOT_COM_SSL + "storage-cache-basic.html"; 14 await SpecialPowers.addPermission( 15 "3rdPartyStorage^https://example.net", 16 true, 17 URL 18 ); 19 await openTabAndSetupStorage(URL); 20 const doc = gPanelWindow.document; 21 22 // check that host appears in the storage tree 23 checkTree(doc, ["Cache", "https://example.com", "lorem"]); 24 checkTree(doc, ["Cache", "https://example.net", "foo"]); 25 // Check top level page 26 await selectTreeItem(["Cache", "https://example.com", "lorem"]); 27 checkCacheData(URL_ROOT_COM_SSL + "storage-blank.html", "OK"); 28 // Check iframe 29 await selectTreeItem(["Cache", "https://example.net", "foo"]); 30 checkCacheData(URL_ROOT_NET_SSL + "storage-blank.html", "OK"); 31 32 await SpecialPowers.removePermission( 33 "3rdPartyStorage^http://example.net", 34 URL 35 ); 36 }); 37 38 function checkCacheData(url, status) { 39 is( 40 gUI.table.items.get(url)?.status, 41 status, 42 `Table row has an entry for: ${url} with status: ${status}` 43 ); 44 }