From 4d60ac805024975be7ecd47ba8586c2ee42166e8 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Fri, 11 Mar 2016 23:32:08 -0800 Subject: [PATCH 1/3] Name the query, request, and revoke a permission algorithms. Fixes #62. --- index.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 912720a..1b07fc4 100644 --- a/index.html +++ b/index.html @@ -569,8 +569,10 @@

};

- When the query() - method is invoked, the user agent MUST run the following steps: + When the query() + method is invoked, the user agent MUST run the following + query a permission algorithm, passing the + parameter permission:

  1. If permission.name has an associated @@ -602,15 +604,20 @@

    found in the Examples section.

    - When the request() - method is invoked, the user agent MUST run the following steps: + When the request() method is invoked, the user + agent MUST run the following request a + permission algorithm, passing the parameter + permission:

    1. TODO

    - When the revoke() - method is invoked, the user agent MUST run the following steps: + When the revoke() + method is invoked, the user agent MUST run the following + revoke a permission algorithm, passing the + parameter permission:

    1. If permission.name has an associated From 3ca326bc150c1e45fa6d41c9f8bee7a655f89249 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Thu, 10 Mar 2016 16:26:03 -0800 Subject: [PATCH 2/3] Define the 'get a permission storage identifier' algorithm. --- index.html | 67 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 1b07fc4..600f39e 100644 --- a/index.html +++ b/index.html @@ -98,6 +98,11 @@

      The following concepts and interfaces are defined in [[!HTML]]:

      Permission Store

      - User agents MAY use a form of storage to keep - track of web site permissions. When they do, they MUST have a - permission storage identifier which is linked to a permission - storage entry. The permission storage identifier MUST - contain the website's origin and MAY contain other information like the - embedding status or the embedder's origin. The permission storage + User agents MAY use a form of storage to keep + track of web site permissions. When they do, they MUST have a + permission storage identifier which is linked to a + permission storage entry. The permission storage entry MUST be a PermissionState or undefined.

      +

      + To get a permission storage identifier for a + PermissionName name and an environment settings + object settings, the UA MUST return a tuple consisting + of: +

      +
        +
      1. + name +
      2. +
      3. + settings' origin +
      4. +
      5. optional UA-specific data like whether settings' + browsing context has a parent browsing context, or + settings' top-level browsing context's origin +
      6. +

      The steps to retrieve a permission storage entry of a permission storage identifier are as follows: @@ -452,9 +488,15 @@

      follows:

        -
      1. Let identifier be the permission storage identifier - associated with the origin, global object and permission.
      2. -
      3. Run the steps to retrieve a permission storage entry.
      4. +
      5. + Get a permission storage identifier for + permission's PermissionName and the current + environment settings object, and let identifier be + the result. +
      6. +
      7. Run the steps to retrieve a permission storage entry of + identifier. +
      8. If the result of those steps are not undefined, return it and abort these steps.
      9. Otherwise, the user agent MUST return a default value based @@ -638,8 +680,11 @@

      10. Return promise and continue the following steps asynchronously.
      11. -
      12. Let identifier be the permission storage identifier - associated with the origin, global object and permission. +
      13. + Get a permission storage identifier for + permission.name and the current + environment settings object, and let identifier be + the result.
      14. Run the steps to delete a permission storage entry using identifier.
      15. From f8971ededce3ee7e02d371f66cf0a3e6e9a0d836 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Thu, 10 Mar 2016 16:26:03 -0800 Subject: [PATCH 3/3] Make Permissions.request() only take a single descriptor. This matches the current Chromium implementation (https://code.google.com/p/chromium/codesearch/#chromium/src/third_party/WebKit/Source/modules/permissions/Permissions.idl), which has a requestAll() function to handle a sequence of permissions. A sequence could also be handled with Promise.all(), like query() suggests. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 600f39e..6f58308 100644 --- a/index.html +++ b/index.html @@ -605,7 +605,7 @@

        interface Permissions { Promise<PermissionStatus> query(PermissionDescriptor permission); - Promise<PermissionStatus> request((PermissionDescriptor or sequence<PermissionDescriptor>) permissions); + Promise<PermissionStatus> request(PermissionDescriptor permission); Promise<PermissionStatus> revoke(PermissionDescriptor permission); };