test_groupMismatch.js (1472B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 /** 7 * This test is mainly to verify that metadata files with old group information 8 * get updated, so writing to local storage won't cause a crash because of null 9 * quota object. See bug 1516333. 10 */ 11 12 add_task(async function testSteps() { 13 const principal = getPrincipal("https://foo.bar.mozilla-iot.org"); 14 15 info("Clearing"); 16 17 let request = clear(); 18 await requestFinished(request); 19 20 info("Installing package"); 21 22 // The profile contains one initialized origin directory, a script for origin 23 // initialization and the storage database: 24 // - storage/default/https+++foo.bar.mozilla-iot.org 25 // - create_db.js 26 // - storage.sqlite 27 // The file create_db.js in the package was run locally, specifically it was 28 // temporarily added to xpcshell.toml and then executed: 29 // mach xpcshell-test --interactive dom/localstorage/test/unit/create_db.js 30 // Note: to make it become the profile in the test, additional manual steps 31 // are needed. 32 // 1. Manually change the group in .metadata and .metadata-v2 from 33 // "bar.mozilla-iot.org" to "mozilla-iot.org". 34 // 2. Remove the folder "storage/temporary". 35 // 3. Remove the file "storage/ls-archive.sqlite". 36 installPackage("groupMismatch_profile"); 37 38 info("Getting storage"); 39 40 let storage = getLocalStorage(principal); 41 42 info("Adding item"); 43 44 storage.setItem("foo", "bar"); 45 });