slowRequestFinalization_child.js (787B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 const { PrincipalUtils } = ChromeUtils.importESModule( 7 "resource://testing-common/dom/quota/test/modules/PrincipalUtils.sys.mjs" 8 ); 9 10 const { LocalStorageUtils } = ChromeUtils.importESModule( 11 "resource://testing-common/dom/localstorage/test/modules/LocalStorageUtils.sys.mjs" 12 ); 13 14 add_task(async function testSteps() { 15 const principal = PrincipalUtils.createPrincipal("https://example.com"); 16 17 const storage = LocalStorageUtils.createStorage(principal); 18 19 try { 20 storage.getItem("foo"); 21 ok(false, "Should have thrown"); 22 } catch (e) { 23 ok(true, "Should have thrown"); 24 Assert.strictEqual(e.result, Cr.NS_ERROR_ABORT, "Threw right result code"); 25 } 26 });