mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
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:
parent
b3e4980239
commit
3cf5513966
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user