mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 1197461) for various test failures. r=backout on a CLOSED TREE
Backed out changeset d776c61906c1 (bug 1197461) Backed out changeset c046a81ab5a3 (bug 1197461)
This commit is contained in:
parent
9d292635cb
commit
bd93fdea28
@ -121,58 +121,5 @@ Permissions::Query(JSContext* aCx,
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Permissions::Revoke(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aPermission,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PermissionDescriptor permission;
|
||||
JS::Rooted<JS::Value> value(aCx, JS::ObjectOrNullValue(aPermission));
|
||||
if (NS_WARN_IF(!permission.Init(aCx, value))) {
|
||||
promise->MaybeReject(NS_ERROR_UNEXPECTED);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> document = mWindow->GetExtantDoc();
|
||||
if (!document) {
|
||||
promise->MaybeReject(NS_ERROR_UNEXPECTED);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
if (NS_WARN_IF(!permMgr)) {
|
||||
promise->MaybeReject(NS_ERROR_FAILURE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsresult rv = permMgr->RemoveFromPrincipal(document->NodePrincipal(), PermissionNameToType(permission.mName));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
promise->MaybeReject(rv);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
RefPtr<PermissionStatus> status =
|
||||
CreatePermissionStatus(aCx, aPermission, mWindow, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
MOZ_ASSERT(!status);
|
||||
promise->MaybeReject(aRv);
|
||||
} else {
|
||||
MOZ_ASSERT(status);
|
||||
promise->MaybeResolve(status);
|
||||
}
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -38,10 +38,6 @@ public:
|
||||
JS::Handle<JSObject*> aPermission,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> Revoke(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aPermission,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
~Permissions();
|
||||
|
||||
|
@ -42,28 +42,6 @@ function setPermissions(action) {
|
||||
});
|
||||
}
|
||||
|
||||
function revokePermissions(action) {
|
||||
return Promise.all(PERMISSIONS.map(x =>
|
||||
navigator.permissions.revoke({ name: x.name }).then(
|
||||
result => is(result.state, "prompt", `correct state for '${x.name}'`),
|
||||
error => ok(false, `query should not have rejected for '${x.name}'`))
|
||||
));
|
||||
}
|
||||
|
||||
function revokeUnsupportedPermissions() {
|
||||
return Promise.all(UNSUPPORTED_PERMISSIONS.map(name =>
|
||||
navigator.permissions.revoke({ name: name }).then(
|
||||
result => ok(false, `revoke should not have resolved for '${name}'`),
|
||||
error => is(error.name, 'TypeError', `revoke should have thrown TypeError for '${name}'`))
|
||||
));
|
||||
}
|
||||
|
||||
function revokeUserVisiblePushPermission() {
|
||||
return navigator.permissions.revoke({ name: 'push', userVisible: true }).then(
|
||||
result => ok(false, `revoke should not have resolved for userVisible push`),
|
||||
error => ok(true, `revoke should have rejected for userVisible push`));
|
||||
}
|
||||
|
||||
function checkPermissions(state) {
|
||||
return Promise.all(PERMISSIONS.map(x => {
|
||||
return navigator.permissions.query({ name: x.name }).then(
|
||||
@ -74,7 +52,7 @@ function checkPermissions(state) {
|
||||
|
||||
function checkUnsupportedPermissions() {
|
||||
return Promise.all(UNSUPPORTED_PERMISSIONS.map(name => {
|
||||
return navigator.permissions.query({ name: name }).then(
|
||||
return navigator.permissions.query({ name }).then(
|
||||
result => ok(false, `query should not have resolved for '${name}'`),
|
||||
error => {
|
||||
is(error.name, 'TypeError',
|
||||
@ -124,12 +102,6 @@ function testInvalidQuery() {
|
||||
error => ok(true, 'invalid query should have rejected'));
|
||||
}
|
||||
|
||||
function testInvalidRevoke() {
|
||||
navigator.permissions.revoke({ name: 'invalid' }).then(
|
||||
result => ok(false, 'invalid revoke should not have resolved'),
|
||||
error => ok(true, 'invalid revoke should have rejected'));
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
checkUnsupportedPermissions()
|
||||
.then(checkUserVisiblePushPermission)
|
||||
@ -143,11 +115,6 @@ function runTests() {
|
||||
.then(() => checkPermissions('denied'))
|
||||
.then(testStatusOnChange)
|
||||
.then(testInvalidQuery)
|
||||
.then(revokeUnsupportedPermissions)
|
||||
.then(revokeUserVisiblePushPermission)
|
||||
.then(revokePermissions)
|
||||
.then(() => checkPermissions('prompt'))
|
||||
.then(testInvalidRevoke)
|
||||
.then(SimpleTest.finish)
|
||||
.catch ((e) => {
|
||||
ok(false, 'Unexpected error ' + e);
|
||||
|
@ -26,6 +26,4 @@ dictionary PushPermissionDescriptor : PermissionDescriptor {
|
||||
interface Permissions {
|
||||
[Throws]
|
||||
Promise<PermissionStatus> query(object permission);
|
||||
[Throws]
|
||||
Promise<PermissionStatus> revoke(object permission);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user