Skip to content

Commit f615649

Browse files
Marcos Cáceresericwilligers
Marcos Cáceres
andauthored
Add the ability to share files (#133)
Add a `files` member to ShareData dictionary. Co-authored-by: Eric Willigers <[email protected]>
1 parent 3801fcf commit f615649

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

index.html

+21-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
};
4040
</script>
4141
</head>
42-
<body>
42+
<body data-cite="FILEAPI">
4343
<section id="abstract">
4444
<p>
4545
This specification defines an API for sharing text, links and other
@@ -141,8 +141,17 @@ <h4>
141141
rejected with</a> {{InvalidStateError}}.
142142
</li>
143143
<li>If none of |data|'s members {{ShareData/title}},
144-
{{ShareData/text}}, or {{ShareData/url}} are present, return <a>a
145-
promise rejected with</a> a {{TypeError}}.
144+
{{ShareData/text}}, or {{ShareData/url}} or {{ShareData/file}} are
145+
present, return <a>a promise rejected with</a> a {{TypeError}}.
146+
</li>
147+
<li>If |data|'s {{ShareData/files}} member is present:
148+
<ol>
149+
<li>If |data|'s {{ShareData/files}} member is empty, or if the
150+
implementation does not support file sharing, return <a>a
151+
promise rejected with</a> a {{TypeError}}, and abort these
152+
steps.
153+
</li>
154+
</ol>
146155
</li>
147156
<li>If |data|'s {{ShareData/url}} member is present:
148157
<ol>
@@ -163,7 +172,8 @@ <h4>
163172
</ol>
164173
</li>
165174
<li>If the [=relevant global object=] of [=this=] does not have
166-
[=transient activation=], return <a>a promise rejected with</a>
175+
[=transient activation=], or a file type is being blocked due to
176+
security considerations, return <a>a promise rejected with</a>
167177
with a {{"NotAllowedError"}} {{DOMException}}.
168178
</li>
169179
<li>Set {{[[sharePromise]]}} to be <a>a new promise</a>.
@@ -244,6 +254,7 @@ <h3>
244254
</h3>
245255
<pre class="idl">
246256
dictionary ShareData {
257+
FrozenArray&lt;File&gt; files;
247258
USVString title;
248259
USVString text;
249260
USVString url;
@@ -254,6 +265,12 @@ <h3>
254265
members:
255266
</p>
256267
<dl data-sort="">
268+
<dt>
269+
<dfn>files</dfn> member
270+
</dt>
271+
<dd>
272+
Files to be shared.
273+
</dd>
257274
<dt>
258275
<dfn>title</dfn> member
259276
</dt>

0 commit comments

Comments
 (0)