browser_storage_cache_error.js (1201B)
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 // Test handling errors in CacheStorage 8 9 add_task(async function () { 10 // Open the URL in a private browsing window. 11 const win = await BrowserTestUtils.openNewBrowserWindow({ private: true }); 12 const tab = win.gBrowser.selectedBrowser; 13 const triggeringPrincipal = 14 Services.scriptSecurityManager.getSystemPrincipal(); 15 tab.loadURI( 16 Services.io.newURI(ALT_DOMAIN_SECURED + "storage-cache-error.html"), 17 { triggeringPrincipal } 18 ); 19 await BrowserTestUtils.browserLoaded(tab); 20 21 // On enumerating cache storages, CacheStorage::Keys would throw a 22 // DOM security exception. We'd like to verify storage panel still work in 23 // this case. 24 await openStoragePanel({ tab: win.gBrowser.selectedTab }); 25 26 const cacheItemId = ["Cache", "https://test2.example.org"]; 27 28 await selectTreeItem(cacheItemId); 29 ok( 30 gUI.tree.isSelected(cacheItemId), 31 `The item ${cacheItemId.join(" > ")} is present in the tree` 32 ); 33 34 await BrowserTestUtils.closeWindow(win); 35 });