Bug 40647 - Add optional contentType parameter to Blob.slice per latest File API spec
Summary: Add optional contentType parameter to Blob.slice per latest File API spec
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-15 17:24 PDT by Jian Li
Modified: 2010-06-17 13:15 PDT (History)
3 users (show)

See Also:


Attachments
Proposed Patch (8.47 KB, patch)
2010-06-15 17:28 PDT, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (8.58 KB, patch)
2010-06-16 14:11 PDT, Jian Li
levin: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2010-06-15 17:24:52 PDT
Need to add optional contentType parameter to Blob.slice per latest File API spec (http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob).
Comment 1 Jian Li 2010-06-15 17:28:18 PDT
Created attachment 58839 [details]
Proposed Patch
Comment 2 Kinuko Yasuda 2010-06-15 21:07:05 PDT
(The patch looks good to me though I'm not a reviewer.)

> diff --git a/LayoutTests/http/tests/local/resources/send-sliced-dragged-file.js b/LayoutTests/http/tests/local/resources/send-sliced-dragged-file.js
> +    subfile = (contentType != undefined) ? file.slice(start, length, contentType) : file.slice(start, length);

> diff --git a/WebCore/html/Blob.idl b/WebCore/html/Blob.idl
> +        Blob slice(in long long start, in long long length, in [Optional] DOMString contentType);

One question - don't we want to make the contentType parameter [Optional, ConvertUndefinedOrNullToNullString]?
Passing undefined value for an optional parameter leaves Blob.type undefined - it sounds a bit awkward to me.
Comment 3 Darin Fisher (:fishd, Google) 2010-06-16 11:28:48 PDT
Comment on attachment 58839 [details]
Proposed Patch

WebCore/html/Blob.h:69
 +      PassRefPtr<Blob> slice(long long start, long long length, const String& contentType = "") const;
Do you really want to pass "" here and not String()?
Comment 4 Jian Li 2010-06-16 14:11:12 PDT
Created attachment 58933 [details]
Proposed Patch

All fixed.
Comment 5 Jian Li 2010-06-17 13:15:11 PDT
Committed as http://trac.webkit.org/changeset/61343.