From f61564925e201e996b565f880d510e29f5d9634a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 14 May 2020 19:21:18 +1000 Subject: [PATCH] Add the ability to share files (#133) Add a `files` member to ShareData dictionary. Co-authored-by: Eric Willigers --- index.html | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 1c5702b..96c4db7 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,7 @@ }; - +

This specification defines an API for sharing text, links and other @@ -141,8 +141,17 @@

rejected with {{InvalidStateError}}.
  • If none of |data|'s members {{ShareData/title}}, - {{ShareData/text}}, or {{ShareData/url}} are present, return a - promise rejected with a {{TypeError}}. + {{ShareData/text}}, or {{ShareData/url}} or {{ShareData/file}} are + present, return a promise rejected with a {{TypeError}}. +
  • +
  • If |data|'s {{ShareData/files}} member is present: +
      +
    1. If |data|'s {{ShareData/files}} member is empty, or if the + implementation does not support file sharing, return a + promise rejected with a {{TypeError}}, and abort these + steps. +
    2. +
  • If |data|'s {{ShareData/url}} member is present:
      @@ -163,7 +172,8 @@

  • If the [=relevant global object=] of [=this=] does not have - [=transient activation=], return a promise rejected with + [=transient activation=], or a file type is being blocked due to + security considerations, return a promise rejected with with a {{"NotAllowedError"}} {{DOMException}}.
  • Set {{[[sharePromise]]}} to be a new promise. @@ -244,6 +254,7 @@

               dictionary ShareData {
    +            FrozenArray<File> files;
                 USVString title;
                 USVString text;
                 USVString url;
    @@ -254,6 +265,12 @@ 

    members:

    +
    + files member +
    +
    + Files to be shared. +
    title member