@@ -104,6 +104,25 @@ <h3>
104
104
target</ a > . Clients can use the presence or absence of this method to
105
105
determine whether to show UI that triggers its use.
106
106
</ div >
107
+ < section >
108
+ < h4 >
109
+ Internal Slots
110
+ </ h4 >
111
+ < p >
112
+ This API adds the following internal slot to the {{Navigator}}
113
+ interface.
114
+ </ p >
115
+ < dl >
116
+ < dt >
117
+ {{Promise}}? < dfn > [[\sharePromise]]</ dfn >
118
+ </ dt >
119
+ < dd >
120
+ The {{[[sharePromise]]}} is a promise that represents a user's
121
+ current intent to share some data with a < a > share target</ a > . It
122
+ is initialized to `null`.
123
+ </ dd >
124
+ </ dl >
125
+ </ section >
107
126
< section >
108
127
< h4 >
109
128
< dfn > share()</ dfn > method
113
132
|data:ShareData|, run the following steps:
114
133
</ p >
115
134
< ol class ="algorithm ">
135
+ < li > If {{[[sharePromise]]}} is not `null`, return < a > a promise
136
+ rejected with</ a > {{InvalidStateError}}.
137
+ </ li >
116
138
< li > If none of |data|'s members {{ShareData/title}},
117
139
{{ShareData/text}}, or {{ShareData/url}} are present, return < a > a
118
140
promise rejected with</ a > a {{TypeError}}.
@@ -140,32 +162,60 @@ <h4>
140
162
return < a > a promise rejected with</ a > with a {{"NotAllowedError"}}
141
163
{{DOMException}}.
142
164
</ li >
143
- < li > Let |p:Promise| be < a > a new promise</ a > .
165
+ < li > Set {{[[sharePromise]]}} to be < a > a new promise</ a > .
144
166
</ li >
145
- < li > Return |p| and < a > in parallel</ a > :
167
+ < li > Return {{[[sharePromise]]}} and < a > in parallel</ a > :
146
168
< ol >
147
- < li > If there are no < a > share targets</ a > available,
148
- < a > reject</ a > |p| with an {{"AbortError"}} {{DOMException}},
149
- and abort these steps.
169
+ < li > If there are no < a > share targets</ a > available:
170
+ < ol >
171
+ < li >
172
+ < a > Reject</ a > {{[[sharePromise]]}} with an
173
+ "{{AbortError}}" {{DOMException}}.
174
+ </ li >
175
+ < li > Set {{[[sharePromise]]}} to `null`.
176
+ </ li >
177
+ < li > Abort these steps.
178
+ </ li >
179
+ </ ol >
150
180
</ li >
151
181
< li > Present the user with a choice of one or more < a > share
152
182
targets</ a > , selected at the user agent's discretion. The user
153
183
MUST be given the option to cancel rather than choosing any of
154
184
the share targets. Wait for the user's choice.
155
185
</ li >
156
- < li > If the user chose to cancel the share operation,
157
- < a > reject</ a > |p| with an {{"AbortError"}} {{DOMException}},
158
- and abort these steps.
186
+ < li > If the user chose to cancel the share operation:
187
+ < ol >
188
+ < li >
189
+ < a > Reject</ a > {{[[sharePromise]]}} with an
190
+ "{{AbortError}}" {{DOMException}},
191
+ </ li >
192
+ < li > Set {{[[sharePromise]]}} to `null`.
193
+ </ li >
194
+ < li > Abort these steps.
195
+ </ li >
196
+ </ ol >
159
197
</ li >
160
198
< li > Activate the chosen < a > share target</ a > , < a > convert |data|
161
199
to a format suitable for ingestion into the target</ a > , and
162
- transmit the converted data to the target. If an error occurs
163
- starting the target or transmitting the data, < a > reject</ a > |p|
164
- with an {{"AbortError"}} {{DOMException}}, and abort these
165
- steps.
200
+ transmit the converted data to the target.
201
+ </ li >
202
+ < li > If an error occurs starting the target or transmitting the
203
+ data:
204
+ < ol >
205
+ < li >
206
+ < a > reject</ a > {{[[sharePromise]]}} with an
207
+ "{{DataError}}" {{DOMException}}, and abort these steps.
208
+ </ li >
209
+ < li > Set {{[[sharePromise]]}} to `null`.
210
+ </ li >
211
+ < li > Abort these steps.
212
+ </ li >
213
+ </ ol >
166
214
</ li >
167
215
< li > Once the data has been successfully transmitted to the
168
- target, < a > resolve</ a > |p| with < b > undefined</ b > .
216
+ target, < a > resolve</ a > {{[[sharePromise]]}} with `undefined`.
217
+ </ li >
218
+ < li > Set {{[[sharePromise]]}} to `null`.
169
219
</ li >
170
220
</ ol >
171
221
</ li >
0 commit comments