зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1718021 - Add name attribute to PermissionStatus r=johannh,peterv
Spec change https://github.com/w3c/permissions/pull/248 Differential Revision: https://phabricator.services.mozilla.com/D118692
This commit is contained in:
Родитель
2575056f16
Коммит
dab2507237
|
@ -33,6 +33,8 @@ class PermissionStatus final : public DOMEventTargetHelper {
|
|||
|
||||
void DisconnectFromOwner() override;
|
||||
|
||||
PermissionName Name() const { return mName; }
|
||||
|
||||
private:
|
||||
~PermissionStatus();
|
||||
|
||||
|
|
|
@ -85,12 +85,15 @@
|
|||
});
|
||||
return Promise.all(promisesToRevoke);
|
||||
},
|
||||
checkPermissions(state) {
|
||||
const promisesToQuery = PERMISSIONS.map(({ name }) => {
|
||||
checkPermissions(expectedState) {
|
||||
const promisesToQuery = PERMISSIONS.map(({ name: expectedName }) => {
|
||||
return aWindow.navigator.permissions
|
||||
.query({ name })
|
||||
.query({ name: expectedName })
|
||||
.then(
|
||||
() => is(state, state, `correct state for '${name}'`),
|
||||
({ state, name }) => {
|
||||
is(state, expectedState, `correct state for '${expectedName}'`)
|
||||
is(name, expectedName, `correct name for '${expectedName}'`)
|
||||
},
|
||||
() => ok(false, `query should not have rejected for '${name}'`)
|
||||
);
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ enum PermissionState {
|
|||
|
||||
[Exposed=Window]
|
||||
interface PermissionStatus : EventTarget {
|
||||
readonly attribute PermissionName name;
|
||||
readonly attribute PermissionState state;
|
||||
attribute EventHandler onchange;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test PermissionStatus's name attribute.</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
promise_test(async () => {
|
||||
const result = await navigator.permissions.query({
|
||||
name: "geolocation",
|
||||
});
|
||||
assert_equals(result.name, "geolocation", "Name was geolocation");
|
||||
});
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче