test_bug1425146.js (2612B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 // This test is mainly to verify that we are able to recover from a situation 7 // in which the padding file and the padding column are missing during origin 8 // initialization. This was originally reported in bug 1425146 comment 39. 9 // The situation can be described as follows: 10 // 1. A profile is used in FF57. The storage version is 2.1. There's no cache 11 // storage for http://www.mozilla.org 12 // 2. The same profile is used in FF56. The storage version is still 2.1 which 13 // doesn't prevent storage system from working since minor upgrades are 14 // backwards-compatible. The cache storage for http://www.mozilla.org is 15 // created with schema version 25 (without any padding stuff). 16 // 3. The profile is used in FF57 again. Zero padding files for existing cache 17 // storages are not created because storage is already at version 2.1. 18 // Storage is being initialized and a missing padding file triggers padding 19 // size computation from the cache database with schema version 25. Since 20 // the computation happens before any real DOM cache operation, the database 21 // is not upgraded to schema version 26, so the padding column is missing. 22 23 add_task(async function testSteps() { 24 // The profile contains one cache storage, a script for cache creation and 25 // the storage database: 26 // - storage/default/http+++www.mozilla.org/cache 27 // - create_cache.js 28 // - storage.sqlite 29 // The file create_cache.js in the package was run locally, specifically it 30 // was temporarily added to xpcshell.toml and then executed: 31 // mach xpcshell-test --interactive dom/cache/test/xpcshell/create_cache.js 32 // Note: it must be executed in FF56 and it only creates the directory 33 // "storage/default/chrome/cache" and the file "storage.sqlite". To make it 34 // become the profile in the test, additional manual steps are needed. 35 // 1. Create "http+++www.mozilla.org" folder under the ""storage/default". 36 // 2. Copy the "cache" folder under the "storage/default/chrome" to 37 // "storage/default/http+++www.mozilla.org". 38 // 3. Remove the folder "storage/default/chrome" 39 // 4. Remove the folder "storage/temporary". 40 // 5. Add "create_cache.js". 41 // 6. Replace the "storage.sqlite" created by FF56 (storage v2.0) with the 42 // "storage.sqlite" created by FF57 (storage v2.1) 43 create_test_profile("bug1425146_profile.zip"); 44 45 try { 46 await caches.open("test"); 47 ok(true, "Should not have thrown"); 48 } catch (ex) { 49 ok(false, "Should not have thrown"); 50 } 51 });