Bug 1266821 - Remove PushPermissionDescriptor from the Permissions API. r=baku

MozReview-Commit-ID: 7BngZ6Lwpfu

--HG--
extra : rebase_source : 844c129d3cbaa016f44f3cc6aaa65d4202ca70e0
extra : histedit_source : b2aee5b9c8d8857ad5385255aab9092e7715d61c
This commit is contained in:
Kit Cambridge 2016-04-22 11:22:42 -07:00
parent b3e4980239
commit 3cf5513966
3 changed files with 3 additions and 41 deletions

View File

@ -43,27 +43,6 @@ Permissions::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
namespace {
already_AddRefed<PermissionStatus>
CreatePushPermissionStatus(JSContext* aCx,
JS::Handle<JSObject*> aPermission,
nsPIDOMWindowInner* aWindow,
ErrorResult& aRv)
{
PushPermissionDescriptor permission;
JS::Rooted<JS::Value> value(aCx, JS::ObjectOrNullValue(aPermission));
if (NS_WARN_IF(!permission.Init(aCx, value))) {
aRv.NoteJSContextException(aCx);
return nullptr;
}
if (permission.mUserVisibleOnly) {
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
return PermissionStatus::Create(aWindow, permission.mName, aRv);
}
already_AddRefed<PermissionStatus>
CreatePermissionStatus(JSContext* aCx,
JS::Handle<JSObject*> aPermission,
@ -80,10 +59,8 @@ CreatePermissionStatus(JSContext* aCx,
switch (permission.mName) {
case PermissionName::Geolocation:
case PermissionName::Notifications:
return PermissionStatus::Create(aWindow, permission.mName, aRv);
case PermissionName::Push:
return CreatePushPermissionStatus(aCx, aPermission, aWindow, aRv);
return PermissionStatus::Create(aWindow, permission.mName, aRv);
default:
MOZ_ASSERT_UNREACHABLE("Unhandled type");

View File

@ -58,12 +58,6 @@ function revokeUnsupportedPermissions() {
));
}
function revokeUserVisibleOnlyPushPermission() {
return navigator.permissions.revoke({ name: 'push', userVisibleOnly: true }).then(
result => ok(false, `revoke should not have resolved for userVisibleOnly push`),
error => ok(true, `revoke should have rejected for userVisibleOnly push`));
}
function checkPermissions(state) {
return Promise.all(PERMISSIONS.map(x => {
return navigator.permissions.query({ name: x.name }).then(
@ -83,12 +77,6 @@ function checkUnsupportedPermissions() {
}));
}
function checkUserVisibleOnlyPushPermission() {
return navigator.permissions.query({ name: 'push', userVisibleOnly: true }).then(
result => ok(false, `query should not have resolved for userVisibleOnly push`),
error => ok(true, `query should have rejected for userVisibleOnly push`));
}
function promiseStateChanged(name, state) {
return navigator.permissions.query({ name }).then(
status => {
@ -132,7 +120,6 @@ function testInvalidRevoke() {
function runTests() {
checkUnsupportedPermissions()
.then(checkUserVisibleOnlyPushPermission)
.then(() => setPermissions(UNKNOWN_ACTION))
.then(() => checkPermissions('prompt'))
.then(() => setPermissions(PROMPT_ACTION))
@ -144,7 +131,6 @@ function runTests() {
.then(testStatusOnChange)
.then(testInvalidQuery)
.then(revokeUnsupportedPermissions)
.then(revokeUserVisibleOnlyPushPermission)
.then(revokePermissions)
.then(() => checkPermissions('prompt'))
.then(testInvalidRevoke)

View File

@ -18,9 +18,8 @@ dictionary PermissionDescriptor {
required PermissionName name;
};
dictionary PushPermissionDescriptor : PermissionDescriptor {
boolean userVisibleOnly = false;
};
// We don't implement `PushPermissionDescriptor` because we use a background
// message quota instead of `userVisibleOnly`.
[Exposed=(Window)]
interface Permissions {