Changeset 120165 in webkit
- Timestamp:
- Jun 12, 2012 11:50:19 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120163 r120165 1 2012-06-11 Kinuko Yasuda <kinuko@chromium.org> 2 3 Unprefix Blob.webkitSlice 4 https://bugs.webkit.org/show_bug.cgi?id=78111 5 6 Reviewed by Adam Barth. 7 8 Converted existing tests that are calling Blob.webkitSlice() to call slice(). 9 10 * fast/files/blob-slice-overflow.html: 11 * fast/files/blob-slice-test.html: 12 * fast/files/resources/read-blob-test-cases.js: 13 (testReadingSlicedFileBlob): 14 (testReadingSlicedTextBlob): 15 (testReadingSlicedArrayBufferBlob): 16 (testReadingSlicedHybridBlob): 17 (testReadingTripleSlicedHybridBlob): 18 * fast/filesystem/resources/file-writer-utils.js: 19 (verifyByteRangeIsZeroesHelper): 20 * http/tests/local/blob/script-tests/send-hybrid-blob.js: 21 (runHybridBlobTest): 22 * http/tests/local/blob/script-tests/send-sliced-data-blob.js: 23 (runSliceTest): 24 * http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js: 25 (onStableFileDrop): 26 (onUnstableFileDrop): 27 * http/tests/local/formdata/resources/send-form-data-common.js: 28 (testSendingFormData): 29 * inspector/profiler/heap-snapshot-loader.html: 30 1 31 2012-06-12 Csaba Osztrogonác <ossy@webkit.org> 2 32 -
trunk/LayoutTests/fast/files/blob-slice-overflow.html
r115582 r120165 15 15 16 16 blob = new Blob([text]); 17 slicedBlob = blob. webkitSlice(1999, 9223372036854775000);17 slicedBlob = blob.slice(1999, 9223372036854775000); 18 18 19 19 document.getElementById('console').appendChild(document.createTextNode('Blob slice length: ' + slicedBlob.size)); -
trunk/LayoutTests/fast/files/blob-slice-test.html
r115582 r120165 47 47 if (start == undefined && end == undefined) { 48 48 message += "without parameters"; 49 subBlob = blob. webkitSlice();49 subBlob = blob.slice(); 50 50 } else if (end == undefined) { 51 51 message += "from " + start; 52 subBlob = blob. webkitSlice(start);52 subBlob = blob.slice(start); 53 53 } else { 54 54 message += "from " + start + " to " + end; 55 subBlob = blob. webkitSlice(start, end);55 subBlob = blob.slice(start, end); 56 56 } 57 57 message += ": "; -
trunk/LayoutTests/fast/files/resources/read-blob-test-cases.js
r119805 r120165 106 106 { 107 107 log("Test reading a blob containing sliced file"); 108 var blob = buildBlob([testFiles['file2']. webkitSlice(1, 6)]);108 var blob = buildBlob([testFiles['file2'].slice(1, 6)]); 109 109 readBlobAsBinaryString(testFiles, blob); 110 110 } … … 114 114 log("Test reading a blob containing sliced text"); 115 115 var blob = buildBlob(['First']) 116 blob = blob. webkitSlice(1, 11);116 blob = blob.slice(1, 11); 117 117 readBlobAsBinaryString(testFiles, blob); 118 118 } … … 123 123 var array = new Uint8Array([0, 1, 2, 128, 129, 130, 253, 254, 255]); 124 124 var blob = buildBlob([array]) 125 blob = blob. webkitSlice(1, 11);125 blob = blob.slice(1, 11); 126 126 readBlobAsBinaryString(testFiles, blob); 127 127 } … … 164 164 var array = new Uint8Array([48, 49, 50]); 165 165 var blob = buildBlob(['First', testFiles['file1'], 'Second', testFiles['file2'], testFiles['file3'], 'Third', array]); 166 var blob = blob. webkitSlice(7, 19);166 var blob = blob.slice(7, 19); 167 167 readBlobAsBinaryString(testFiles, blob); 168 168 } … … 172 172 log("Test reading a triple-sliced hybrid blob"); 173 173 var array = new Uint8Array([48, 49, 50]); 174 var items = ['First', testFiles['file1']. webkitSlice(1, 11), testFiles['empty-file'], 'Second', testFiles['file2'], testFiles['file3'], 'Third', array];174 var items = ['First', testFiles['file1'].slice(1, 11), testFiles['empty-file'], 'Second', testFiles['file2'], testFiles['file3'], 'Third', array]; 175 175 var blob = buildBlob(items); 176 var blob = blob. webkitSlice(7, 19);176 var blob = blob.slice(7, 19); 177 177 var blob2 = buildBlob(items.concat(['Foo', blob, 'Bar'])); 178 var blob2 = blob2. webkitSlice(12, 42);178 var blob2 = blob2.slice(12, 42); 179 179 readBlobAsBinaryString(testFiles, blob2); 180 180 } -
trunk/LayoutTests/fast/filesystem/resources/file-writer-utils.js
r115582 r120165 73 73 onSuccess(); 74 74 }; 75 fileReader.readAsBinaryString(file. webkitSlice(start, start + length));75 fileReader.readAsBinaryString(file.slice(start, start + length)); 76 76 } 77 77 … … 92 92 onSuccess(); 93 93 }; 94 fileReader.readAsText(file. webkitSlice(start, start + data.length));94 fileReader.readAsText(file.slice(start, start + data.length)); 95 95 } 96 96 -
trunk/LayoutTests/http/tests/local/blob/script-tests/send-hybrid-blob.js
r83873 r120165 18 18 var urlParameter = util.createUrlParameter(fileIndexOrStrings, opt_range); 19 19 if (opt_range) 20 blob = blob. webkitSlice(opt_range.start, opt_range.start + opt_range.length);20 blob = blob.slice(opt_range.start, opt_range.start + opt_range.length); 21 21 util.uploadBlob(blob, urlParameter); 22 22 } -
trunk/LayoutTests/http/tests/local/blob/script-tests/send-sliced-data-blob.js
r83873 r120165 8 8 var range = {'start':0, 'length':-1}; 9 9 for (var i = 0; i < ranges.length; ++i) { 10 blob = blob. webkitSlice(ranges[i].start, ranges[i].start + ranges[i].length);10 blob = blob.slice(ranges[i].start, ranges[i].start + ranges[i].length); 11 11 range.start += ranges[i].start; 12 12 } -
trunk/LayoutTests/http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js
r118920 r120165 57 57 { 58 58 // Slice the file. 59 subfile = file. webkitSlice(start, start + length, contentType);59 subfile = file.slice(start, start + length, contentType); 60 60 shouldEvaluateTo("subfile.size", computeExpectedLength(fileLength, start, length)); 61 61 shouldBe("subfile.type", (contentType != undefined && contentType != null) ? '"' + contentType + '"' : '""'); … … 76 76 { 77 77 // Slice the file. 78 subfile = file. webkitSlice(start, start + length, contentType);78 subfile = file.slice(start, start + length, contentType); 79 79 shouldEvaluateTo("subfile.size", computeExpectedLength(fileLength, start, length)); 80 80 shouldBe("subfile.type", (contentType != undefined && contentType != null) ? '"' + contentType + '"' : '""'); -
trunk/LayoutTests/http/tests/local/formdata/resources/send-form-data-common.js
r97274 r120165 71 71 if (dataList[i]['start'] && dataList[i]['length']) { 72 72 fileSliced = true; 73 file = file. webkitSlice(dataList[i]['start'], dataList[i]['start'] + dataList[i]['length']);73 file = file.slice(dataList[i]['start'], dataList[i]['start'] + dataList[i]['length']); 74 74 } 75 75 formDataList.push({'name': dataList[i]['name'], 'value': file, 'filename': dataList[i]['filename']}); -
trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html
r118778 r120165 90 90 name: "mock.heapsnapshot", 91 91 size: sourceStringified.length, 92 webkitSlice: function(begin, end) { 93 return this; 94 } 92 slice: function(begin, end) { return this; }, 93 webkitSlice: function(begin, end) { return this; } 95 94 }; 96 95 -
trunk/Source/WebCore/ChangeLog
r120164 r120165 1 2012-06-11 Kinuko Yasuda <kinuko@chromium.org> 2 3 Unprefix Blob.webkitSlice 4 https://bugs.webkit.org/show_bug.cgi?id=78111 5 6 Reviewed by Adam Barth. 7 8 Add unprefixed Blob.slice and start showing a deprecation message when webkitSlice is called. 9 10 No new tests: existing tests that call webkitSlice() are converted to slice(). They should keep running. 11 12 * bindings/gobject/WebKitDOMCustom.cpp: 13 (webkit_dom_blob_slice): Removed. 14 (webkit_dom_blob_webkit_slice): Added. 15 * fileapi/Blob.cpp: 16 (WebCore::Blob::slice): 17 (WebCore): 18 (WebCore::Blob::webkitSlice): 19 (WebCore::Blob::sliceInternal): Added. 20 * fileapi/Blob.h: 21 (WebCore): 22 (Blob): 23 * fileapi/Blob.idl: 24 1 25 2012-06-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 26 -
trunk/Source/WebCore/bindings/gobject/WebKitDOMCustom.cpp
r96093 r120165 45 45 /* Compatibility */ 46 46 WebKitDOMBlob* 47 webkit_dom_blob_ slice(WebKitDOMBlob* self, gint64 start, gint64 end, const gchar* content_type)47 webkit_dom_blob_webkit_slice(WebKitDOMBlob* self, gint64 start, gint64 end, const gchar* content_type) 48 48 { 49 return webkit_dom_blob_ webkit_slice(self, start, end, content_type);49 return webkit_dom_blob_slice(self, start, end, content_type); 50 50 } 51 51 … … 61 61 g_warning("The onforminput functionality has been removed from the DOM spec, this function does nothing."); 62 62 } 63 64 -
trunk/Source/WebCore/bindings/gobject/WebKitDOMCustom.h
r96093 r120165 30 30 31 31 /* Compatibility */ 32 WEBKIT_API WebKitDOMBlob* webkit_dom_blob_ slice(WebKitDOMBlob* self, gint64 start, gint64 end, const gchar* content_type);32 WEBKIT_API WebKitDOMBlob* webkit_dom_blob_webkit_slice(WebKitDOMBlob* self, gint64 start, gint64 end, const gchar* content_type); 33 33 WEBKIT_API void webkit_dom_html_form_element_dispatch_form_change(WebKitDOMHTMLFormElement* self); 34 34 WEBKIT_API void webkit_dom_html_form_element_dispatch_form_input(WebKitDOMHTMLFormElement* self); -
trunk/Source/WebCore/fileapi/Blob.cpp
r118394 r120165 34 34 #include "BlobURL.h" 35 35 #include "File.h" 36 #include "HistogramSupport.h" 37 #include "ScriptExecutionContext.h" 36 38 #include "ThreadableBlobRegistry.h" 37 39 38 40 namespace WebCore { 41 42 namespace { 43 44 // Used in histograms to see when we can actually deprecate the prefixed slice. 45 enum SliceHistogramEnum { 46 SliceWithoutPrefix, 47 SliceWithPrefix, 48 SliceHistogramEnumMax, 49 }; 50 51 } // namespace 39 52 40 53 Blob::Blob() … … 74 87 75 88 #if ENABLE(BLOB) 76 PassRefPtr<Blob> Blob::webkitSlice(long long start, long long end, const String& contentType) const 89 PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& contentType) const 90 { 91 HistogramSupport::histogramEnumeration("WebCore.Blob.slice", SliceWithoutPrefix, SliceHistogramEnumMax); 92 return sliceInternal(start, end, contentType); 93 } 94 95 PassRefPtr<Blob> Blob::webkitSlice(ScriptExecutionContext* context, long long start, long long end, const String& contentType) const 96 { 97 String message("Blob.webkitSlice() is deprecated. Use Blob.slice() instead ."); 98 context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, message); 99 100 HistogramSupport::histogramEnumeration("WebCore.Blob.slice", SliceWithPrefix, SliceHistogramEnumMax); 101 return sliceInternal(start, end, contentType); 102 } 103 104 PassRefPtr<Blob> Blob::sliceInternal(long long start, long long end, const String& contentType) const 77 105 { 78 106 // When we slice a file for the first time, we obtain a snapshot of the file by capturing its current size and modification time. -
trunk/Source/WebCore/fileapi/Blob.h
r118394 r120165 42 42 namespace WebCore { 43 43 44 class ScriptExecutionContext; 45 44 46 class Blob : public RefCounted<Blob> { 45 47 public: … … 69 71 70 72 #if ENABLE(BLOB) 71 PassRefPtr<Blob> webkitSlice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const; 73 PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const; 74 75 // Prefixed version is going to be deprecated. This internally calls sliceInternal() (as slice() does) after showing a deprecation message. 76 PassRefPtr<Blob> webkitSlice(ScriptExecutionContext*, long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const; 77 72 78 #endif 73 79 … … 78 84 // For deserialization. 79 85 Blob(const KURL& srcURL, const String& type, long long size); 86 87 #if ENABLE(BLOB) 88 PassRefPtr<Blob> sliceInternal(long long start, long long end, const String& contentType) const; 89 #endif 80 90 81 91 // This is an internal URL referring to the blob data associated with this object. It serves -
trunk/Source/WebCore/fileapi/Blob.idl
r115582 r120165 43 43 #if !defined(LANGUAGE_OBJECTIVE_C) 44 44 #if defined(ENABLE_BLOB) && ENABLE_BLOB 45 Blob webkitSlice(in [Optional] long long start, in [Optional] long long end, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); 45 Blob slice(in [Optional] long long start, in [Optional] long long end, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); 46 #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT 47 // Prefixed version is going to be deprecated. 48 [CallWith=ScriptExecutionContext] Blob webkitSlice(in [Optional] long long start, in [Optional] long long end, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); 49 #endif 46 50 #endif 47 51 #endif -
trunk/Source/WebCore/fileapi/File.h
r119824 r120165 57 57 // If filesystem files live in the remote filesystem, the port might pass the valid metadata (whose length field is non-negative) and cache in the File object. 58 58 // 59 // Otherwise calling size(), lastModifiedTime() and webkitSlice() will synchronously query the file metadata.59 // Otherwise calling size(), lastModifiedTime() and slice() will synchronously query the file metadata. 60 60 static PassRefPtr<File> createForFileSystemFile(const String& name, const FileMetadata& metadata) 61 61 {
Note: See TracChangeset
for help on using the changeset viewer.