test_localStorageArchiveDowngrade.js (2014B)
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 local storage directories are removed 8 * during local storage archive downgrade from any future version to current 9 * version. See bug 1546305. 10 */ 11 12 async function testSteps() { 13 const lsDirs = [ 14 "storage/default/http+++example.com/ls", 15 "storage/default/http+++localhost/ls", 16 "storage/default/http+++www.mozilla.org/ls", 17 ]; 18 19 info("Clearing"); 20 21 let request = clear(); 22 await requestFinished(request); 23 24 info("Installing package"); 25 26 // The profile contains three initialized origin directories with local 27 // storage data, local storage archive, a script for origin initialization, 28 // the storage database and the web apps store database: 29 // - storage/default/https+++example.com 30 // - storage/default/https+++localhost 31 // - storage/default/https+++www.mozilla.org 32 // - storage/ls-archive.sqlite 33 // - create_db.js 34 // - storage.sqlite 35 // - webappsstore.sqlite 36 // The file create_db.js in the package was run locally (with a build that 37 // supports local storage archive upgrades and local storage archive version 38 // set to max integer), specifically it was temporarily added to xpcshell.toml 39 // and then executed: 40 // mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js 41 // Note: to make it become the profile in the test, additional manual steps 42 // are needed. 43 // 1. Remove the folder "storage/temporary". 44 installPackage("localStorageArchiveDowngrade_profile"); 45 46 info("Checking ls dirs"); 47 48 for (let lsDir of lsDirs) { 49 let dir = getRelativeFile(lsDir); 50 51 exists = dir.exists(); 52 ok(exists, "ls directory does exist"); 53 } 54 55 request = init(); 56 request = await requestFinished(request); 57 58 info("Checking ls dirs"); 59 60 for (let lsDir of lsDirs) { 61 let dir = getRelativeFile(lsDir); 62 63 exists = dir.exists(); 64 ok(!exists, "ls directory doesn't exist"); 65 } 66 }