Commit f48782fd authored by jianli@chromium.org's avatar jianli@chromium.org

.: 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: http://svn.webkit.org/repository/webkit/trunk@55670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eff15e83
2010-03-08 Jian Li <jianli@chromium.org>
Reviewed by Dmitry Titov.
Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993
Add ENABLE_BLOB_SLICE feature define.
* configure.ac:
2010-03-04 Fridrich Strba <fridrich.strba@bluewin.ch>
Reviewed by Holger Freyther.
......
2010-03-08 Jian Li <jianli@chromium.org>
Reviewed by Dmitry Titov.
Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993
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:
2010-03-07 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
......
......@@ -41,6 +41,7 @@ ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING;
ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING;
ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING;
ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE;
ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING;
ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
ENABLE_DATABASE = ENABLE_DATABASE;
......@@ -74,4 +75,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
......@@ -272,6 +272,7 @@ EXPORTS
?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z
?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z
?toInt32SlowCase@JSC@@YAHNAA_N@Z
?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z
?toNumber@JSCell@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSObject@JSC@@UBENPAVExecState@2@@Z
?toNumber@JSString@JSC@@EBENPAVExecState@2@@Z
......
2010-03-08 Jian Li <jianli@chromium.org>
Reviewed by Dmitry Titov.
Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993
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:
2010-03-08 Daniel Bates <dbates@rim.com>
Reviewed by Simon Fraser.
......
......@@ -71,7 +71,8 @@ var __skip__ = {
"window.WebGLUnsignedByteArray" : 1,
"window.WebGLUnsignedIntArray" : 1,
"window.WebGLUnsignedShortArray" : 1,
"window.clientInformation.geolocation" : 1
"window.clientInformation.geolocation" : 1,
"window.Blob.prototype.slice" : 1
};
function logValue(valueName)
......
Hello
\ No newline at end of file
1234567890
\ No newline at end of file
description("Test for sending a dragged file via XMLHttpRequest.");
var fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.style.width = "100px";
fileInput.style.height = "100px";
// Important that we put this at the top of the doc so that logging does not cause it to go out of view (where it can't be dragged to)
document.body.insertBefore(fileInput, document.body.firstChild);
fileInput.addEventListener("dragenter", function() {
event.preventDefault();
}, false);
fileInput.addEventListener("dragover", function() {
event.dataTransfer.dropEffect = "copy";
event.preventDefault();
}, false);
fileInput.addEventListener("drop", function() {
if (event.dataTransfer.types.indexOf("Files") != -1 && event.dataTransfer.files.length == 1)
testPassed("event.dataTransfer contains a File object on drop.");
else {
testFailed("event.dataTransfer does not contain a File object on drop.");
return;
}
function onFileDrop(file)
{
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/post-echo.cgi", false);
xhr.send(event.dataTransfer.files[0]);
if (xhr.responseText == "Hello")
xhr.send(file);
if (xhr.responseText == "1234567890")
testPassed("Expected response data received.");
else
testFailed("Unexpected response data received: " + xhr.responseText);
event.preventDefault();
}, false);
function moveMouseToCenterOfElement(element) {
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function runTest()
{
setFileInputDropCallback(onFileDrop);
eventSender.beginDragWithFiles(["resources/file-for-drag-to-send.txt"]);
moveMouseToCenterOfElement(fileInput);
eventSender.mouseUp();
......@@ -51,7 +24,7 @@ function runTest()
if (window.eventSender) {
runTest();
// Clean up after ourselves
fileInput.parentNode.removeChild(fileInput);
removeFileInputElement();
} else {
testFailed("This test is not interactive, please run using DumpRenderTree");
}
......
description("Test for slicing a dragged file and sending it via XMLHttpRequest.");
var originalText = "1234567890";
var tempFileName = "send-slice-dragged-file.tmp";
var tempFileOriginalModificationTime;
var subfile;
function uploadFile(file, expectedText, expectedException)
{
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/xmlhttprequest/resources/post-echo.cgi", false);
var passed;
var message;
try {
xhr.send(file);
if (expectedException) {
passed = false;
message = "Unexpected response data received: " + xhr.responseText + ". Expecting exception thrown";
} else {
if (xhr.responseText == expectedText) {
passed = true;
message = "Expected response data received: " + xhr.responseText;
} else {
passed = false;
message = "Unexpected response data received: " + xhr.responseText + ". Expecting: " + expectedText;
}
}
} catch (ex) {
if (expectedException) {
passed = true;
message = "Expected exception thrown: " + ex;
} else {
passed = false;
message = "Unexpected exception thrown: " + ex;
}
}
if (passed)
testPassed(message);
else
testFailed(message);
}
function createTempFile(fileData)
{
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/resources/write-temp-file.php?filename=" + tempFileName + "&data=" + fileData, false);
xhr.send();
if (xhr.status != 200) {
testFailed("Unexpected response status received: " + xhr.status);
return;
}
var values = xhr.responseText.split('\n');
if (values.length < 2) {
testFailed("Unexpected response text received: " + xhr.responseText);
return;
}
return values;
}
function touchTempFile()
{
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/resources/touch-temp-file.php?filename=" + tempFileName, false);
xhr.send();
}
function removeTempFile()
{
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8000/resources/reset-temp-file.php?filename=" + tempFileName, false);
xhr.send();
}
function onStableFileDrop(file, start, length)
{
// Slice the file.
subfile = file.slice(start, length);
var expectedText = originalText.substring(start, start + length);
shouldEvaluateTo("subfile.size", expectedText.length);
// Upload the sliced file.
uploadFile(subfile, expectedText, false);
}
function dragAndSliceStableFile(start, length)
{
setFileInputDropCallback(function(file) { onStableFileDrop(file, start, length); });
eventSender.beginDragWithFiles(["resources/file-for-drag-to-send.txt"]);
moveMouseToCenterOfElement(fileInput);
eventSender.mouseUp();
}
function onUnstableFileDrop(file, start, length)
{
// Slice the file.
subfile = file.slice(start, length);
var expectedText = originalText.substring(start, start + length);
shouldEvaluateTo("subfile.size", expectedText.length);
// Upload the sliced file.
uploadFile(subfile, expectedText, false);
// Touch the underlying temp file.
touchTempFile();
// Upload the sliced file. We should receive an exception since the file has been changed.
uploadFile(subfile, null, true);
// Remove the temp file.
removeTempFile();
}
function dragAndSliceUnstableFile(start, length)
{
var tempFileInfo = createTempFile(originalText);
if (tempFileInfo.length < 2) {
done();
return;
}
var tempFilePath = tempFileInfo[0];
tempFileOriginalModificationTime = tempFileInfo[1];
setFileInputDropCallback(function(file) { onUnstableFileDrop(file, start, length); });
eventSender.beginDragWithFiles([tempFilePath]);
moveMouseToCenterOfElement(fileInput);
eventSender.mouseUp();
}
function runTest()
{
dragAndSliceStableFile(2, 4);
dragAndSliceStableFile(2, 20);
dragAndSliceStableFile(15, 20);
dragAndSliceUnstableFile(3, 5);
}
if (window.eventSender) {
runTest();
// Clean up after ourselves
removeFileInputElement();
} else {
testFailed("This test is not interactive, please run using DumpRenderTree");
}
var successfullyParsed = true;
var fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.style.width = "100px";
fileInput.style.height = "100px";
// Important that we put this at the top of the doc so that logging does not cause it to go out of view (where it can't be dragged to)
document.body.insertBefore(fileInput, document.body.firstChild);
fileInput.addEventListener("dragenter", function() {
event.preventDefault();
}, false);
fileInput.addEventListener("dragover", function() {
event.dataTransfer.dropEffect = "copy";
event.preventDefault();
}, false);
var fileInputDropCallback = null;
fileInput.addEventListener("drop", function() {
if (event.dataTransfer.types.indexOf("Files") != -1 && event.dataTransfer.files.length == 1)
testPassed("event.dataTransfer contains a File object on drop.");
else {
testFailed("event.dataTransfer does not contain a File object on drop.");
return;
}
fileInputDropCallback(event.dataTransfer.files[0]);
event.preventDefault();
}, false);
function setFileInputDropCallback(fileInputDropCallbackFunc)
{
fileInputDropCallback = fileInputDropCallbackFunc;
}
function moveMouseToCenterOfElement(element)
{
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function removeFileInputElement()
{
fileInput.parentNode.removeChild(fileInput)
}
......@@ -7,6 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/setup-file-input-element-for-drag.js"></script>
<script src="resources/send-dragged-file.js"></script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
......
Test for slicing a dragged file and sending it via XMLHttpRequest.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS event.dataTransfer contains a File object on drop.
PASS subfile.size is 4
PASS Expected response data received: 3456
PASS event.dataTransfer contains a File object on drop.
PASS subfile.size is 8
PASS Expected response data received: 34567890
PASS event.dataTransfer contains a File object on drop.
PASS subfile.size is 0
PASS Expected response data received:
PASS event.dataTransfer contains a File object on drop.
PASS subfile.size is 5
PASS Expected response data received: 45678
PASS Expected exception thrown: Error: NETWORK_ERR: XMLHttpRequest Exception 101
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/setup-file-input-element-for-drag.js"></script>
<script src="resources/send-sliced-dragged-file.js"></script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
<?php
require_once 'portabilityLayer.php';
if (!sys_get_temp_dir()) {
echo "FAIL: No temp dir was returned.\n";
exit();
}
$tmpFile = sys_get_temp_dir() . "/" . $_GET['filename'];
$stat = stat($tmpFile);
if (!$stat) {
echo "FAIL: stat() call failed.\n";
exit();
}
$mtime = $stat['mtime'] + 1;
if (!touch($tmpFile, $mtime)) {
echo "FAIL: touch() call failed.\n";
}
?>
<?php
require_once 'portabilityLayer.php';
if (!sys_get_temp_dir()) {
echo "FAIL: No temp dir was returned.\n";
exit();
}
$tmpFile = sys_get_temp_dir() . "/" . $_GET['filename'];
if (!file_put_contents($tmpFile, $_GET['data'])) {
echo "FAIL: unable to write to file: " . $tmpFile . "\n";
exit();
}
$stat = stat($tmpFile);
echo $tmpFile . "\n";
echo $stat['mtime'];
?>
......@@ -3421,6 +3421,7 @@ http/tests/loading/preload-img-test.html
http/tests/loading/slow-parsing-subframe.html
http/tests/loading/text-content-type-with-binary-extension.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/media/video-play-stall-seek.html
http/tests/media/video-play-stall.html
http/tests/media/video-seekable-stall.html
......
......@@ -53,6 +53,7 @@ plugins/set-status.html
# Failing Local tests
http/tests/local/drag-over-remote-content.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
# Failing navigation tests
http/tests/navigation/anchor-frames.html
......
......@@ -660,6 +660,7 @@ fast/forms/input-selectedoption.html
# <https://bugs.webkit.org/show_bug.cgi?id=29287>
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
# <https://bugs.webkit.org/show_bug.cgi?id=29289>
plugins/destroy-during-npp-new.html
......
2010-03-08 Jian Li <jianli@chromium.org>
Reviewed by Dmitry Titov.
Blob.slice support.
https://bugs.webkit.org/show_bug.cgi?id=32993
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):
2010-03-08 Daniel Bates <dbates@rim.com>
Reviewed by Simon Fraser.
......
......@@ -41,6 +41,7 @@ ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING;
ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING;
ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING;
ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE;
ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING;
ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
ENABLE_DATABASE = ENABLE_DATABASE;
......@@ -74,4 +75,4 @@ ENABLE_XHTMLMP = ;
ENABLE_XPATH = ENABLE_XPATH;
ENABLE_XSLT = ENABLE_XSLT;
FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
......@@ -981,8 +981,8 @@ webcore_sources += \
WebCore/history/HistoryItem.h \
WebCore/history/PageCache.cpp \
WebCore/history/PageCache.h \
WebCore/html/Blob.cpp \
WebCore/html/Blob.h \
WebCore/html/Blob.cpp \
WebCore/html/Blob.h \
WebCore/html/canvas/CanvasContextAttributes.h \
WebCore/html/canvas/CanvasGradient.cpp \
WebCore/html/canvas/CanvasGradient.h \
......@@ -3504,6 +3504,14 @@ else
webcore_cppflags += -DENABLE_WEB_SOCKETS=0
endif # END ENABLE_WEB_SOCKETS
# ---
# Blob.slice support
# ---
if ENABLE_BLOB_SLICE
FEATURE_DEFINES += ENABLE_BLOB_SLICE=1
webcore_cppflags += -DENABLE_BLOB_SLICE=1
endif # END ENABLE_BLOB_SLICE
DerivedSources/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl
if sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E '^[^#]'; then echo 'Duplicate value!'; exit 1; fi
......
......@@ -54,6 +54,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
!contains(DEFINES, ENABLE_VIDEO=.): DEFINES += ENABLE_VIDEO=1
!contains(DEFINES, ENABLE_RUBY=.): DEFINES += ENABLE_RUBY=1
!contains(DEFINES, ENABLE_SANDBOX=.): DEFINES += ENABLE_SANDBOX=1
!contains(DEFINES, ENABLE_BLOB_SLICE=.): DEFINES += ENABLE_BLOB_SLICE=0
greaterThan(QT_MINOR_VERSION, 5) {
!contains(DEFINES, ENABLE_3D_RENDERING=.): DEFINES += ENABLE_3D_RENDERING=1
......
......@@ -37,17 +37,77 @@ namespace WebCore {
Blob::Blob(const String& path)
: m_path(path)
#if ENABLE(BLOB_SLICE)
, m_start(0)
, m_length(toEndOfFile)
, m_snapshotCaptured(false)
, m_snapshotSize(0)
, m_snapshotModificationTime(doNotCheckFileChange)
#endif
{
}
#if ENABLE(BLOB_SLICE)
Blob::Blob(const String& path, long long start, long long length, long long snapshotSize, double snapshotModificationTime)
: m_path(path)
, m_start(start)
, m_length(length)
, m_snapshotCaptured(true)
, m_snapshotSize(snapshotSize)
, m_snapshotModificationTime(snapshotModificationTime)
{
ASSERT(start >= 0 && length >= 0 && start + length <= snapshotSize && snapshotModificationTime);
}