Skip to content

Commit 07dc190

Browse files
committed
Modernize Blob constructor a tiny bit
All implementations do something different for new Blob(undefined, { type: "x/x" }). Let's do something simple. Fixes #54.
1 parent 3207e3f commit 07dc190

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

index.bs

+8-14
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Further normative definition of <a>snapshot state</a> can be found for {{File}}s
222222
<xmp class="idl">
223223
[Exposed=(Window,Worker), Serializable]
224224
interface Blob {
225-
constructor(optional sequence<BlobPart> blobParts,
225+
constructor(optional sequence<BlobPart> blobParts = [],
226226
optional BlobPropertyBag options = {});
227227

228228
readonly attribute unsigned long long size;
@@ -287,28 +287,22 @@ which runs these steps:
287287
## Constructors ## {#constructorBlob}
288288

289289
<div algorithm="blob-constructor">
290-
The {{Blob()}} constructor can be invoked with zero or more parameters.
291290
When the {{Blob()}} constructor is invoked,
292291
user agents must run the following steps:
293292

294-
1. If invoked with zero parameters,
295-
return a new {{Blob}} object consisting of 0 bytes,
296-
with {{Blob/size}} set to 0,
297-
and with {{Blob/type}} set to the empty string.
298-
299293
1. Let |bytes| be the result of [=processing blob parts=] given {{blobParts}} and {{Blob/Blob(blobParts, options)/options}}.
300294

301-
1. If the {{BlobPropertyBag/type}} member of the {{Blob/Blob(blobParts, options)/options}} argument is not the empty string,
302-
run the following sub-steps:
295+
1. Let |t| be the empty string.
296+
297+
1. If {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"] does not contain any characters outside the range U+0020 to U+007E, inclusive, then:
298+
299+
1. Set |t| to {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"].
303300

304-
1. Let |t| be the {{BlobPropertyBag/type}} dictionary member.
305-
If |t| contains any characters outside the range U+0020 to U+007E,
306-
then set |t| to the empty string and return from these substeps.
307301
1. Convert every character in |t| to [=ASCII lowercase=].
308302

309303
1. Return a {{Blob}} object referring to |bytes| as its associated <a>byte</a> sequence,
310304
with its {{Blob/size}} set to the length of |bytes|,
311-
and its {{Blob/type}} set to the value of |t| from the substeps above.
305+
and its {{Blob/type}} set to |t|.
312306

313307
</div>
314308

@@ -1769,6 +1763,6 @@ This specification was originally developed by the SVG Working Group. Many thank
17691763

17701764
Thanks to Robin Berjon, Jonas Sicking and Vsevolod Shmyroff for editing the original specification.
17711765

1772-
Special thanks to Olli Pettay, Nikunj Mehta, Garrett Smith, Aaron Boodman, Michael Nordman, Jian Li, Dmitry Titov, Ian Hickson, Darin Fisher, Sam Weinig, Adrian Bateman and Julian Reschke.
1766+
Special thanks to Boris Zbarsky, Olli Pettay, Nikunj Mehta, Garrett Smith, Aaron Boodman, Michael Nordman, Jian Li, Dmitry Titov, Ian Hickson, Darin Fisher, Sam Weinig, Adrian Bateman, and Julian Reschke.
17731767

17741768
Thanks to the W3C WebApps WG, and to participants on the [email protected] listserv

0 commit comments

Comments
 (0)