Bug 1358384 - Test the persistent-storage permission based on the pref-on/off state, r=johannh

The persistent-storage permission is still only pref-on on Nightly so this patch would test it only when it is pref-on.

MozReview-Commit-ID: Ei64cpJslgU

--HG--
extra : rebase_source : 1a2515a7c13675c80387c4e4628687ddbea64842
This commit is contained in:
Fischer.json 2017-04-21 00:04:53 +08:00
Родитель c6333df5ad
Коммит 7b160b2e4c
1 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -6,10 +6,18 @@
Components.utils.import("resource:///modules/SitePermissions.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
const STORAGE_MANAGER_ENABLED = Services.prefs.getBoolPref("browser.storageManager.enabled");
add_task(function* testPermissionsListing() {
Assert.deepEqual(SitePermissions.listPermissions().sort(),
["camera", "cookie", "desktop-notification", "focus-tab-by-prompt", "geo", "image",
"indexedDB", "install", "microphone", "persistent-storage", "popup", "screen"],
let expectedPermissions = ["camera", "cookie", "desktop-notification", "focus-tab-by-prompt",
"geo", "image", "indexedDB", "install", "microphone", "popup", "screen"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
// Should remove this checking and add it as default after it is fully pref-on.
expectedPermissions.push("persistent-storage");
}
Assert.deepEqual(SitePermissions.listPermissions().sort(), expectedPermissions.sort(),
"Correct list of all permissions");
});
@ -73,7 +81,13 @@ add_task(function* testExactHostMatch() {
let subUri = Services.io.newURI("https://test1.example.com");
let exactHostMatched = ["desktop-notification", "focus-tab-by-prompt", "camera",
"microphone", "screen", "geo", "persistent-storage"];
"microphone", "screen", "geo"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
// Should remove this checking and add it as default after it is fully pref-on.
exactHostMatched.push("persistent-storage");
}
let nonExactHostMatched = ["image", "cookie", "popup", "install", "indexedDB"];
let permissions = SitePermissions.listPermissions();