Re: [w3c/manifest] Adding file_handlers and launch consumer (#1005)

@dmurph commented on this pull request.

Thanks!

> +          How file handlers are registered and disambiguated is at the
+          discretion of the operating system.

I like it. Done.

> +            without the explicit knowledge of the user. To protect against
+            possible mis-use, user agents MAY require explicit user consent to
+            begin with the process to [=execute a file handler launch=]. If
+            consent is denied, the user agent MAY remove the web application's
+            OS registration as a file handling entity.
+          </p>
+        </section>
+        <section>
+          <h3>
+            Privacy consideration: Name and icon.
+          </h3>
+          <p>
+            The name and icon of each file handler can be sensitive to privacy
+            and security, as there isn't a specified way for the user to see
+            and confirm these. Due to this, user agents MAY choose to replace
+            these with name and icon derived from the application's icon and

Done.

> +            OS registration as a file handling entity.
+          </p>
+        </section>
+        <section>
+          <h3>
+            Privacy consideration: Name and icon.
+          </h3>
+          <p>
+            The name and icon of each file handler can be sensitive to privacy
+            and security, as there isn't a specified way for the user to see
+            and confirm these. Due to this, user agents MAY choose to replace
+            these with name and icon derived from the application's icon and
+            name in the [=process a file handler item=] algorithm.
+          </p>
+        </section>
+        <aside class="example">

You are right - I made this a section.

> +          The [=file handler=]'s <code><dfn data-dfn-for=
+          "file handler">accept</dfn></code> member is a <a>dictionary</a>
+          mapping [=MIME types=] to a list of extensions. Extensions have to be
+          strings that start with a "." and only contain [=valid suffix code
+          points=]. Additionally extensions are limited to a length of 16 code
+          points.
+        </p>
+        <p>
+          In addition to complete [=MIME types=], "*" can be used as the
+          subtype of a MIME type to match, for example, all image formats with
+          "image/*". However, the top-level type MUST be defined in [[rfc2046]]
+          and listed in [[IANA_MEDIA_TYPES]].
+        </p>
+        <p>
+          Websites MUST always provide both [=MIME types=] and file extensions
+          for each [=file handler/accept=] entry. This format is required by

On linux we use both - we associate with the mime-type, and we restrict the matches to the extension. I tried to update this to be a little clearer... let me know what you think.

> +        </p>
+      </section>
+      <section data-cite="MIMETYPE">
+        <h3>
+          `accept` member
+        </h3>
+        <p>
+          The [=file handler=]'s <code><dfn data-dfn-for=
+          "file handler">accept</dfn></code> member is a <a>dictionary</a>
+          mapping [=MIME types=] to a list of extensions. Extensions have to be
+          strings that start with a "." and only contain [=valid suffix code
+          points=]. Additionally extensions are limited to a length of 16 code
+          points.
+        </p>
+        <p>
+          In addition to complete [=MIME types=], "*" can be used as the

The enforcement for them having to do with each other, at least on Linux, is that we use both [1], where the mime-type is specified, but the extension is also specified as a glob entry. Example [2] as well (not great).

But I think I understand what you're saying. I'll try to update this to match the behavior better - let me know what you think.

[1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/shell_integration_linux.cc;l=731;drc=9d70e034c6a4c2b1ed56c94aace3f3c8d2b1f771;bpv=1;bpt=1

[2] https://wiki.archlinux.org/title/XDG_MIME_Applications


> +                  "name": "Comma-separated Value",
+                  "accept": {
+                    "text/csv": [ ".csv" ]
+                  },
+                  "icons": [
+                    {
+                      "src": "/csv-file.png",
+                      "sizes": "144x144"
+                    }
+                  ]
+                },
+                {
+                  "action": "/open-svg",
+                  "name": "Image",
+                  "accept": {
+                    "image/svg+xml": ".svg"

Done.

> +                  "name": "Comma-separated Value",
+                  "accept": {
+                    "text/csv": [ ".csv" ]
+                  },
+                  "icons": [
+                    {
+                      "src": "/csv-file.png",
+                      "sizes": "144x144"
+                    }
+                  ]
+                },
+                {
+                  "action": "/open-svg",
+                  "name": "Image",
+                  "accept": {
+                    "image/svg+xml": ".svg"

Done.

> +            </ul>
+          </li>
+          <li>Let |url:URL| be the result of [=URL Parser|parsing=]
+          |item|["action"] with |start_url URL| as the base URL.
+          </li>
+          <li>If |url| is failure, return failure.
+          </li>
+          <li>If |url| is not [=manifest/within scope=] of |scope|, return
+          failure.
+          </li>
+          <li>Let |accept:ordered map| be an [=ordered map=].
+          </li>
+          <li>[=map/iterate=] |mime_type_string:string| → |extensions| of
+          |item|["accept"]
+            <ol>
+              <li>If |extensions| is not a [=string=] or [=list=], return

Done

> +              </li>
+              <li>If |mime_type_parsed|.type is not listed in as a top-level
+              type in [[IANA_MEDIA_TYPES]], return failure.
+              </li>
+              <li>Add |mime_type_string| → |extensions| to |accept|.
+              </li>
+            </ol>
+          </li>
+          <li>Let |file_handler:ordered map| be |ordered map| «[ "action" →
+          |url|, "name" → |item|["name"], "accept" → |accept| ]».
+          </li>
+          <li>[=Process image resources=] passing |item|["icons"],
+          |file_handler|, |manifest URL|, and "icons".
+          </li>
+          <li>The user agent MAY replace |file_handler|["icons"] with the
+          application icon.

Agreed. I'll just say something vague.

> +    </section>
+    <section data-cite="file-system-access">
+      <h2>
+        <dfn>Execute a file handler launch</dfn>
+      </h2>
+      <p>
+        A {{Window/window}} has an associated {{LaunchConsumer}} <dfn>assigned
+        launch consumer</dfn>.
+      </p>
+      <p>
+        A {{Window/window}} has an associated [=list=] of {{LaunchParams}}
+        <dfn>unconsumed launch params</dfn>.
+      </p>
+      <p>
+        When a [=file type=] is registered with a web app and one or more of
+        these registered files are launched on the platform, run the following

Hm.... @inexorabletash or @marcoscaceres I need some spec help here - how do you think I should specify this? do the above "assigned launch consumer" and "unconsumed launch params" live across same-origin redirects?

> +      <section data-dfn-for="LaunchParams">
+        <h3>
+          <dfn>LaunchParams</dfn> interface
+        </h3>
+        <pre class="idl">
+          [Exposed=Window] interface LaunchParams {
+            readonly attribute FrozenArray&lt;FileSystemHandle&gt; files;
+          };
+        </pre>
+        <section>
+          <h2>
+            <dfn>files</dfn> attribute
+          </h2>
+          <p>
+            The {{LaunchParams/files}} attribute is a {{FrozenArray}} of
+            {{FileSystemHandle}}s.

@mkruisselbrink I tried to state this in a way that made sense, but you'll know better how to specify this.

> +          "image/*". However, the top-level type MUST be defined in [[rfc2046]]
+          and listed in [[IANA_MEDIA_TYPES]].

Removed, and added to the algorithm.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/pull/1005#pullrequestreview-767240164

Received on Wednesday, 29 September 2021 23:15:03 UTC