mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1047268 - Call SpecialPowers.pushPermissions() to ensure permission change is completed before continuing the rest of the tests. r=dhylands
This commit is contained in:
parent
1b4d86bc4f
commit
912db79935
@ -49,18 +49,28 @@ SpecialPowers.pushPrefEnv({
|
||||
|
||||
// Need special permission to access "apps". We always have the permission in B2G
|
||||
// mochitests, but on other platforms, we need to manually add the permission.
|
||||
var needAppsPermission = false;;
|
||||
if (!SpecialPowers.testPermission(
|
||||
"webapps-manage", SpecialPowers.Ci.nsIPermissionManager.ALLOW_ACTION, document)) {
|
||||
ok(!navigator.getDeviceStorage("apps"), "Should not have apps storage without permission");
|
||||
SpecialPowers.addPermission("webapps-manage", true, document);
|
||||
needAppsPermission = true;
|
||||
}
|
||||
ok(navigator.getDeviceStorage("apps"), "Should have apps storage with permission");
|
||||
|
||||
ok(navigator.getDeviceStorage("sdcard"), "Should have sdcard storage");
|
||||
ok(navigator.getDeviceStorage("crashes"), "Should have crashes storage");
|
||||
var testFunction = function() {
|
||||
ok(navigator.getDeviceStorage("apps"), "Should have apps storage with permission");
|
||||
ok(navigator.getDeviceStorage("sdcard"), "Should have sdcard storage");
|
||||
ok(navigator.getDeviceStorage("crashes"), "Should have crashes storage");
|
||||
// The test harness reverts our pref changes automatically.
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
// The test harness reverts our pref changes automatically.
|
||||
SimpleTest.finish();
|
||||
if (needAppsPermission) {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type":"webapps-manage", "allow": true, "context": document }],
|
||||
testFunction);
|
||||
} else {
|
||||
testFunction();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user