From b5e13dce227329acb61e0d8371fb68c6da23ec2e Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Thu, 26 Mar 2015 21:31:19 +0000 Subject: [PATCH 1/3] Add related_applications and prefer_related_applications. Fixes issue 326. --- index.html | 274 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) diff --git a/index.html b/index.html index 853c193a..f083b2d3 100644 --- a/index.html +++ b/index.html @@ -1633,6 +1633,136 @@

+
+

+ related_applications member +

+

+ The related_applications + member lists all the applications related to the web application. +

+

+ The related_applications member is as an indication of a + relationship of the web application and the listed applications. This + relationship is unidirectional and unless a listed application claims + the same relationship, the user agent MUST NOT assume a + bi-directional endorsement. +

+

+ Example of usages of the related_applications could be a + crawler that would use that information to gather more information + about the web application or a browser that could suggest a listed + application as an alternative if the user wants to install the web + application. +

+

+ The steps for processing the related_applications + member are given by the following algorithm. The algorithm + takes a manifest as an argument. This algorithm returns a list of + applications objects applications, which can be empty. +

+
    +
  1. Let applications be an empty list. +
  2. +
  3. Let unprocessed applications be the result of calling + the [[\GetOwnProperty]] internal method of manifest + with argument "related_applications". +
  4. +
  5. If unprocessed applications is an array, then: +
      +
    1. For each potential application in the array: +
        +
      1. Let platform be the result of running the + steps for processing the platform member of an + application with potential application. +
      2. +
      3. If platform is undefined, move + onto the next item if any are left. +
      4. +
      5. Let id be the result of running the steps + for processing the id member of an + application with potential application. +
      6. +
      7. Let url be the result of running the steps + for processing the url member of an + application with potential application. +
      8. +
      9. If both id and url are + undefined, move onto the next item if any are + left. +
      10. +
      11. Otherwise, let application be an object with + properties platform, id, + url respectively set to platform, + id and url. +
      12. +
      13. Append application to applications. +
      14. +
      +
    2. +
    +
  6. +
  7. Otherwise, if unprocessed applications is not + undefined: +
      +
    1. + Issue a developer warning that the type is not + supported. +
    2. +
    +
  8. +
  9. Return applications. +
  10. +
+
+
+

+ prefer_related_applications member +

+

+ The prefer_related_applications + member is a boolean value this is used as a hint for the user agent + to say that related applications should be preferred over the web + application. The user agent MUST consider the missing value as + equivalent to have it set to false. +

+

+ The prefer_related_applications member is as an + indication to the user agent that related applications should be + preferred over the web application when appropriate. For example, if + the user agent wants to suggest to install the web application and + the prefer_related_applications is set to + true, the user agent might want to suggest installing + one of the listed related applications instead. +

+

+ The steps for processing the + prefer_related_applications member are given by + the following algorithm. The algorithm takes a manifest as an + argument. This algorithm returns a boolean. +

+
    +
  1. Let value be the result of calling the + [[\GetOwnProperty]] internal method of manifest + with argument "prefer_related_applications". +
  2. +
  3. If Type(value) is not "boolean": +
      +
    1. If Type(value) is not "undefined", + optionally issue a developer warning that the type is not + supported. +
    2. +
    3. Return false. +
    4. +
    +
  4. +
  5. Return value. +
  6. +
+

@@ -1925,6 +2055,150 @@

+
+

+ Application object and its members +

+

+ Each application object represents an application related to + the web application. An application object has three properties: a + platform which represents the platform it is associated + to, a url which represents the URL where the application + can be found and an id which can be used as an information + additional to the URL or instead of the URL, depending on the platform. + A valid application object MUST have platform and + either an url or an id (or both). +

+
+

+ In the following example, the web application is listing two + different related applications, one on Google Play Store and the + other one on the iTunes Store: +

+
+{
+  "related_applications": [
+      {
+        "platform": "play",
+        "url": "https://play.google.com/store/apps/details?id=com.example.app1",
+        "id": "com.example.app1"
+      }, {
+        "platform": "itunes",
+        "url": "https://itunes.apple.com/app/example-app1/id123456789",
+      }]
+ }
+
+
+

+ Where should the platform expected value be listed? +

+
+

+ platform member +

+

+ The platform member of an + application object represents the platform on which the application + can be found. +

+

+ The steps for processing the platform member of an + application are given by the following algorithm. The algorithm + takes an application object application. This + algorithm will return a string or undefined. +

+
    +
  1. Let value be the result of calling the + [[\GetOwnProperty]] internal method of application + passing "platform" as the argument. +
  2. +
  3. If Type(value) is not "string": +
      +
    1. If Type(value) is not "undefined", + optionally issue a developer warning that the type is not + supported. +
    2. +
    3. Return undefined. +
    4. +
    +
  4. +
  5. Otherwise, Trim(value) and return the result. +
  6. +
+
+
+

+ url member +

+

+ The url member of an application + object represents the url at which the application can be found. +

+

+ The steps for processing the url member of an + application are given by the following algorithm. The algorithm + takes an application object application. This + algorithm will return an URL or undefined. +

+
    +
  1. Let value be the result of calling the + [[\GetOwnProperty]] internal method of application + passing "url" as the argument. +
  2. +
  3. If Type(value) is not "string": +
      +
    1. If Type(value) is not "undefined", + optionally issue a developer warning that the type is not + supported. +
    2. +
    3. Return undefined. +
    4. +
    +
  4. +
  5. Trim( value) and set value to be resulting + string. +
  6. +
  7. Otherwise, parse value and + if the result is not failure, return the result, otherwise return + undefined. +
  8. +
+
+
+

+ id member +

+

+ The id member of an application + object represents the id which is used to represent the application + on the platform. +

+

+ The steps for processing the id member of an + application are given by the following algorithm. The algorithm + takes an application object application. This + algorithm will return a string or undefined. +

+
    +
  1. Let value be the result of calling the + [[\GetOwnProperty]] internal method of application + passing "id" as the argument. +
  2. +
  3. If Type(value) is not "string": +
      +
    1. If Type(value) is not "undefined", + optionally issue a developer warning that the type is not + supported. +
    2. +
    3. Return undefined. +
    4. +
    +
  4. +
  5. Otherwise, Trim(value) and return the result. +
  6. +
+
+

Common conventions and dependencies From 6266391e111fd2e82928215160ef2d136c79c1a1 Mon Sep 17 00:00:00 2001 From: Anssi Kostiainen Date: Fri, 27 Mar 2015 14:43:46 +0200 Subject: [PATCH 2/3] Define 'related application'; simplify prefer_related_applications prose. Fix typo. --- index.html | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index f083b2d3..b946e9d9 100644 --- a/index.html +++ b/index.html @@ -315,7 +315,7 @@

  • Otherwise, return false.
  • -
    +

    Enforcing the navigation scope depends on [[!HTML]]'s navigate algorithm. As such, the following algorithm monkey patches [[!HTML]]. @@ -1637,17 +1637,19 @@

    related_applications member

    +

    + A related application is an application accessible to the + underlying application platform that has a relationship with the + web application associated with a manifest.

    The related_applications - member lists all the applications related to the web application. -

    -

    - The related_applications member is as an indication of a - relationship of the web application and the listed applications. This - relationship is unidirectional and unless a listed application claims - the same relationship, the user agent MUST NOT assume a - bi-directional endorsement. + member lists related applications + and serves as an indication of such a relationship between web + application and related applications. This relationship is + unidirectional and unless a listed application claims the same + relationship, the user agent MUST NOT assume a bi-directional + endorsement.

    Example of usages of the related_applications could be a @@ -1660,7 +1662,7 @@

    The steps for processing the related_applications member are given by the following algorithm. The algorithm takes a manifest as an argument. This algorithm returns a list of - applications objects applications, which can be empty. + application objects applications, which can be empty.

    1. Let applications be an empty list. @@ -1724,19 +1726,15 @@

      The prefer_related_applications - member is a boolean value this is used as a hint for the user agent - to say that related applications should be preferred over the web - application. The user agent MUST consider the missing value as - equivalent to have it set to false. -

      -

      - The prefer_related_applications member is as an - indication to the user agent that related applications should be - preferred over the web application when appropriate. For example, if - the user agent wants to suggest to install the web application and - the prefer_related_applications is set to - true, the user agent might want to suggest installing - one of the listed related applications instead. + member is a boolean value that is used as a hint for the user agent + to say that related applications + should be preferred over the web application. The user agent MUST + consider the missing value as equivalent to have it set to + false. If the prefer_related_applications + is set to true, and the user agent wants to suggest to + install the web application, the user agent might want to suggest + installing one of the related + applications instead.

      The steps for processing the From db6d57215eb4f81ed6c08b098e3ce4fb172194b2 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Tue, 7 Apr 2015 22:36:32 +0100 Subject: [PATCH 3/3] Add processing the manifest steps. --- index.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index b946e9d9..0ec2b1cd 100644 --- a/index.html +++ b/index.html @@ -315,7 +315,7 @@

    2. Otherwise, return false.
    -
    +

    Enforcing the navigation scope depends on [[!HTML]]'s navigate algorithm. As such, the following algorithm monkey patches [[!HTML]]. @@ -958,6 +958,16 @@

    member with manifest, manifest URL, document URL, start URL as arguments. +
  • Let related_applications of parsed manifest + be the result of running the steps for processing the + related_applications member with manifest + as argument. +
  • +
  • Let prefer_related_applications of parsed + manifest be the result of running the steps for processing + the prefer_related_applications member with + manifest as argument. +
  • Return parsed manifest.
  • @@ -1639,8 +1649,9 @@

    A related application is an application accessible to the - underlying application platform that has a relationship with the - web application associated with a manifest. + underlying application platform that has a relationship with the web + application associated with a manifest. +

    The related_applications