diff options
Diffstat (limited to 'dom/quota/test/xpcshell/upgrades')
55 files changed, 3657 insertions, 0 deletions
diff --git a/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.json b/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.json new file mode 100644 index 0000000000..eff5918e98 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.json @@ -0,0 +1,64 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "https+++www.mozilla.org^userContextId=1", + "dir": true, + "entries": [ + { + "name": "sdb", + "dir": true, + "entries": [{ "name": "data.sdb", "dir": false }] + }, + { "name": ".metadata-v2", "dir":false } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "https+++www.mozilla.org^userContextId=1", + "dir": true, + "entries": [ + { + "name": "sdb", + "dir": true, + "entries": [{ "name": "data.sdb", "dir": false }] + }, + { "name": ".metadata-v2", "dir":false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.zip b/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.zip Binary files differnew file mode 100644 index 0000000000..c09b503c18 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/cacheVersion1_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/head.js b/dom/quota/test/xpcshell/upgrades/head.js new file mode 100644 index 0000000000..5c36d82ca6 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/head.js @@ -0,0 +1,14 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// The path to the top level directory. +const depth = "../../../../../"; + +loadScript("dom/quota/test/xpcshell/common/head.js"); + +function loadScript(path) { + let uri = Services.io.newFileURI(do_get_file(depth + path)); + Services.scriptloader.loadSubScript(uri.spec); +} diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.json b/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.json new file mode 100644 index 0000000000..db66d824eb --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.json @@ -0,0 +1,63 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "indexedDB", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + }, + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "persistent", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.zip b/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.zip Binary files differnew file mode 100644 index 0000000000..63936ecf9a --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBAndPersistentStorageDirectory_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.json b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.json new file mode 100644 index 0000000000..7916c25b73 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.json @@ -0,0 +1,55 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "indexedDB", + "dir": true, + "entries": [ + { "name": "1007+f+app+++system.gaiamobile.org", "dir": true }, + { "name": "http+++www.mozilla.org", "dir": true }, + { "name": "1007+t+https+++developer.cdn.mozilla.net", "dir": true } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.zip b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.zip Binary files differnew file mode 100644 index 0000000000..a0a56a77df --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_flatOriginDirectories_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.json b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.json new file mode 100644 index 0000000000..715c954915 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.json @@ -0,0 +1,65 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "indexedDB", + "dir": true, + "entries": [ + { + "name": "1007+f+app+++system.gaiamobile.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.zip b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.zip Binary files differnew file mode 100644 index 0000000000..589e65ec82 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/indexedDBDirectory_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/localStorageArchive1upgrade_profile.zip b/dom/quota/test/xpcshell/upgrades/localStorageArchive1upgrade_profile.zip Binary files differnew file mode 100644 index 0000000000..a17b90dedf --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/localStorageArchive1upgrade_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/localStorageArchive4upgrade_profile.zip b/dom/quota/test/xpcshell/upgrades/localStorageArchive4upgrade_profile.zip Binary files differnew file mode 100644 index 0000000000..cf5b29adae --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/localStorageArchive4upgrade_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/localStorageArchiveDowngrade_profile.zip b/dom/quota/test/xpcshell/upgrades/localStorageArchiveDowngrade_profile.zip Binary files differnew file mode 100644 index 0000000000..2f11abe858 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/localStorageArchiveDowngrade_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.json b/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.json new file mode 100644 index 0000000000..a25f257573 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.json @@ -0,0 +1,63 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + }, + { + "name": "persistent", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.zip b/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.zip Binary files differnew file mode 100644 index 0000000000..9ddd9af6a9 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentAndDefaultStorageDirectory_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.json b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.json new file mode 100644 index 0000000000..c80a3cc283 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.json @@ -0,0 +1,64 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "persistent", + "dir": true, + "entries": [ + { "name": "1007+f+app+++system.gaiamobile.org", "dir": true }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true + }, + { "name": "http+++www.mozilla.org", "dir": true } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.zip b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.zip Binary files differnew file mode 100644 index 0000000000..436ebf9070 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.json b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.json new file mode 100644 index 0000000000..98d23af161 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.json @@ -0,0 +1,92 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "persistent", + "dir": true, + "entries": [ + { + "name": "1007+f+app+++system.gaiamobile.org", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false } + ] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false } + ] + }, + { "name": "http+++www.mozilla.org+8080", "dir": true } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org+8080", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.zip b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.zip Binary files differnew file mode 100644 index 0000000000..0c5200adf4 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_originDirectories_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.json b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.json new file mode 100644 index 0000000000..f5d6a4a749 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.json @@ -0,0 +1,382 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "persistent", + "dir": true, + "entries": [ + { + "name": "1007+f+app+++system.gaiamobile.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++Users+joe+c+++index.html", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "moz-safe-about+home", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "https+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++Users+joe+index.html", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++localhost", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++c++", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++c++Users+joe+index.html", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++c++Users+joe+", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "chrome", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++127.0.0.1", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++++index.html", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++www.mozilla.org+8080", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "moz-safe-about+++home", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "resource+++fx-share-addon-at-mozilla-dot-org-fx-share-addon-data", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "indexeddb+++fx-devtools", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "https+++www.mozilla.org+8080", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "file++++Users+joe+", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + } + ] + }, + { + "name": "temporary", + "dir": true, + "entries": [ + { + "name": "1007+f+app+++system.gaiamobile.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++localhost", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++localhost+82", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "chrome", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { "name": "http+++localhost+81", "dir": true } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "file++++Users+joe+c+++index.html", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "https+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++Users+joe+index.html", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++localhost", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++c++", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++c++Users+joe+index.html", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++c++Users+joe+", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++127.0.0.1", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++++index.html", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org+8080", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "https+++www.mozilla.org+8080", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "file++++Users+joe+", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "temporary", + "dir": true, + "entries": [ + { + "name": "http+++localhost", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++localhost+82", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "chrome", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++localhost+81", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "permanent", + "dir": true, + "entries": [ + { + "name": "moz-safe-about+home", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "chrome", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "resource+++fx-share-addon-at-mozilla-dot-org-fx-share-addon-data", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "indexeddb+++fx-devtools", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.zip b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.zip Binary files differnew file mode 100644 index 0000000000..ab8c045be9 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/persistentStorageDirectory_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/test_localStorageArchive1upgrade.js b/dom/quota/test/xpcshell/upgrades/test_localStorageArchive1upgrade.js new file mode 100644 index 0000000000..f697d9167e --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_localStorageArchive1upgrade.js @@ -0,0 +1,65 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that local storage directories are removed + * during local storage archive upgrade from version 0 to version 1. + * See bug 1546305. + */ + +async function testSteps() { + const lsDirs = [ + "storage/default/http+++example.com/ls", + "storage/default/http+++localhost/ls", + "storage/default/http+++www.mozilla.org/ls", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Installing package"); + + // The profile contains three initialized origin directories with local + // storage data, local storage archive, a script for origin initialization, + // the storage database and the web apps store database: + // - storage/default/https+++example.com + // - storage/default/https+++localhost + // - storage/default/https+++www.mozilla.org + // - storage/ls-archive.sqlite + // - create_db.js + // - storage.sqlite + // - webappsstore.sqlite + // The file create_db.js in the package was run locally (with a build that + // doesn't support local storage archive upgrades), specifically it was + // temporarily added to xpcshell.ini and then executed: + // mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js + // Note: to make it become the profile in the test, additional manual steps + // are needed. + // 1. Remove the folder "storage/temporary". + installPackage("localStorageArchive1upgrade_profile"); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(exists, "ls directory does exist"); + } + + request = init(); + request = await requestFinished(request); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(!exists, "ls directory doesn't exist"); + } +} diff --git a/dom/quota/test/xpcshell/upgrades/test_localStorageArchive4upgrade.js b/dom/quota/test/xpcshell/upgrades/test_localStorageArchive4upgrade.js new file mode 100644 index 0000000000..0b0fcfccd6 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_localStorageArchive4upgrade.js @@ -0,0 +1,107 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that local storage directories are removed + * during local storage archive upgrade from version 3 to version 4. + * See bug 1549654. + */ + +async function testSteps() { + const lsDirs = [ + "storage/default/http+++localhost/ls", + "storage/default/http+++www.mozilla.org/ls", + "storage/default/http+++example.com/ls", + ]; + + const principalInfos = [ + "http://localhost", + "http://www.mozilla.org", + "http://example.com", + ]; + + const data = [ + { key: "foo0", value: "bar" }, + { key: "foo1", value: "A" }, + { key: "foo2", value: "A".repeat(100) }, + ]; + + function getLocalStorage(principal) { + return Services.domStorageManager.createStorage( + null, + principal, + principal, + "" + ); + } + + info("Setting pref"); + + // xpcshell globals don't have associated clients in the Clients API sense, so + // we need to disable client validation so that this xpcshell test is allowed + // to use LocalStorage. + Services.prefs.setBoolPref("dom.storage.client_validation", false); + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Installing package"); + + // The profile contains three initialized origin directories with local + // storage data, local storage archive, a script for origin initialization, + // the storage database and the web apps store database: + // - storage/default/https+++example.com + // - storage/default/https+++localhost + // - storage/default/https+++www.mozilla.org + // - storage/ls-archive.sqlite + // - create_db.js + // - storage.sqlite + // - webappsstore.sqlite + // The file create_db.js in the package was run locally (with a build with + // local storage archive version 3), specifically it was temporarily added to + // xpcshell.ini and then executed: + // mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js + // Note: to make it become the profile in the test, additional manual steps + // are needed. + // 1. Remove the folder "storage/temporary". + installPackage("localStorageArchive4upgrade_profile"); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(exists, "ls directory does exist"); + } + + request = init(); + request = await requestFinished(request); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(!exists, "ls directory doesn't exist"); + } + + info("Getting storages"); + + let storages = []; + for (let i = 0; i < principalInfos.length; i++) { + let storage = getLocalStorage(getPrincipal(principalInfos[i])); + storages.push(storage); + } + + info("Verifying data"); + + for (let i = 0; i < storages.length; i++) { + is(storages[i].getItem(data[i].key), data[i].value, "Correct value"); + } +} diff --git a/dom/quota/test/xpcshell/upgrades/test_localStorageArchiveDowngrade.js b/dom/quota/test/xpcshell/upgrades/test_localStorageArchiveDowngrade.js new file mode 100644 index 0000000000..8ca46f01d5 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_localStorageArchiveDowngrade.js @@ -0,0 +1,66 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that local storage directories are removed + * during local storage archive downgrade from any future version to current + * version. See bug 1546305. + */ + +async function testSteps() { + const lsDirs = [ + "storage/default/http+++example.com/ls", + "storage/default/http+++localhost/ls", + "storage/default/http+++www.mozilla.org/ls", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Installing package"); + + // The profile contains three initialized origin directories with local + // storage data, local storage archive, a script for origin initialization, + // the storage database and the web apps store database: + // - storage/default/https+++example.com + // - storage/default/https+++localhost + // - storage/default/https+++www.mozilla.org + // - storage/ls-archive.sqlite + // - create_db.js + // - storage.sqlite + // - webappsstore.sqlite + // The file create_db.js in the package was run locally (with a build that + // supports local storage archive upgrades and local storage archive version + // set to max integer), specifically it was temporarily added to xpcshell.ini + // and then executed: + // mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js + // Note: to make it become the profile in the test, additional manual steps + // are needed. + // 1. Remove the folder "storage/temporary". + installPackage("localStorageArchiveDowngrade_profile"); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(exists, "ls directory does exist"); + } + + request = init(); + request = await requestFinished(request); + + info("Checking ls dirs"); + + for (let lsDir of lsDirs) { + let dir = getRelativeFile(lsDir); + + exists = dir.exists(); + ok(!exists, "ls directory doesn't exist"); + } +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeCacheFrom1.js b/dom/quota/test/xpcshell/upgrades/test_upgradeCacheFrom1.js new file mode 100644 index 0000000000..e9424e20c6 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeCacheFrom1.js @@ -0,0 +1,79 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify UpgradeCacheFrom1To2 method. + */ + +async function testSteps() { + const packages = [ + // Storage used prior FF 88 (cache version 1). + // The profile contains one initialized origin directory with simple + // database data, a script for origin initialization and the storage + // database: + // - storage/default/https+++www.mozilla.org^userContextId=1 + // - create_db.js + // - storage.sqlite + // The file create_db.js in the package was run locally, specifically it was + // temporarily added to xpcshell.ini and then executed: + // mach xpcshell-test dom/quota/test/xpcshell/upgrades/create_db.js + // --interactive + // Note: to make it become the profile in the test, additional manual steps + // are needed. + // 1. Remove the folder "storage/temporary". + // 2. Remove the file "storage/ls-archive.sqlite". + "cacheVersion1_profile", + "../defaultStorageDirectory_shared", + ]; + const principal = getPrincipal("https://www.mozilla.org", { + userContextId: 1, + }); + const originUsage = 100; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing package"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Initializing"); + + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + await requestFinished(request); + + info("Getting origin usage"); + + request = getOriginUsage(principal, /* fromMemory */ true); + await requestFinished(request); + + info("Verifying origin usage"); + + is(request.result.usage, originUsage, "Correct origin usage"); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromFlatOriginDirectories.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromFlatOriginDirectories.js new file mode 100644 index 0000000000..f33ddac8ca --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromFlatOriginDirectories.js @@ -0,0 +1,187 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// A flat origin directory is an origin directory with no sub directories for +// quota clients. The upgrade was initially done lazily and an empty .metadata +// file was used to indicate a successful upgrade. + +function* testSteps() { + const setups = [ + { + packages: [ + // Storage used prior FF 22 (indexedDB/ directory with flat origin + // directories). + // FF 26 renamed indexedDB/ to storage/persistent and the lazy upgrade + // of flat origin directories remained. There's a test for that below. + "indexedDBDirectory_flatOriginDirectories_profile", + "../indexedDBDirectory_shared", + ], + origins: [ + { + oldPath: "indexedDB/1007+f+app+++system.gaiamobile.org", + }, + + { + oldPath: "indexedDB/1007+t+https+++developer.cdn.mozilla.net", + }, + + { + oldPath: "indexedDB/http+++www.mozilla.org", + newPath: "storage/default/http+++www.mozilla.org", + url: "http://www.mozilla.org", + persistence: "default", + }, + ], + }, + + { + packages: [ + // Storage used by FF 26-35 (storage/persistent/ directory with not yet + // upgraded flat origin directories). + // FF 36 renamed storage/persistent/ to storage/default/ and all not + // yet upgraded flat origin directories were upgraded. There's a + // separate test for that: + // test_upgradeFromPersistentStorageDirectory_upgradeOriginDirectories. + "persistentStorageDirectory_flatOriginDirectories_profile", + "../persistentStorageDirectory_shared", + ], + origins: [ + { + oldPath: "storage/persistent/1007+f+app+++system.gaiamobile.org", + }, + + { + oldPath: + "storage/persistent/1007+t+https+++developer.cdn.mozilla.net", + }, + + { + oldPath: "storage/persistent/http+++www.mozilla.org", + newPath: "storage/default/http+++www.mozilla.org", + url: "http://www.mozilla.org", + persistence: "default", + }, + ], + }, + ]; + + const metadataFileName = ".metadata"; + + for (const setup of setups) { + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(setup.packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(setup.packages); + + info("Verifying storage"); + + verifyStorage(setup.packages, "afterInstall"); + + info("Checking origin directories"); + + for (const origin of setup.origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + let idbDir = originDir.clone(); + idbDir.append("idb"); + + exists = idbDir.exists(); + ok(!exists, "idb directory doesn't exist"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + ok(!exists, "Metadata file doesn't exist"); + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(setup.packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + try { + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + } catch (ex) {} + + info("Checking origin directories"); + + for (const origin of setup.origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + let idbDir = originDir.clone(); + idbDir.append("idb"); + + exists = idbDir.exists(); + ok(exists, "idb directory does exist"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + ok(exists, "Metadata file does exist"); + } + } + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of setup.origins) { + if (origin.newPath) { + info("Initializing origin"); + + let principal = getPrincipal(origin.url); + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + } + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory.js new file mode 100644 index 0000000000..b1b0966d67 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory.js @@ -0,0 +1,121 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify + * MaybeUpgradeFromIndexedDBDirectoryToPersistentStorageDirectory method. + */ + +function* testSteps() { + const origins = [ + { + oldPath: "indexedDB/http+++www.mozilla.org", + newPath: "storage/default/http+++www.mozilla.org", + url: "http://www.mozilla.org", + persistence: "default", + }, + + { + oldPath: "indexedDB/1007+f+app+++system.gaiamobile.org", + }, + + { + oldPath: "indexedDB/1007+t+https+++developer.cdn.mozilla.net", + }, + ]; + + const packages = [ + // Storage used prior FF 26 (indexedDB/ directory). + "indexedDBDirectory_profile", + "../indexedDBDirectory_shared", + ]; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing package"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + } + } + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of origins) { + if (origin.newPath) { + info("Initializing origin"); + + let principal = getPrincipal(origin.url); + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory_removeOldDirectory.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory_removeOldDirectory.js new file mode 100644 index 0000000000..a7beced885 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromIndexedDBDirectory_removeOldDirectory.js @@ -0,0 +1,86 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that the old directory is removed in + * MaybeUpgradeFromIndexedDBDirectoryToPersistentStorageDirectory method. + */ + +async function testSteps() { + const url = "http://www.mozilla.org"; + const persistence = "default"; + + const packages = [ + // Storage used by FF 26-35 (storage/persistent/ directory and re-created + // indexedDB directory by an older FF). + "indexedDBAndPersistentStorageDirectory_profile", + "../persistentStorageDirectory_shared", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking directories"); + + let indexedDBDir = getRelativeFile("indexedDB"); + let exists = indexedDBDir.exists(); + ok(exists, "IndexedDB directory does exist"); + + let persistentStorageDir = getRelativeFile("storage/persistent"); + exists = persistentStorageDir.exists(); + ok(exists, "Persistent storage directory does exist"); + + info("Initializing"); + + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking directories"); + + indexedDBDir = getRelativeFile("indexedDB"); + exists = indexedDBDir.exists(); + ok(!exists, "IndexedDB directory doesn't exist"); + + // FF 36 renamed storage/persistent/ to storage/default/ so it can't exist + // either. + persistentStorageDir = getRelativeFile("storage/persistent"); + exists = persistentStorageDir.exists(); + ok(!exists, "Persistent storage directory doesn't exist"); + + info("Initializing temporary storage"); + + request = initTemporaryStorage(); + await requestFinished(request); + + info("Initializing origin"); + + request = initTemporaryOrigin(persistence, getPrincipal(url)); + await requestFinished(request); + + ok(!request.result, "Origin directory wasn't created"); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory.js new file mode 100644 index 0000000000..efac150067 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory.js @@ -0,0 +1,378 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify + * MaybeUpgradeFromPersistentStorageDirectoryToDefaultStorageDirectory method. + */ + +loadScript("dom/quota/test/common/file.js"); + +function* testSteps() { + const origins = [ + { + oldPath: "storage/persistent/1007+f+app+++system.gaiamobile.org", + }, + + { + oldPath: "storage/persistent/1007+t+https+++developer.cdn.mozilla.net", + }, + + { + oldPath: "storage/persistent/chrome", + newPath: "storage/permanent/chrome", + chrome: true, + persistence: "persistent", + }, + + { + oldPath: "storage/persistent/file++++", + newPath: "storage/default/file++++", + url: "file:///", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++++index.html", + newPath: "storage/default/file++++++index.html", + url: "file:///+/index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++++index.html", + newPath: "storage/default/file++++++index.html", + url: "file://///index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++Users+joe+", + newPath: "storage/default/file++++Users+joe+", + url: "file:///Users/joe/", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++Users+joe+c+++index.html", + newPath: "storage/default/file++++Users+joe+c+++index.html", + url: "file:///Users/joe/c++/index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++Users+joe+c+++index.html", + newPath: "storage/default/file++++Users+joe+c+++index.html", + url: "file:///Users/joe/c///index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++Users+joe+index.html", + newPath: "storage/default/file++++Users+joe+index.html", + url: "file:///Users/joe/index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++c++", + newPath: "storage/default/file++++c++", + url: "file:///c:/", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++c++Users+joe+", + newPath: "storage/default/file++++c++Users+joe+", + url: "file:///c:/Users/joe/", + persistence: "default", + }, + + { + oldPath: "storage/persistent/file++++c++Users+joe+index.html", + newPath: "storage/default/file++++c++Users+joe+index.html", + url: "file:///c:/Users/joe/index.html", + persistence: "default", + }, + + { + oldPath: "storage/persistent/http+++127.0.0.1", + newPath: "storage/default/http+++127.0.0.1", + url: "http://127.0.0.1", + persistence: "default", + }, + + { + oldPath: "storage/persistent/http+++localhost", + newPath: "storage/default/http+++localhost", + url: "http://localhost", + persistence: "default", + }, + + { + oldPath: "storage/persistent/http+++www.mozilla.org", + newPath: "storage/default/http+++www.mozilla.org", + url: "http://www.mozilla.org", + persistence: "default", + }, + + { + oldPath: "storage/persistent/http+++www.mozilla.org+8080", + newPath: "storage/default/http+++www.mozilla.org+8080", + url: "http://www.mozilla.org:8080", + persistence: "default", + }, + + { + oldPath: "storage/persistent/https+++www.mozilla.org", + newPath: "storage/default/https+++www.mozilla.org", + url: "https://www.mozilla.org", + persistence: "default", + }, + + { + oldPath: "storage/persistent/https+++www.mozilla.org+8080", + newPath: "storage/default/https+++www.mozilla.org+8080", + url: "https://www.mozilla.org:8080", + persistence: "default", + }, + + { + oldPath: "storage/persistent/indexeddb+++fx-devtools", + newPath: "storage/permanent/indexeddb+++fx-devtools", + url: "indexeddb://fx-devtools", + persistence: "persistent", + }, + + { + oldPath: "storage/persistent/moz-safe-about+++home", + }, + + { + oldPath: "storage/persistent/moz-safe-about+home", + newPath: "storage/permanent/moz-safe-about+home", + url: "moz-safe-about:home", + persistence: "persistent", + }, + + { + oldPath: + "storage/persistent/resource+++fx-share-addon-at-mozilla-dot-org-fx-share-addon-data", + newPath: + "storage/permanent/resource+++fx-share-addon-at-mozilla-dot-org-fx-share-addon-data", + url: "resource://fx-share-addon-at-mozilla-dot-org-fx-share-addon-data", + persistence: "persistent", + }, + + { + oldPath: "storage/temporary/1007+f+app+++system.gaiamobile.org", + }, + + { + oldPath: "storage/temporary/1007+t+https+++developer.cdn.mozilla.net", + }, + + // The .metadata file was intentionally appended for this origin directory + // to test recovery from unfinished upgrades (some metadata files can be + // already upgraded). + { + oldPath: "storage/temporary/chrome", + newPath: "storage/temporary/chrome", + metadataUpgraded: true, + chrome: true, + persistence: "temporary", + }, + + { + oldPath: "storage/temporary/http+++localhost", + newPath: "storage/temporary/http+++localhost", + url: "http://localhost", + persistence: "temporary", + }, + + // The .metadata file was intentionally removed for this origin directory + // to test restoring during upgrade. + { + oldPath: "storage/temporary/http+++localhost+81", + newPath: "storage/temporary/http+++localhost+81", + metadataRemoved: true, + url: "http://localhost:81", + persistence: "temporary", + }, + + // The .metadata file was intentionally truncated for this origin directory + // to test restoring during upgrade. + { + oldPath: "storage/temporary/http+++localhost+82", + newPath: "storage/temporary/http+++localhost+82", + url: "http://localhost:82", + persistence: "temporary", + }, + ]; + + const metadataFileName = ".metadata"; + + const packages = [ + // Storage used by 26-35 (storage/persistent/ directory, tracked only + // timestamp in .metadata for persistent storage and isApp not tracked in + // .metadata for temporary storage). + "persistentStorageDirectory_profile", + "../persistentStorageDirectory_shared", + ]; + + let metadataBuffers = []; + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + if (origin.newPath) { + info("Reading out contents of metadata file"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + if (origin.metadataRemoved) { + metadataBuffers.push(new ArrayBuffer(0)); + } else { + File.createFromNsIFile(metadataFile).then(grabArgAndContinueHandler); + let file = yield undefined; + + let fileReader = new FileReader(); + fileReader.onload = continueToNextStepSync; + fileReader.readAsArrayBuffer(file); + + yield undefined; + + metadataBuffers.push(fileReader.result); + } + + if (origin.newPath != origin.oldPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + } + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking origin directories"); + + for (let origin of origins) { + if (!origin.newPath || origin.newPath != origin.oldPath) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + + if (origin.newPath) { + let originDir = getRelativeFile(origin.newPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + info("Reading out contents of metadata file"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + File.createFromNsIFile(metadataFile).then(grabArgAndContinueHandler); + let file = yield undefined; + + let fileReader = new FileReader(); + fileReader.onload = continueToNextStepSync; + fileReader.readAsArrayBuffer(file); + + yield undefined; + + let metadataBuffer = fileReader.result; + + info("Verifying blobs differ"); + + if (origin.metadataUpgraded) { + ok( + compareBuffers(metadataBuffer, metadataBuffers.shift()), + "Metadata doesn't differ" + ); + } else { + ok( + !compareBuffers(metadataBuffer, metadataBuffers.shift()), + "Metadata differ" + ); + } + } + } + + info("Initializing"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of origins) { + if (origin.newPath) { + info("Initializing origin"); + + let principal; + if (origin.chrome) { + principal = getCurrentPrincipal(); + } else { + principal = getPrincipal(origin.url); + } + + if (origin.persistence == "persistent") { + request = initPersistentOrigin(principal, continueToNextStepSync); + } else { + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + } + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_removeOldDirectory.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_removeOldDirectory.js new file mode 100644 index 0000000000..e9f1ae2291 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_removeOldDirectory.js @@ -0,0 +1,102 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that the old directory is removed in + * MaybeUpgradeFromPersistentStorageDirectoryToDefaultStorageDirectory method. + */ + +async function testSteps() { + const url = "http://www.mozilla.org"; + const persistence = "default"; + const lastAccessed = 0x0005330925e07841; + + const packages = [ + // Storage used by FF 36-48 (storage/default/ directory and re-created + // storage/persistent/ directory by an older FF). + "persistentAndDefaultStorageDirectory_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking directories"); + + let persistentStorageDir = getRelativeFile("storage/persistent"); + let exists = persistentStorageDir.exists(); + ok(exists, "Persistent storage directory does exist"); + + let defaultStorageDir = getRelativeFile("storage/default"); + exists = defaultStorageDir.exists(); + ok(exists, "Default storage directory does exist"); + + info("Initializing"); + + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization and getting + // usage is able to ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/permanent/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking directories"); + + persistentStorageDir = getRelativeFile("storage/persistent"); + exists = persistentStorageDir.exists(); + ok(!exists, "Persistent storage directory doesn't exist"); + + defaultStorageDir = getRelativeFile("storage/default"); + exists = defaultStorageDir.exists(); + ok(exists, "Default storage directory does exist"); + + info("Initializing temporary storage"); + + request = initTemporaryStorage(); + await requestFinished(request); + + info("Initializing origin"); + + request = initTemporaryOrigin(persistence, getPrincipal(url)); + await requestFinished(request); + + ok(!request.result, "Origin directory wasn't created"); + + info("Getting usage"); + + request = getUsage(function() {}, /* getAll */ true); + await requestFinished(request); + + info("Verifying result"); + + const result = request.result; + is(result.length, 1, "Correct number of usage results"); + + info("Verifying usage result"); + + const usageResult = result[0]; + ok(usageResult.origin == url, "Origin equals"); + ok(usageResult.lastAccessed == lastAccessed, "LastAccessed equals"); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_upgradeOriginDirectories.js b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_upgradeOriginDirectories.js new file mode 100644 index 0000000000..cac8ec3b16 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeFromPersistentStorageDirectory_upgradeOriginDirectories.js @@ -0,0 +1,162 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +function* testSteps() { + const origins = [ + { + oldPath: "storage/persistent/1007+f+app+++system.gaiamobile.org", + upgraded: true, + }, + + { + oldPath: "storage/persistent/1007+t+https+++developer.cdn.mozilla.net", + upgraded: true, + }, + + { + oldPath: "storage/persistent/http+++www.mozilla.org", + newPath: "storage/default/http+++www.mozilla.org", + url: "http://www.mozilla.org", + persistence: "default", + upgraded: true, + }, + { + oldPath: "storage/persistent/http+++www.mozilla.org+8080", + newPath: "storage/default/http+++www.mozilla.org+8080", + url: "http://www.mozilla.org:8080", + persistence: "default", + }, + ]; + + const metadataFileName = ".metadata"; + + const packages = [ + // Storage used by FF 26-35 (storage/persistent/ directory with already + // upgraded origin directories and not yet upgraded flat origin + // directories). + "persistentStorageDirectory_originDirectories_profile", + "../persistentStorageDirectory_shared", + ]; + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking origin directories"); + + for (const origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + let idbDir = originDir.clone(); + idbDir.append("idb"); + + exists = idbDir.exists(); + if (origin.upgraded) { + ok(exists, "idb directory does exist"); + } else { + ok(!exists, "idb directory doesn't exist"); + } + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + if (origin.upgraded) { + ok(exists, "Metadata file does exist"); + } else { + ok(!exists, "Metadata file doesn't exist"); + } + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization and getting + // usage is able to ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking origin directories"); + + for (const origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + + if (origin.newPath) { + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + let idbDir = originDir.clone(); + idbDir.append("idb"); + + exists = idbDir.exists(); + ok(exists, "idb directory does exist"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + ok(exists, "Metadata file does exist"); + } + } + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of origins) { + if (origin.newPath) { + info("Initializing origin"); + + let principal = getPrincipal(origin.url); + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom0_0.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom0_0.js new file mode 100644 index 0000000000..bd6a010cf8 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom0_0.js @@ -0,0 +1,158 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify UpgradeStorageFrom0_0To1_0 method. + */ + +function* testSteps() { + const origins = [ + { + path: "storage/default/1007+f+app+++system.gaiamobile.org", + obsolete: true, + }, + + { + path: "storage/default/1007+t+https+++developer.cdn.mozilla.net", + obsolete: true, + }, + + { + path: "storage/default/http+++www.mozilla.org", + obsolete: false, + url: "http://www.mozilla.org", + persistence: "default", + }, + ]; + + const storageFileName = "storage.sqlite"; + const metadataFileName = ".metadata"; + const metadata2FileName = ".metadata-v2"; + + const packages = [ + // Storage used by FF 36-48 (storage/default/ directory, but no + // storage.sqlite and no .metadata-v2 files). + "version0_0_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking storage file"); + + let storageFile = getRelativeFile(storageFileName); + + let exists = storageFile.exists(); + ok(!exists, "Storage file doesn't exist"); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.path); + + exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + ok(exists, "Metadata file does exist"); + + let metadata2File = originDir.clone(); + metadata2File.append(metadata2FileName); + + exists = metadata2File.exists(); + ok(!exists, "Metadata file doesn't exist"); + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + exists = storageFile.exists(); + ok(exists, "Storage file does exist"); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.path); + + exists = originDir.exists(); + if (origin.obsolete) { + ok(!exists, "Origin directory doesn't exist"); + } else { + ok(exists, "Origin directory does exist"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + exists = metadataFile.exists(); + ok(exists, "Metadata file does exist"); + + let metadata2File = originDir.clone(); + metadata2File.append(metadata2FileName); + + exists = metadata2File.exists(); + ok(exists, "Metadata file does exist"); + } + } + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of origins) { + if (!origin.obsolete) { + info("Initializing origin"); + + let principal = getPrincipal(origin.url); + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_idb.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_idb.js new file mode 100644 index 0000000000..34508f85e8 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_idb.js @@ -0,0 +1,43 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify indexedDB::QuotaClient::UpgradeStorageFrom1_0To2_0 + * method. + */ + +async function testSteps() { + const packages = [ + // Storage used by FF 49-54 (storage version 1.0 with idb directory). + "version1_0_idb_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Initializing"); + + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeAppsData.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeAppsData.js new file mode 100644 index 0000000000..17946ffff5 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeAppsData.js @@ -0,0 +1,101 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify MaybeRemoveAppsData method. + */ + +function* testSteps() { + const origins = [ + { + path: "storage/default/http+++www.mozilla.org", + obsolete: false, + }, + + { + path: "storage/default/app+++system.gaiamobile.org^appId=1007", + obsolete: true, + }, + + { + path: + "storage/default/https+++developer.cdn.mozilla.net^appId=1007&inBrowser=1", + obsolete: true, + }, + ]; + + const packages = [ + // Storage used by FF 49-54 (storage version 1.0 with apps data). + "version1_0_appsData_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.path); + + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once getting usage is able to ignore unknown + // directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/permanent/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.path); + + let exists = originDir.exists(); + if (origin.obsolete) { + ok(!exists, "Origin directory doesn't exist"); + } else { + ok(exists, "Origin directory does exist"); + } + } + + info("Getting usage"); + + getUsage(grabResultAndContinueHandler, /* getAll */ true); + let result = yield undefined; + + info("Verifying result"); + + is(result.length, 1, "Correct number of usage results"); + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeMorgueDirectory.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeMorgueDirectory.js new file mode 100644 index 0000000000..b37d00bbf8 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_removeMorgueDirectory.js @@ -0,0 +1,60 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify MaybeRemoveMorgueDirectory method. + */ + +function* testSteps() { + const morgueFile = "storage/default/http+++example.com/morgue"; + + const packages = [ + // Storage used by FF 49-54 (storage version 1.0 with morgue directory). + "version1_0_morgueDirectory_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking morgue file"); + + let file = getRelativeFile(morgueFile); + + let exists = file.exists(); + ok(exists, "Morgue file does exist"); + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + info("Checking morgue file"); + + exists = file.exists(); + ok(!exists, "Morgue file doesn't exist"); + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_stripObsoleteOriginAttributes.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_stripObsoleteOriginAttributes.js new file mode 100644 index 0000000000..407a04c1f8 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom1_0_stripObsoleteOriginAttributes.js @@ -0,0 +1,179 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify MaybeStripObsoleteOriginAttributes method. + */ + +loadScript("dom/quota/test/common/file.js"); + +function* testSteps() { + const origins = [ + { + oldPath: + "storage/permanent/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + newPath: + "storage/permanent/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + url: "moz-extension://8ea6d31b-917c-431f-a204-15b95e904d4f", + persistence: "persistent", + }, + + { + oldPath: + "storage/temporary/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + newPath: + "storage/temporary/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + url: "moz-extension://8ea6d31b-917c-431f-a204-15b95e904d4f", + persistence: "temporary", + }, + + { + oldPath: + "storage/default/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + newPath: + "storage/default/moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + url: "moz-extension://8ea6d31b-917c-431f-a204-15b95e904d4f", + persistence: "default", + }, + ]; + + const metadataFileName = ".metadata-v2"; + + const packages = [ + // Storage used by FF 49-54 (storage version 1.0 with obsolete origin + // attributes). + "version1_0_obsoleteOriginAttributes_profile", + "../defaultStorageDirectory_shared", + ]; + + let metadataBuffers = []; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + info("Reading out contents of metadata file"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + File.createFromNsIFile(metadataFile).then(grabArgAndContinueHandler); + let file = yield undefined; + + let fileReader = new FileReader(); + fileReader.onload = continueToNextStepSync; + fileReader.readAsArrayBuffer(file); + + yield undefined; + + metadataBuffers.push(fileReader.result); + + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + } + + info("Initializing"); + + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + // TODO: Remove this block once temporary storage initialization is able to + // ignore unknown directories. + getRelativeFile("storage/default/invalid+++example.com").remove(false); + getRelativeFile("storage/temporary/invalid+++example.com").remove(false); + + info("Checking origin directories"); + + for (let origin of origins) { + let originDir = getRelativeFile(origin.oldPath); + let exists = originDir.exists(); + ok(!exists, "Origin directory doesn't exist"); + + originDir = getRelativeFile(origin.newPath); + exists = originDir.exists(); + ok(exists, "Origin directory does exist"); + + info("Reading out contents of metadata file"); + + let metadataFile = originDir.clone(); + metadataFile.append(metadataFileName); + + File.createFromNsIFile(metadataFile).then(grabArgAndContinueHandler); + let file = yield undefined; + + let fileReader = new FileReader(); + fileReader.onload = continueToNextStepSync; + fileReader.readAsArrayBuffer(file); + + yield undefined; + + let metadataBuffer = fileReader.result; + + info("Verifying blobs differ"); + + ok( + !compareBuffers(metadataBuffer, metadataBuffers.shift()), + "Metadata differ" + ); + } + + info("Initializing temporary storage"); + + request = initTemporaryStorage(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Initializing origins"); + + for (const origin of origins) { + info("Initializing origin"); + + let principal = getPrincipal(origin.url); + if (origin.persistence == "persistent") { + request = initPersistentOrigin(principal, continueToNextStepSync); + } else { + request = initTemporaryOrigin( + origin.persistence, + principal, + continueToNextStepSync + ); + } + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + ok(!request.result, "Origin directory wasn't created"); + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_0.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_0.js new file mode 100644 index 0000000000..55edfa6055 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_0.js @@ -0,0 +1,97 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify UpgradeStorageFrom2_0To2_1 method. + */ + +function* testSteps() { + const origins = [ + "storage/default/chrome/", + "storage/default/http+++www.mozilla.org/", + ]; + const paddingFilePath = "cache/.padding"; + + const packages = [ + // Storage used by FF 55-56 (storage version 2.0). + // The profile contains two cache storages: + // - storage/default/chrome/cache, + // - storage/default/http+++www.mozilla.org/cache + // The file create_cache.js in the package was run locally, specifically it + // was temporarily added to xpcshell.ini and then executed: + // mach xpcshell-test --interactive dom/quota/test/xpcshell/create_cache.js + // Note: it only creates the directory "storage/default/chrome/cache". + // To make it become the profile in the test, two more manual steps are + // needed. + // 1. Remove the folder "storage/temporary". + // 2. Copy the content under the "storage/default/chrome" to + // "storage/default/http+++www.mozilla.org". + // 3. Manually create an asmjs folder under the + // "storage/default/http+++www.mozilla.org/". + "version2_0_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + clear(continueToNextStepSync); + yield undefined; + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking padding files before upgrade (storage version 2.0)"); + + for (let origin of origins) { + let paddingFile = getRelativeFile(origin + paddingFilePath); + let exists = paddingFile.exists(); + ok(!exists, "Padding file doesn't exist"); + } + + info("Initializing"); + + // Initialize to trigger storage upgrade from version 2.0. + let request = init(continueToNextStepSync); + yield undefined; + + ok(request.resultCode == NS_OK, "Initialization succeeded"); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + info("Checking padding files after upgrade"); + + for (let origin of origins) { + let paddingFile = getRelativeFile(origin + paddingFilePath); + let exists = paddingFile.exists(); + ok(exists, "Padding file does exist"); + + info("Reading out contents of padding file"); + + File.createFromNsIFile(paddingFile).then(grabArgAndContinueHandler); + let domFile = yield undefined; + + let fileReader = new FileReader(); + fileReader.onload = continueToNextStepSync; + fileReader.readAsArrayBuffer(domFile); + yield undefined; + + let paddingFileInfo = new Float64Array(fileReader.result); + ok(paddingFileInfo.length == 1, "Padding file does take 64 bytes."); + ok(paddingFileInfo[0] == 0, "Padding size does default to zero."); + } + + finishTest(); +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_1.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_1.js new file mode 100644 index 0000000000..eed7ed21d5 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_1.js @@ -0,0 +1,85 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify UpgradeStorageFrom2_1To2_2 method (removal of + * obsolete origins, deprecated clients and unknown temporary files). + */ + +async function testSteps() { + const filePaths = [ + // Obsolete origins: + "storage/default/chrome+++content+browser.xul", + + "storage/default/moz-safe-about+++home", + + // TODO: These three origins don't belong here! They were added one release + // later and the origin parser was fixed to handle these origins one + // release later as well, so users which already upgraded to 2.2 may + // still have issues related to these origins! + "storage/default/about+home+1", + + "storage/default/about+home+1+q", + + // about:reader?url=xxx (before bug 1422456) + "storage/default/about+reader+url=https%3A%2F%2Fexample.com", + + // Deprecated client: + "storage/default/https+++example.com/asmjs", + + // Unknown temporary file: + "storage/default/https+++example.com/idb/UUID123.tmp", + ]; + + const packages = [ + // Storage used by FF 57-67 (storage version 2.1 with obsolete origins, a + // deprecated client and an unknown temporary file). + "version2_1_profile", + "../defaultStorageDirectory_shared", + ]; + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + info("Checking files and directories before upgrade (storage version 2.1)"); + + for (const filePath of filePaths) { + let file = getRelativeFile(filePath); + let exists = file.exists(); + ok(exists, "File or directory does exist"); + } + + info("Initializing"); + + // Initialize to trigger storage upgrade from version 2.1 + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + info("Checking files and directories after upgrade"); + + for (const filePath of filePaths) { + let file = getRelativeFile(filePath); + let exists = file.exists(); + ok(!exists, "File or directory does not exist"); + } +} diff --git a/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_2.js b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_2.js new file mode 100644 index 0000000000..8f41c05b49 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/test_upgradeStorageFrom2_2.js @@ -0,0 +1,64 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify UpgradeStorageFrom2_2To2_3 method. + */ + +async function testSteps() { + const packages = [ + // Storage used by FF 68-69 (storage version 2.2). + "version2_2_profile", + "../defaultStorageDirectory_shared", + ]; + + function verifyDatabaseTable(shouldExist) { + let file = getRelativeFile("storage.sqlite"); + let conn = Services.storage.openUnsharedDatabase(file); + + let exists = conn.tableExists("database"); + if (shouldExist) { + ok(exists, "Database table does exist"); + } else { + ok(!exists, "Database table does not exist"); + } + + conn.close(); + } + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "beforeInstall"); + + info("Installing packages"); + + installPackages(packages); + + info("Verifying storage"); + + verifyStorage(packages, "afterInstall"); + + verifyDatabaseTable(/* shouldExist */ false); + + info("Initializing"); + + // Initialize to trigger storage upgrade from version 2.2 + request = init(); + await requestFinished(request); + + info("Verifying storage"); + + verifyStorage(packages, "afterInit"); + + request = reset(); + await requestFinished(request); + + verifyDatabaseTable(/* shouldExist */ true); +} diff --git a/dom/quota/test/xpcshell/upgrades/version0_0_profile.json b/dom/quota/test/xpcshell/upgrades/version0_0_profile.json new file mode 100644 index 0000000000..05c0d27fe3 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version0_0_profile.json @@ -0,0 +1,88 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "1007+f+app+++system.gaiamobile.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "1007+t+https+++developer.cdn.mozilla.org", + "dir": true, + "entries": [{ "name": ".metadata", "dir": false }] + }, + { + "name": "https+++developer.cdn.mozilla.org", + "dir": true + } + ] + } + ] + } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "todo": "This shouldn't exist, it regressed after accidental changes done in bug 1320404", + "name": "https+++developer.cdn.mozilla.net", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "https+++developer.cdn.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version0_0_profile.zip b/dom/quota/test/xpcshell/upgrades/version0_0_profile.zip Binary files differnew file mode 100644 index 0000000000..5ef577191c --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version0_0_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.json b/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.json new file mode 100644 index 0000000000..88f5d5dcee --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.json @@ -0,0 +1,72 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "app+++system.gaiamobile.org^appId=1007", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "https+++developer.cdn.mozilla.net^appId=1007&inBrowser=1", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.zip b/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.zip Binary files differnew file mode 100644 index 0000000000..582edb43af --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_appsData_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.json b/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.json new file mode 100644 index 0000000000..a8fb8b2260 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.json @@ -0,0 +1,73 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "permanent", + "dir": true, + "entries": [ + { + "name": "moz-safe-about+home", + "dir": true, + "entries": [ + { + "name": "idb", + "dir": true, + "entries": [ + { "name": "631132235dGb", "dir": true }, + { "name": "631132235dGb.files", "dir": true }, + { "name": "631132235dGb.sqlite", "dir": false } + ] + }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir":false } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "permanent", + "dir": true, + "entries": [ + { + "name": "moz-safe-about+home", + "dir": true, + "entries": [ + { + "name": "idb", + "dir": true, + "entries": [ + { "name": "631132235dGb.files", "dir": true }, + { "name": "631132235dGb.sqlite", "dir": false } + ] + }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir":false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.zip b/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.zip Binary files differnew file mode 100644 index 0000000000..8abfae79c2 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_idb_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.json b/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.json new file mode 100644 index 0000000000..855f7846bc --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.json @@ -0,0 +1,57 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++example.com", + "dir": true, + "entries": [ + { "name": "morgue", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "http+++example.com", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.zip b/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.zip Binary files differnew file mode 100644 index 0000000000..88543784ec --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_morgueDirectory_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.json b/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.json new file mode 100644 index 0000000000..071c4413f4 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.json @@ -0,0 +1,112 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "permanent", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "temporary", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f^addonId=indexedDB-test%40kmaglione.mozilla.com", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "permanent", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { + "name": "temporary", + "dir": true, + "entries": [ + { + "name": "moz-extension+++8ea6d31b-917c-431f-a204-15b95e904d4f", + "dir": true, + "entries": [ + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.zip b/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.zip Binary files differnew file mode 100644 index 0000000000..2b4125edf9 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version1_0_obsoleteOriginAttributes_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version2_0_profile.json b/dom/quota/test/xpcshell/upgrades/version2_0_profile.json new file mode 100644 index 0000000000..04ad73eae3 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_0_profile.json @@ -0,0 +1,105 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "chrome", + "dir": true, + "entries": [ + { + "name": "cache", + "dir": true, + "entries": [ + { "name": "morgue", "dir": true }, + { "name": "caches.sqlite", "dir": false } + ] + }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { "name": "asmjs", "dir": true }, + { + "name": "cache", + "dir": true, + "entries": [ + { "name": "morgue", "dir": true }, + { "name": "caches.sqlite", "dir": false } + ] + } + ] + } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "chrome", + "dir": true, + "entries": [ + { + "name": "cache", + "dir": true, + "entries": [ + { "name": "morgue", "dir": true }, + { "name": ".padding", "dir": false }, + { "name": "caches.sqlite", "dir": false } + ] + }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + }, + { + "name": "http+++www.mozilla.org", + "dir": true, + "entries": [ + { + "name": "cache", + "dir": true, + "entries": [ + { "name": "morgue", "dir": true }, + { "name": ".padding", "dir": false }, + { "name": "caches.sqlite", "dir": false } + ] + }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version2_0_profile.zip b/dom/quota/test/xpcshell/upgrades/version2_0_profile.zip Binary files differnew file mode 100644 index 0000000000..c140df56e4 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_0_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version2_1_profile.json b/dom/quota/test/xpcshell/upgrades/version2_1_profile.json new file mode 100644 index 0000000000..a7866d1123 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_1_profile.json @@ -0,0 +1,69 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { "name": "about+home+1", "dir": true }, + { "name": "about+home+1+q", "dir": true }, + { + "name": "about+reader+url=https%3A%2F%2Fexample.com", + "dir": true + }, + { "name": "chrome+++content+browser.xul", "dir": true }, + { + "name": "https+++example.com", + "dir": true, + "entries": [ + { "name": "asmjs", "dir": true }, + { + "name": "idb", + "dir": true, + "entries": [{ "name": "UUID123.tmp", "dir": false }] + } + ] + }, + { "name": "moz-safe-about+++home", "dir": true } + ] + } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [ + { + "name": "default", + "dir": true, + "entries": [ + { + "name": "https+++example.com", + "dir": true, + "entries": [ + { "name": "idb", "dir": true }, + { "name": ".metadata", "dir": false }, + { "name": ".metadata-v2", "dir": false } + ] + } + ] + }, + { "name": "ls-archive.sqlite", "dir": false } + ] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version2_1_profile.zip b/dom/quota/test/xpcshell/upgrades/version2_1_profile.zip Binary files differnew file mode 100644 index 0000000000..908dac7058 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_1_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/version2_2_profile.json b/dom/quota/test/xpcshell/upgrades/version2_2_profile.json new file mode 100644 index 0000000000..4b7265e3b4 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_2_profile.json @@ -0,0 +1,18 @@ +[ + { "key": "beforeInstall", "entries": [] }, + { + "key": "afterInstall", + "entries": [{ "name": "storage.sqlite", "dir": false }] + }, + { + "key": "afterInit", + "entries": [ + { + "name": "storage", + "dir": true, + "entries": [{ "name": "ls-archive.sqlite", "dir": false }] + }, + { "name": "storage.sqlite", "dir": false } + ] + } +] diff --git a/dom/quota/test/xpcshell/upgrades/version2_2_profile.zip b/dom/quota/test/xpcshell/upgrades/version2_2_profile.zip Binary files differnew file mode 100644 index 0000000000..b6ae7e7d76 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/version2_2_profile.zip diff --git a/dom/quota/test/xpcshell/upgrades/xpcshell.ini b/dom/quota/test/xpcshell/upgrades/xpcshell.ini new file mode 100644 index 0000000000..8698e4bff4 --- /dev/null +++ b/dom/quota/test/xpcshell/upgrades/xpcshell.ini @@ -0,0 +1,61 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +[DEFAULT] +head = head.js +support-files = + cacheVersion1_profile.json + cacheVersion1_profile.zip + indexedDBAndPersistentStorageDirectory_profile.json + indexedDBAndPersistentStorageDirectory_profile.zip + indexedDBDirectory_flatOriginDirectories_profile.json + indexedDBDirectory_flatOriginDirectories_profile.zip + indexedDBDirectory_profile.json + indexedDBDirectory_profile.zip + localStorageArchive1upgrade_profile.zip + localStorageArchive4upgrade_profile.zip + localStorageArchiveDowngrade_profile.zip + persistentAndDefaultStorageDirectory_profile.json + persistentAndDefaultStorageDirectory_profile.zip + persistentStorageDirectory_flatOriginDirectories_profile.json + persistentStorageDirectory_flatOriginDirectories_profile.zip + persistentStorageDirectory_originDirectories_profile.json + persistentStorageDirectory_originDirectories_profile.zip + persistentStorageDirectory_profile.json + persistentStorageDirectory_profile.zip + version0_0_profile.json + version0_0_profile.zip + version1_0_appsData_profile.json + version1_0_appsData_profile.zip + version1_0_idb_profile.json + version1_0_idb_profile.zip + version1_0_morgueDirectory_profile.json + version1_0_morgueDirectory_profile.zip + version1_0_obsoleteOriginAttributes_profile.json + version1_0_obsoleteOriginAttributes_profile.zip + version2_0_profile.json + version2_0_profile.zip + version2_1_profile.json + version2_1_profile.zip + version2_2_profile.json + version2_2_profile.zip + +[test_localStorageArchive1upgrade.js] +[test_localStorageArchive4upgrade.js] +[test_localStorageArchiveDowngrade.js] +[test_upgradeCacheFrom1.js] +[test_upgradeFromFlatOriginDirectories.js] +[test_upgradeFromIndexedDBDirectory.js] +[test_upgradeFromIndexedDBDirectory_removeOldDirectory.js] +[test_upgradeFromPersistentStorageDirectory.js] +[test_upgradeFromPersistentStorageDirectory_removeOldDirectory.js] +[test_upgradeFromPersistentStorageDirectory_upgradeOriginDirectories.js] +[test_upgradeStorageFrom0_0.js] +[test_upgradeStorageFrom1_0_idb.js] +[test_upgradeStorageFrom1_0_removeAppsData.js] +[test_upgradeStorageFrom1_0_removeMorgueDirectory.js] +[test_upgradeStorageFrom1_0_stripObsoleteOriginAttributes.js] +[test_upgradeStorageFrom2_0.js] +[test_upgradeStorageFrom2_1.js] +[test_upgradeStorageFrom2_2.js] |