Closed Bug 669437 Opened 13 years ago Closed 13 years ago

Implement BlobBuilder.getFile

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: sicking, Assigned: sicking)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Attached patch Patch to fixSplinter Review
Bug summary is pretty self explanatory. getFile takes a filename and an optional content type.
Attachment #544038 - Flags: review?(khuey)
Comment on attachment 544038 [details] [diff] [review]
Patch to fix

Review of attachment 544038 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with two things:

1. Change the right UUID
2. Add a test to ensure that sending a Blob through FormData and sending a Blob with an empty filename send the same data (this should be the case, right?)

::: content/base/public/nsIDOMFile.idl
@@ +62,5 @@
>                                        [optional] in long long end,
>                                        [optional] in DOMString contentType);
>  };
>  
> +[scriptable, builtinclass, uuid(43c9856d-f2a7-4720-bca7-c731da24d99a)]

Why are you changing this?

@@ +72,5 @@
>    // This performs no security checks!
>    [noscript] readonly attribute DOMString mozFullPathInternal;
>  };
>  
> +[scriptable, builtinclass, uuid(c4a77171-039b-4f84-97f9-820fb51626af)]

And why this one didn't change?
Attachment #544038 - Flags: review?(khuey) → review+
Merged:
http://hg.mozilla.org/mozilla-central/rev/6c328da30bed
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
"Add a test to ensure that sending a Blob through FormData and sending a Blob with an empty filename send the same data (this should be the case, right?)"

Not sure, but is what you say related to this one here: https://bugzilla.mozilla.org/show_bug.cgi?id=680423
Lines 357-360 have a comment:

// NB: This is a willful violation of the spec.  The spec says that
// the existing contents of the BlobBuilder should be included
// in the next blob produced.  This seems silly and has been raised
// on the WHATWG listserv.

Interesting note, but where in the spec this is mentioned, can't find, anyone quick link?... Sorry for slight offtopic.
(In reply to Davit Barbakadze from comment #5)
> Lines 357-360 have a comment:
> 
> // NB: This is a willful violation of the spec.  The spec says that
> // the existing contents of the BlobBuilder should be included
> // in the next blob produced.  This seems silly and has been raised
> // on the WHATWG listserv.
> 
> Interesting note, but where in the spec this is mentioned, can't find,
> anyone quick link?... Sorry for slight offtopic.

Well, it's more in what the spec doesn't say.  http://dev.w3.org/2009/dap/file-system/file-writer.html#widl-BlobBuilder-getBlob-Blob-in-DOMString-contentType makes no mention of clearing the existing contents of the BlobBuilder, and IMO it should.
In order to document this, I was looking in the spec where BlobBuilder.getFile() is defined. I didn't found anything in the latest Editor's Draft: http://dev.w3.org/2009/dap/file-system/file-writer.html

What am I missing?
According to comments above, it's not part of the spec but is apparently something we think should be. So we should document it and label it with the non-standard template for now.
Actually, I've been convinced by various people that this function is a bad idea, so we'll likely remove it before long. So not sure it's worth spending time on documenting.
Is there a bug on removing getFile()? I need to keep aware of the status of that to be sure the docs get updated (or not) as appropriate based on the final decision there.
@Jonas Sicking, can you share some arguments for getFile being a bad idea?
Both google and microsoft preferred a solution where the File interface always represents blobs backed by a OS-filesystem-file. That makes the distinction between Blobs and Files more meaningful and makes it easier to add more metadata to File later.

Note that this does not mean that Blobs which aren't Files can't also be backed by a OS-filesystem-file. It just means that that metadata wouldn't be available in that case.
This interface is deprecated and marked as such in the docs. I've added getFile() for completeness as it's implemented since Fx 8.0:
https://developer.mozilla.org/en/DOM/BlobBuilder

Make sure to add dev-doc-needed to any follow-up bugs which will remove it.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: