.: Blob.slice support.
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Mar 2010 18:13:31 +0000 (18:13 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Mar 2010 18:13:31 +0000 (18:13 +0000)
commit3185c5799a7cb8f1e75618f85a261057190ad80e
tree7271c0ce3a5f64237807024f74df76515be00726
parent04d97d6432014e0f677519385ae1d4af7e208f2d
.: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define.

* configure.ac:

JavaScriptCore: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define.
Also fix a problem that JSValue.toInteger is not exposed on Windows.

* Configurations/FeatureDefines.xcconfig:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:

WebCore: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

The following semantic is adopted per the discussions on public-webapps:
1) File.slice() does a synchronous IO to capture the current size and
   modification time and cache them in the resulting Blob.
2) Subsequent Blob operations, like Blob.slice and Blob.size simply
   use the cached values.
3) When the underlying file data are accessed, like in XHR.send(), the
   UA will check the cached modification time against the current
   modification time to determine if the file has been changed or not.
   An error or exception will be thrown if needed.

Also add ENABLE_BLOB_SLICE feature define.

Test: http/tests/local/send-sliced-dragged-file.html

* Configurations/FeatureDefines.xcconfig:
* GNUmakefile.am:
* WebCore.pri:
* html/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::size):
(WebCore::Blob::slice):
* html/Blob.h:
(WebCore::Blob::start):
(WebCore::Blob::length):
(WebCore::Blob::modificationTime):
* html/Blob.idl:
* platform/network/FormData.cpp:
(WebCore::FormData::deepCopy):
(WebCore::FormData::appendFile):
(WebCore::FormData::appendFileRange):
* platform/network/FormData.h:
(WebCore::FormDataElement::FormDataElement):
(WebCore::operator==):
* platform/network/mac/FormDataStreamMac.mm:
(WebCore::advanceCurrentStream):
(WebCore::openNextStream):
(WebCore::formCreate):
(WebCore::formOpen):
(WebCore::formRead):
(WebCore::setHTTPBody):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):

WebKit/chromium: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define.

* features.gypi:

WebKit/mac: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define.

* Configurations/FeatureDefines.xcconfig:

WebKitLibraries: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define.

* win/tools/vsprops/FeatureDefines.vsprops:
* win/tools/vsprops/FeatureDefinesCairo.vsprops:

WebKitTools: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add ENABLE_BLOB_SLICE feature define and  flag for build-webkit. It is
currently only turned on for Mac.

* Scripts/build-webkit:

LayoutTests: Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993

Reviewed by Dmitry Titov.

Add a new layout test to test slicing and sending a file. In addition,
two new scripts are introduced to create and touch the temp file.

Move some code from send-dragged-file.js to a new file
setup-file-input-element-for-drag.js so that it can be used by both
send-dragged-file.js and send-sliced-dragged-file.js to setup the input
element for the file dragging.

Since the Blob.slice is only enabled for Mac, we disable the new test
for all other platforms.

* fast/dom/Window/window-properties.html:
* http/tests/local/resources/file-for-drag-to-send.txt:
* http/tests/local/resources/send-dragged-file.js:
* http/tests/local/resources/send-sliced-dragged-file.js: Added.
* http/tests/local/resources/setup-file-input-element-for-drag.js: Added.
* http/tests/local/send-dragged-file.html:
* http/tests/local/send-sliced-dragged-file-expected.txt: Added.
* http/tests/local/send-sliced-dragged-file.html: Added.
* http/tests/resources/touch-temp-file.php: Added.
* http/tests/resources/write-temp-file.php: Added.
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
ChangeLog
JavaScriptCore/ChangeLog
JavaScriptCore/Configurations/FeatureDefines.xcconfig
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties.html
LayoutTests/http/tests/local/resources/file-for-drag-to-send.txt
LayoutTests/http/tests/local/resources/send-dragged-file.js
LayoutTests/http/tests/local/resources/send-sliced-dragged-file.js [new file with mode: 0644]
LayoutTests/http/tests/local/resources/setup-file-input-element-for-drag.js [new file with mode: 0644]
LayoutTests/http/tests/local/send-dragged-file.html
LayoutTests/http/tests/local/send-sliced-dragged-file-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/local/send-sliced-dragged-file.html [new file with mode: 0644]
LayoutTests/http/tests/resources/touch-temp-file.php [new file with mode: 0644]
LayoutTests/http/tests/resources/write-temp-file.php [new file with mode: 0644]
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/Configurations/FeatureDefines.xcconfig
WebCore/GNUmakefile.am
WebCore/WebCore.pri
WebCore/html/Blob.cpp
WebCore/html/Blob.h
WebCore/html/Blob.idl
WebCore/platform/network/FormData.cpp
WebCore/platform/network/FormData.h
WebCore/platform/network/mac/FormDataStreamMac.mm
WebCore/xml/XMLHttpRequest.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/features.gypi
WebKit/mac/ChangeLog
WebKit/mac/Configurations/FeatureDefines.xcconfig
WebKitLibraries/ChangeLog
WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops
WebKitTools/ChangeLog
WebKitTools/Scripts/build-webkit
configure.ac