2010-06-22 Kinuko Yasuda <kinuko@chromium.org>
authorkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jun 2010 03:55:57 +0000 (03:55 +0000)
committerkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jun 2010 03:55:57 +0000 (03:55 +0000)
        Reviewed by Adam Barth.

        Add BlobBuilder.idl to expose BlobBuilder interface
        https://bugs.webkit.org/show_bug.cgi?id=40593

        (Resubmitting with the correct file set.)

        BlobBuilder is defined in FileAPI's FileWriter spec.
        (http://dev.w3.org/2009/dap/file-system/file-writer.html)

        Also removes the ENABLE_FILE_WRITER ifdef guard for BlobBuilder.

        Tests: http/tests/local/blob/send-data-blob.html
               http/tests/local/blob/send-hybrid-blob.html
               http/tests/local/blob/send-sliced-data-blob.html

        * Android.derived.jscbindings.mk:
        * Android.derived.v8bindings.mk:
        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * html/BlobBuilder.cpp:
        (WebCore::BlobBuilder::append):
        * html/BlobBuilder.h:
        * html/BlobBuilder.idl: Added.
        * page/DOMWindow.idl:
2010-06-22  Kinuko Yasuda  <kinuko@chromium.org>

        Reviewed by Adam Barth.

        Add BlobBuilder.idl to expose BlobBuilder interface
        https://bugs.webkit.org/show_bug.cgi?id=40593

        (Resubmitting with the correct file set.)

        Add new layout tests to test BlobBuilder interface.
        Also update test expectations affected by adding the constructors to DOMWindow.

        * fast/dom/Window/window-properties-expected.txt:
        * fast/dom/Window/window-property-descriptors-expected.txt:
        * fast/dom/constructed-objects-prototypes-expected.txt:
        * fast/dom/prototype-inheritance-2-expected.txt:
        * fast/dom/prototype-inheritance-expected.txt:
        * fast/js/global-constructors-expected.txt:
        * http/tests/local/blob/resources/hybrid-blob-util.js: Added.
        * http/tests/local/blob/script-tests/TEMPLATE.html: Added.
        * http/tests/local/blob/script-tests/send-data-blob.js: Added.
        * http/tests/local/blob/script-tests/send-hybrid-blob.js: Added.
        * http/tests/local/blob/script-tests/send-sliced-data-blob.js: Added.
        * http/tests/local/blob/send-data-blob-expected.txt: Added.
        * http/tests/local/blob/send-data-blob.html: Added.
        * http/tests/local/blob/send-hybrid-blob-expected.txt: Added.
        * http/tests/local/blob/send-hybrid-blob.html: Added.
        * http/tests/local/blob/send-sliced-data-blob-expected.txt: Added.
        * http/tests/local/blob/send-sliced-data-blob.html: Added.
        * http/tests/local/resources/file-for-drag-to-send2.txt: Added.
        * http/tests/resources/post-and-verify-hybrid.cgi: Added.
        * platform/chromium/fast/dom/prototype-inheritance-expected.txt:
        * platform/gtk/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
        * platform/gtk/fast/dom/Window/window-properties-expected.txt:
        * platform/gtk/fast/dom/Window/window-property-descriptors-expected.txt:
        * platform/gtk/fast/dom/prototype-inheritance-expected.txt:
        * platform/qt/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
        * platform/qt/fast/dom/Window/window-properties-expected.txt:
        * platform/qt/fast/dom/Window/window-property-descriptors-expected.txt:
        * platform/qt/fast/dom/prototype-inheritance-expected.txt:
        * platform/win/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
        * platform/win/fast/dom/Window/window-property-descriptors-expected.txt:
        * platform/win/fast/dom/prototype-inheritance-2-expected.txt:
        * platform/win/fast/dom/prototype-inheritance-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@61650 268f45cc-cd09-0410-ab3c-d52691b4dbfc

48 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
LayoutTests/fast/dom/prototype-inheritance-expected.txt
LayoutTests/fast/js/global-constructors-expected.txt
LayoutTests/http/tests/local/blob/resources/hybrid-blob-util.js [new file with mode: 0644]
LayoutTests/http/tests/local/blob/script-tests/TEMPLATE.html [new file with mode: 0644]
LayoutTests/http/tests/local/blob/script-tests/send-data-blob.js [new file with mode: 0644]
LayoutTests/http/tests/local/blob/script-tests/send-hybrid-blob.js [new file with mode: 0644]
LayoutTests/http/tests/local/blob/script-tests/send-sliced-data-blob.js [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-data-blob-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-data-blob.html [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-hybrid-blob-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-hybrid-blob.html [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-sliced-data-blob-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/local/blob/send-sliced-data-blob.html [new file with mode: 0644]
LayoutTests/http/tests/local/resources/file-for-drag-to-send2.txt [new file with mode: 0644]
LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi [new file with mode: 0755]
LayoutTests/platform/chromium/fast/dom/prototype-inheritance-expected.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/gtk/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/gtk/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/platform/gtk/fast/dom/prototype-inheritance-expected.txt
LayoutTests/platform/qt/Skipped
LayoutTests/platform/qt/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/qt/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/platform/qt/fast/dom/prototype-inheritance-expected.txt
LayoutTests/platform/win/Skipped
LayoutTests/platform/win/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/platform/win/fast/dom/prototype-inheritance-2-expected.txt
LayoutTests/platform/win/fast/dom/prototype-inheritance-expected.txt
WebCore/Android.derived.jscbindings.mk
WebCore/Android.derived.v8bindings.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/html/BlobBuilder.cpp
WebCore/html/BlobBuilder.h
WebCore/html/BlobBuilder.idl [new file with mode: 0644]
WebCore/page/DOMWindow.idl

index 80f1086..185a598 100644 (file)
@@ -1,3 +1,48 @@
+2010-06-22  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add BlobBuilder.idl to expose BlobBuilder interface
+        https://bugs.webkit.org/show_bug.cgi?id=40593
+
+        (Resubmitting with the correct file set.)
+
+        Add new layout tests to test BlobBuilder interface.
+        Also update test expectations affected by adding the constructors to DOMWindow.
+
+        * fast/dom/Window/window-properties-expected.txt:
+        * fast/dom/Window/window-property-descriptors-expected.txt:
+        * fast/dom/constructed-objects-prototypes-expected.txt:
+        * fast/dom/prototype-inheritance-2-expected.txt:
+        * fast/dom/prototype-inheritance-expected.txt:
+        * fast/js/global-constructors-expected.txt:
+        * http/tests/local/blob/resources/hybrid-blob-util.js: Added.
+        * http/tests/local/blob/script-tests/TEMPLATE.html: Added.
+        * http/tests/local/blob/script-tests/send-data-blob.js: Added.
+        * http/tests/local/blob/script-tests/send-hybrid-blob.js: Added.
+        * http/tests/local/blob/script-tests/send-sliced-data-blob.js: Added.
+        * http/tests/local/blob/send-data-blob-expected.txt: Added.
+        * http/tests/local/blob/send-data-blob.html: Added.
+        * http/tests/local/blob/send-hybrid-blob-expected.txt: Added.
+        * http/tests/local/blob/send-hybrid-blob.html: Added.
+        * http/tests/local/blob/send-sliced-data-blob-expected.txt: Added.
+        * http/tests/local/blob/send-sliced-data-blob.html: Added.
+        * http/tests/local/resources/file-for-drag-to-send2.txt: Added.
+        * http/tests/resources/post-and-verify-hybrid.cgi: Added.
+        * platform/chromium/fast/dom/prototype-inheritance-expected.txt:
+        * platform/gtk/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
+        * platform/gtk/fast/dom/Window/window-properties-expected.txt:
+        * platform/gtk/fast/dom/Window/window-property-descriptors-expected.txt:
+        * platform/gtk/fast/dom/prototype-inheritance-expected.txt:
+        * platform/qt/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
+        * platform/qt/fast/dom/Window/window-properties-expected.txt:
+        * platform/qt/fast/dom/Window/window-property-descriptors-expected.txt:
+        * platform/qt/fast/dom/prototype-inheritance-expected.txt:
+        * platform/win/Skipped: Added send-hybrid-blob.html and send-sliced-data-blob.html because they need eventSender.beginDragWithFiles and Blob.slice.
+        * platform/win/fast/dom/Window/window-property-descriptors-expected.txt:
+        * platform/win/fast/dom/prototype-inheritance-2-expected.txt:
+        * platform/win/fast/dom/prototype-inheritance-expected.txt:
+
 2010-06-22  Adele Peterson  <adele@apple.com>
 
         Reviewed by Darin Adler.
index ec93285..c0cfca5 100644 (file)
@@ -150,6 +150,10 @@ window.BeforeLoadEvent.prototype.stopImmediatePropagation [function]
 window.BeforeLoadEvent.prototype.stopPropagation [function]
 window.Blob [object BlobConstructor]
 window.Blob.prototype [object BlobPrototype]
+window.BlobBuilder [object BlobBuilderConstructor]
+window.BlobBuilder.prototype [object BlobBuilderPrototype]
+window.BlobBuilder.prototype.append [function]
+window.BlobBuilder.prototype.getBlob [function]
 window.CDATASection [object CDATASectionConstructor]
 window.CDATASection.prototype [object CDATASectionPrototype]
 window.CDATASection.prototype.ATTRIBUTE_NODE [number]
index e64d19e..1e2a14b 100644 (file)
@@ -8,6 +8,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'Attr') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Audio') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'BeforeLoadEvent') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Blob') is 'object'
+PASS typeof Object.getOwnPropertyDescriptor(window, 'BlobBuilder') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Boolean') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CDATASection') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CSSCharsetRule') is 'object'
index 869ae16..27f0fb8 100644 (file)
@@ -5,6 +5,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS (new inner.Audio()).isInner is true
 PASS (new inner.Audio()).constructor.isInner is true
+PASS (new inner.BlobBuilder()).isInner is true
+PASS (new inner.BlobBuilder()).constructor.isInner is true
 PASS (new inner.DOMParser()).isInner is true
 PASS (new inner.DOMParser()).constructor.isInner is true
 PASS (new inner.FormData()).isInner is true
index 41a78cd..201ed95 100644 (file)
@@ -208,6 +208,7 @@ PASS WebKitCSSKeyframesRule from inner.document.getElementById("dummyStyle").she
 PASS WebKitCSSKeyframesRuleConstructor from inner.document.getElementById("dummyStyle").sheet.cssRules.6.constructor
 PASS WebKitCSSKeyframesRulePrototype from inner.document.getElementById("dummyStyle").sheet.cssRules.6.__proto__
 Never found Audio
+Never found BlobBuilder
 Never found Blob
 Never found CDATASection
 Never found CSSRule
index 3c9932e..62baa1e 100644 (file)
@@ -11,6 +11,8 @@ PASS inner.BeforeLoadEvent.isInner is true
 PASS inner.BeforeLoadEvent.constructor.isInner is true
 PASS inner.Blob.isInner is true
 PASS inner.Blob.constructor.isInner is true
+PASS inner.BlobBuilder.isInner is true
+PASS inner.BlobBuilder.constructor.isInner is true
 PASS inner.CDATASection.isInner is true
 PASS inner.CDATASection.constructor.isInner is true
 PASS inner.CSSCharsetRule.isInner is true
index 73a0b42..da9198c 100644 (file)
@@ -7,6 +7,7 @@ PASS Attr.toString() is '[object AttrConstructor]'
 PASS Audio.toString() is '[object AudioConstructor]'
 PASS BeforeLoadEvent.toString() is '[object BeforeLoadEventConstructor]'
 PASS Blob.toString() is '[object BlobConstructor]'
+PASS BlobBuilder.toString() is '[object BlobBuilderConstructor]'
 PASS CDATASection.toString() is '[object CDATASectionConstructor]'
 PASS CSSCharsetRule.toString() is '[object CSSCharsetRuleConstructor]'
 PASS CSSFontFaceRule.toString() is '[object CSSFontFaceRuleConstructor]'
diff --git a/LayoutTests/http/tests/local/blob/resources/hybrid-blob-util.js b/LayoutTests/http/tests/local/blob/resources/hybrid-blob-util.js
new file mode 100644 (file)
index 0000000..bf15f16
--- /dev/null
@@ -0,0 +1,146 @@
+var HybridBlobTestUtil = function(testFunc, opt_filePaths) {
+    this.testCallbackFunc = testFunc;
+
+    this.testFilePaths = opt_filePaths;
+    this.testFiles = [];
+    this.testFileMap = {};
+    this.fileInput = null;
+
+    this.dragBaseDir = "";
+    this.urlPathBaseDir = "";
+
+    this.testUrl = "http://127.0.0.1:8000/resources/post-and-verify-hybrid.cgi";
+
+    this.uploadBlob = function(blob, urlParameter)
+    {
+        var xhr = new XMLHttpRequest();
+        xhr.open("POST", this.testUrl + "?" + urlParameter, false);
+
+        var passed;
+        var message;
+        try {
+            xhr.send(blob);
+            if (xhr.responseText == "OK") {
+                passed = true;
+                message = "Expected response data received: " + xhr.responseText;
+            } else {
+                passed = false;
+                message = "Unexpected response data received: " + xhr.responseText;
+            }
+        } catch (ex) {
+            passed = false;
+            message = "Unexpected exception thrown: " + ex;
+        }
+
+        if (passed)
+            testPassed(message);
+        else
+            testFailed(message + ' params:' + urlParameter);
+    };
+
+    this.onInputFileChange = function()
+    {
+        var files = document.getElementById("file").files;
+        this.testFiles = new Array();
+        for (var i = 0; i < files.length; i++) {
+            this.testFiles.push(files[i]);
+            this.testFileMap[testFilePaths[i]] = files[i];
+        }
+        this.testCallbackFunc();
+    };
+
+    this.runTestsWithDrag = function()
+    {
+        this.fileInput = document.createElement("input");
+        this.fileInput.id = "file";
+        this.fileInput.type = "file";
+        this.fileInput.style.width = "100px";
+        this.fileInput.style.height = "100px";
+        this.fileInput.multiple = true;
+        var obj = this;
+        this.fileInput.addEventListener("change", function() { obj.onInputFileChange() }, false);
+        document.body.insertBefore(this.fileInput, document.body.firstChild);
+
+        if (this.dragBaseDir) {
+            var filePaths = [];
+            for (var i = 0; i < this.testFilePaths.length; ++i) {
+                filePaths.push(this.dragBaseDir + this.testFilePaths[i]);
+            }
+            this.testFilePaths = filePaths;
+        }
+
+        eventSender.beginDragWithFiles(this.testFilePaths);
+        eventSender.mouseMoveTo(10, 10);
+        eventSender.mouseUp();
+    };
+
+    this.runTests = function() {
+        if (!this.testCallbackFunc)
+            testFailed("Test body function is not initialized.");
+        else if (this.testFilePaths)
+            this.runTestsWithDrag();
+        else
+            this.testCallbackFunc();
+    };
+
+    this.FileItem = function(path)
+    {
+        var item = new Object();
+        item.type = 'file';
+        item.path = path;
+        item.value = this.testFileMap[path];
+        return item;
+    }
+
+    this.DataItem = function(data)
+    {
+        var item = new Object();
+        item.type = 'data';
+        item.value = data;
+        return item;
+    }
+
+    this.createItemParamArray = function(items, itemParams, opt_ending)
+    {
+        for (var i = 0; i < items.length; i++) {
+            if (items[i] instanceof Array)
+                this.createItemParamArray(items[i], itemParams, opt_ending);
+            else if (items[i].type == "data") {
+                var data = items[i].value;
+                if (opt_ending)
+                    data = data.replace(/\r\n/g, "[NL]").replace(/[\n\r]/g, "[NL]");
+                itemParams.push("data:" + escape(data));
+            } else if (items[i].type == "file")
+                itemParams.push("file:" + this.urlPathBaseDir + items[i].path);
+        }
+    };
+
+    this.createUrlParameter = function(items, opt_range, opt_ending)
+    {
+        var itemParams = [];
+        this.createItemParamArray(items, itemParams, opt_ending);
+        var urlParameter = "items=" + itemParams.join(",");
+        if (opt_range) {
+            urlParameter += "&start=" + opt_range.start;
+            urlParameter += "&length=" + opt_range.length;
+        }
+        if (opt_ending)
+            urlParameter += "&convert_newlines=1";
+        return urlParameter;
+    };
+
+    this.appendAndCreateBlob = function(items, opt_ending, opt_type)
+    {
+        var bb = new BlobBuilder();
+        for (var i = 0; i < items.length; i++) {
+            if (items[i] instanceof Array) {
+                // If it's an array, combine its elements and append as a blob.
+                bb.append(this.appendAndCreateBlob(items[i], opt_ending, opt_type));
+            } else if (items[i].type == "data" && opt_ending)
+                bb.append(items[i].value, opt_ending);
+            else
+                bb.append(items[i].value);
+        }
+        return bb.getBlob(opt_type);
+    };
+};
diff --git a/LayoutTests/http/tests/local/blob/script-tests/TEMPLATE.html b/LayoutTests/http/tests/local/blob/script-tests/TEMPLATE.html
new file mode 100644 (file)
index 0000000..d4df4cd
--- /dev/null
@@ -0,0 +1,14 @@
+<!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/hybrid-blob-util.js"></script>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/local/blob/script-tests/send-data-blob.js b/LayoutTests/http/tests/local/blob/script-tests/send-data-blob.js
new file mode 100644 (file)
index 0000000..a7dc896
--- /dev/null
@@ -0,0 +1,63 @@
+description("Test for building blobs with multiple strings combined by BlobBuilder and sending them via XMLHttpRequest.");
+
+var util = new HybridBlobTestUtil(runTests);
+
+function runAppendTest(appendItems, opt_ending, opt_urlParameter, opt_type)
+{
+    var blob = util.appendAndCreateBlob(appendItems, opt_ending, opt_type);
+    var urlParameter = opt_urlParameter;
+    if (!opt_urlParameter)
+        urlParameter = util.createUrlParameter(appendItems, null, opt_ending);
+    if (opt_type != undefined)
+        shouldBe("'" + blob.type + "'", "'" + opt_type + "'");
+    util.uploadBlob(blob, urlParameter);
+}
+
+function runTests()
+{
+    var stringA = util.DataItem('A1234567|');
+    var stringB = util.DataItem('B12345|');
+    var stringC = util.DataItem('C12345678901|');
+
+    var stringLF = util.DataItem('12345\n67890\n');
+    var stringCRLF = util.DataItem('ABCDE\r\nFGHIJ\r\n');
+    var stringCR = util.DataItem('abcde\rfghij\r');
+
+    debug('* BlobBuilder.append(string)');
+    runAppendTest([ stringA ]);
+    runAppendTest([ stringA, stringB ]);
+    runAppendTest([ stringA, stringB ], null, null, 'type/foo');
+
+    debug('* BlobBuilder.append(blob)');
+    runAppendTest([ [ stringA ] ]);
+    runAppendTest([ [ stringA, stringB, stringA ] ]);
+    runAppendTest([ [ stringA, stringC ] ], null, null, 'type/bar');
+
+    debug('* BlobBuilder.append(string/blob)');
+    runAppendTest([ [ [ stringA, stringB ], stringA ], stringC ]);
+    runAppendTest([ [ stringA, stringB, stringA ], stringC, [ stringA, stringB, stringA ] ]);
+
+    debug('* BlobBuilder.append(string/blob) - with recycled blob');
+    var mixedArray = [ [ stringA, stringB, stringA ], stringC, [ stringA, stringB ] , stringA ];
+    var blob = { 'type':'blob', 'value':util.appendAndCreateBlob(mixedArray) };
+    var parameter = util.createUrlParameter([ mixedArray, stringC, mixedArray ]);
+    runAppendTest([ blob, stringC, blob ], null, parameter);
+
+    debug('* BlobBuilder.append(string) - with line-endings');
+    runAppendTest([ stringLF ]);
+    runAppendTest([ stringCR ]);
+    runAppendTest([ stringCRLF ]);
+
+    debug('* BlobBuilder.append(string, "native") - with line-endings');
+    runAppendTest([ stringLF ], 'native');
+    runAppendTest([ stringCR ], 'native');
+    runAppendTest([ stringCRLF ], 'native');
+    runAppendTest([ stringCRLF, stringLF, stringCRLF ], 'native');
+}
+
+if (window.eventSender)
+    util.runTests();
+else
+    testFailed("This test is not interactive, please run using DumpRenderTree");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/http/tests/local/blob/script-tests/send-hybrid-blob.js b/LayoutTests/http/tests/local/blob/script-tests/send-hybrid-blob.js
new file mode 100644 (file)
index 0000000..2163b51
--- /dev/null
@@ -0,0 +1,95 @@
+description("Test for building blobs with multiple files combined by BlobBuilder and sending them via XMLHttpRequest.  (This test requires eventSender.beginDragWithFiles)");
+
+var testFilePaths = [
+    "nonexistent",
+    "empty.txt",
+    "file-for-drag-to-send.txt",
+    "file-for-drag-to-send2.txt",
+    "abe.png"
+];
+
+var util = new HybridBlobTestUtil(runTests, testFilePaths);
+util.dragBaseDir = "../resources/";
+util.urlPathBaseDir = "../local/resources/";
+
+function runHybridBlobTest(fileIndexOrStrings, opt_range)
+{
+    var blob = util.appendAndCreateBlob(fileIndexOrStrings);
+    var urlParameter = util.createUrlParameter(fileIndexOrStrings, opt_range);
+    if (opt_range)
+        blob = blob.slice(opt_range.start, opt_range.length);
+    util.uploadBlob(blob, urlParameter);
+}
+
+function runTests()
+{
+    // Syntax sugar.
+    var F = function(path) { return util.FileItem(path); }
+    var D = function(data) { return util.DataItem(data); }
+
+    debug('* BlobBuilder.append(file) - single file');
+    for (var i = 0; i < testFilePaths.length; i++)
+        runHybridBlobTest(F(testFilePaths[i]));
+
+    debug('* BlobBuilder.append(file) - multiple files');
+    runHybridBlobTest([ F('nonexistent'),
+                        F('empty.txt')]);
+    runHybridBlobTest([ F('empty.txt'),
+                        F('file-for-drag-to-send.txt') ]);
+    runHybridBlobTest([ F('empty.txt'),
+                        F('file-for-drag-to-send.txt'),
+                        F('file-for-drag-to-send2.txt') ]);
+    runHybridBlobTest([ F('file-for-drag-to-send2.txt'),
+                        F('file-for-drag-to-send2.txt') ]);
+
+    debug('* BlobBuilder.append(mixed)');
+    runHybridBlobTest([ [ F('empty.txt') ] ]);
+    runHybridBlobTest([ [ F('empty.txt'),
+                          F('file-for-drag-to-send.txt') ],
+                        F('file-for-drag-to-send2.txt') ]);
+    runHybridBlobTest([ D('abcde'),
+                        F('file-for-drag-to-send2.txt'),
+                        D('|123|456|') ]);
+    runHybridBlobTest([ F('empty.txt'),
+                        D('13579'),
+                       [ F('file-for-drag-to-send2.txt'),
+                         F('file-for-drag-to-send.txt') ],
+                        F('file-for-drag-to-send.txt'),
+                        D('A_B_C_D_E')]);
+
+    debug('* BlobBuilder.append(mixed) - with Blob.slice()');
+    runHybridBlobTest([ F('file-for-drag-to-send.txt') ],
+                      { 'start': 5, 'length': 10 });
+    runHybridBlobTest([ [ F('file-for-drag-to-send2.txt') ] ],
+                      { 'start': 3, 'length': 17 });
+    runHybridBlobTest([ F('file-for-drag-to-send.txt'),
+                        F('file-for-drag-to-send2.txt') ],
+                      { 'start': 3, 'length': 17 });
+    runHybridBlobTest([ F('file-for-drag-to-send2.txt'),
+                        D('abcde'),
+                        F('file-for-drag-to-send2.txt') ],
+                      { 'start': 3, 'length': 17 });
+    runHybridBlobTest([ F('file-for-drag-to-send2.txt'),
+                        D('abcde'),
+                        F('file-for-drag-to-send2.txt') ],
+                      { 'start': 33, 'length': 90 });
+    runHybridBlobTest([ F('file-for-drag-to-send2.txt'),
+                        F('file-for-drag-to-send.txt'),
+                        F('file-for-drag-to-send2.txt') ],
+                      { 'start': 33, 'length': 42 });
+    runHybridBlobTest([ F('empty.txt'),
+                        F('file-for-drag-to-send.txt'),
+                        F('file-for-drag-to-send2.txt'),
+                        F('abe.png') ],
+                      { 'start': 20, 'length': 3000 });
+
+    layoutTestController.notifyDone();
+}
+
+if (window.eventSender) {
+    layoutTestController.waitUntilDone();
+    util.runTests();
+} else
+    testFailed("This test is not interactive, please run using DumpRenderTree");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/http/tests/local/blob/script-tests/send-sliced-data-blob.js b/LayoutTests/http/tests/local/blob/script-tests/send-sliced-data-blob.js
new file mode 100644 (file)
index 0000000..da2743e
--- /dev/null
@@ -0,0 +1,43 @@
+description("Test for slicing blobs created by BlobBuilder sending them via XMLHttpRequest.");
+
+var util = new HybridBlobTestUtil(runTests);
+
+function runSliceTest(appendItems, ranges)
+{
+    var blob = util.appendAndCreateBlob(appendItems);
+    var range = {'start':0, 'length':-1};
+    for (var i = 0; i < ranges.length; ++i) {
+        blob = blob.slice(ranges[i].start, ranges[i].length);
+        range.start += ranges[i].start;
+    }
+    range.length = ranges[ranges.length - 1].length;
+    var urlParameter = util.createUrlParameter(appendItems, range);
+    util.uploadBlob(blob, urlParameter);
+}
+
+function runTests()
+{
+    var stringA = util.DataItem('A1234567|');
+    var stringB = util.DataItem('B12345|');
+    var stringC = util.DataItem('C12345678901|');
+
+    var mixedArray = [ [ stringA, stringB, stringA ], stringC, [ stringA, stringB ] , stringA ];
+
+    debug('* BlobBuilder.append(data) and then apply Blob.slice()');
+    runSliceTest(stringA, [ {'start': 3,  'length': 12} ]);
+    runSliceTest([stringA, stringB], [ {'start': 3,  'length': 12} ]);
+    runSliceTest(mixedArray, [ {'start': 13, 'length': 40} ]);
+    runSliceTest(mixedArray, [ {'start': 13, 'length': 40} ]);
+    runSliceTest(mixedArray, [ {'start': 5,  'length': 32} ]);
+
+    debug('* BlobBuilder.append(data) and then apply nested Blob.slice()');
+    runSliceTest(mixedArray, [ {'start': 5,  'length': 32}, {'start': 2, 'length': 9} ]);
+    runSliceTest(mixedArray, [ {'start': 13, 'length': 40}, {'start': 5, 'length': 17} ]);
+}
+
+if (window.eventSender)
+    util.runTests();
+else
+    testFailed("This test is not interactive, please run using DumpRenderTree");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/http/tests/local/blob/send-data-blob-expected.txt b/LayoutTests/http/tests/local/blob/send-data-blob-expected.txt
new file mode 100644 (file)
index 0000000..0cb0785
--- /dev/null
@@ -0,0 +1,33 @@
+Test for building blobs with multiple strings combined by BlobBuilder and sending them via XMLHttpRequest.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* BlobBuilder.append(string)
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS 'type/foo' is 'type/foo'
+PASS Expected response data received: OK
+* BlobBuilder.append(blob)
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS 'type/bar' is 'type/bar'
+PASS Expected response data received: OK
+* BlobBuilder.append(string/blob)
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(string/blob) - with recycled blob
+PASS Expected response data received: OK
+* BlobBuilder.append(string) - with line-endings
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(string, "native") - with line-endings
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/local/blob/send-data-blob.html b/LayoutTests/http/tests/local/blob/send-data-blob.html
new file mode 100644 (file)
index 0000000..13b65b6
--- /dev/null
@@ -0,0 +1,14 @@
+<!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/hybrid-blob-util.js"></script>
+<script src="script-tests/send-data-blob.js"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/local/blob/send-hybrid-blob-expected.txt b/LayoutTests/http/tests/local/blob/send-hybrid-blob-expected.txt
new file mode 100644 (file)
index 0000000..15f816a
--- /dev/null
@@ -0,0 +1,34 @@
+
+Test for building blobs with multiple files combined by BlobBuilder and sending them via XMLHttpRequest. (This test requires eventSender.beginDragWithFiles)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* BlobBuilder.append(file) - single file
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(file) - multiple files
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(mixed)
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(mixed) - with Blob.slice()
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/local/blob/send-hybrid-blob.html b/LayoutTests/http/tests/local/blob/send-hybrid-blob.html
new file mode 100644 (file)
index 0000000..491cf4a
--- /dev/null
@@ -0,0 +1,14 @@
+<!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/hybrid-blob-util.js"></script>
+<script src="script-tests/send-hybrid-blob.js"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/local/blob/send-sliced-data-blob-expected.txt b/LayoutTests/http/tests/local/blob/send-sliced-data-blob-expected.txt
new file mode 100644 (file)
index 0000000..f274159
--- /dev/null
@@ -0,0 +1,18 @@
+Test for slicing blobs created by BlobBuilder sending them via XMLHttpRequest.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* BlobBuilder.append(data) and then apply Blob.slice()
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+* BlobBuilder.append(data) and then apply nested Blob.slice()
+PASS Expected response data received: OK
+PASS Expected response data received: OK
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/local/blob/send-sliced-data-blob.html b/LayoutTests/http/tests/local/blob/send-sliced-data-blob.html
new file mode 100644 (file)
index 0000000..c3805f2
--- /dev/null
@@ -0,0 +1,14 @@
+<!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/hybrid-blob-util.js"></script>
+<script src="script-tests/send-sliced-data-blob.js"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/local/resources/file-for-drag-to-send2.txt b/LayoutTests/http/tests/local/resources/file-for-drag-to-send2.txt
new file mode 100644 (file)
index 0000000..72d007b
--- /dev/null
@@ -0,0 +1 @@
+ABCDEFGHIJKLMNOPQRSTUVWXYZ
diff --git a/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi b/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi
new file mode 100755 (executable)
index 0000000..8fc9a27
--- /dev/null
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/plain\n\n";
+
+if ($ENV{'REQUEST_METHOD'} eq "POST") {
+    if ($ENV{'CONTENT_LENGTH'}) {
+        read(STDIN, $postData, $ENV{'CONTENT_LENGTH'}) || die "Could not get post data\n";
+    } else {
+        $postData = "";
+    }
+
+    @list = split(/&/, $ENV{'QUERY_STRING'});
+    @values;
+    $values{'start'} = 0;
+    $values{'length'} = -1;
+    $values{'convert_newlines'} = 0;
+    foreach $element (@list) {
+        ($key, $value) = split(/=/, $element);
+        $values{$key} = $value;
+    }
+
+    # 'items' parameter would look like:
+    #   <items> := <item>(','<item>)*
+    #    <item> := <file> | <data>
+    #    <file> := "file":<file-path>
+    #    <data> := "data":<data-string>
+    @items = split(/,/, $values{'items'});
+    $expectedData = "";
+    $readPos = $values{'start'};
+    $remainingLength = $values{'length'};
+    foreach $item (@items) {
+        my ($type, $data) = split(/:/, $item);
+        my $size;
+        if ($type eq "data") {
+            $data =~ s/%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
+            $size = length($data);
+            if ($readPos > 0) {
+                if ($readPos > $size) {
+                    $readPos -= $size;
+                    next;
+                }
+                $data = substr($data, $readPos);
+            }
+            $data = substr($data, 0, $remainingLength) if ($remainingLength > 0);
+        } else {
+            $path = $data;
+            open(FILE, $path) || next;
+            $size = -s $path;
+            if ($readPos > 0) {
+                if ($readPos > $size) {
+                    $readPos -= $size;
+                    next;
+                }
+                seek(FILE, $readPos, 0);
+            }
+            if ($remainingLength > 0) {
+                read(FILE, $data, $remainingLength);
+            } else {
+                local $/ = undef;
+                $data = <FILE>;
+            }
+            close(FILE);
+        }
+        $readPos -= $size;
+        $expectedData .= $data;
+        if ($remainingLength > 0) {
+            $remainingLength -= length($data);
+            last if $remainingLength <= 0;
+        }
+    }
+
+    if ($values{'convert_newlines'}) {
+        $nativeEnding = ($^O =~ /MSWin/) ? "\r\n" : "\n";
+        $postData =~ s/$nativeEnding/[NL]/g;
+    }
+
+    if ($postData eq $expectedData) {
+        print "OK";
+    } else {
+        print "FAILED";
+    }
+} else {
+    print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
+}
index e48081e..386405a 100644 (file)
@@ -11,6 +11,8 @@ PASS inner.BeforeLoadEvent.isInner is true
 PASS inner.BeforeLoadEvent.constructor.isInner is true
 PASS inner.Blob.isInner is true
 PASS inner.Blob.constructor.isInner is true
+PASS inner.BlobBuilder.isInner is true
+PASS inner.BlobBuilder.constructor.isInner is true
 PASS inner.CDATASection.isInner is true
 PASS inner.CDATASection.constructor.isInner is true
 PASS inner.CSSCharsetRule.isInner is true
index fe9022b..b5ed3e9 100644 (file)
@@ -3292,6 +3292,8 @@ 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/local/blob/send-hybrid-blob.html
+http/tests/local/blob/send-sliced-data-blob.html
 http/tests/local/formdata/send-form-data.html
 http/tests/local/formdata/send-form-data-with-sliced-file.html
 http/tests/local/formdata/upload-events.html
index 93caf86..a1457cf 100644 (file)
@@ -121,6 +121,10 @@ window.Audio.prototype.setAttribute [function]
 window.Audio.prototype.setAttributeNS [function]
 window.Audio.prototype.setAttributeNode [function]
 window.Audio.prototype.setAttributeNodeNS [function]
+window.BlobBuilder [object BlobBuilderConstructor]
+window.BlobBuilder.prototype [object BlobBuilderPrototype]
+window.BlobBuilder.prototype.append [function]
+window.BlobBuilder.prototype.getBlob [function]
 window.CDATASection [object CDATASectionConstructor]
 window.CDATASection.prototype [object CDATASectionPrototype]
 window.CDATASection.prototype.ATTRIBUTE_NODE [number]
index a95b307..c218017 100644 (file)
@@ -8,6 +8,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'Attr') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Audio') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'BeforeLoadEvent') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Blob') is 'object'
+PASS typeof Object.getOwnPropertyDescriptor(window, 'BlobBuilder') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Boolean') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CDATASection') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CSSCharsetRule') is 'object'
index 801018f..51d727a 100644 (file)
@@ -11,6 +11,8 @@ PASS inner.BeforeLoadEvent.isInner is true
 PASS inner.BeforeLoadEvent.constructor.isInner is true
 PASS inner.Blob.isInner is true
 PASS inner.Blob.constructor.isInner is true
+PASS inner.BlobBuilder.isInner is true
+PASS inner.BlobBuilder.constructor.isInner is true
 PASS inner.CDATASection.isInner is true
 PASS inner.CDATASection.constructor.isInner is true
 PASS inner.CSSCharsetRule.isInner is true
index ad6624e..abb6bc6 100644 (file)
@@ -215,6 +215,8 @@ http/tests/loading/text-content-type-with-binary-extension.html
 http/tests/local/drag-over-remote-content.html
 http/tests/local/send-dragged-file.html
 http/tests/local/send-sliced-dragged-file.html
+http/tests/local/blob/send-hybrid-blob.html
+http/tests/local/blob/send-sliced-data-blob.html
 http/tests/local/formdata/send-form-data.html
 http/tests/local/formdata/send-form-data-with-sliced-file.html
 http/tests/local/formdata/upload-events.html
index 9b8c6d7..bba1abb 100644 (file)
@@ -150,6 +150,10 @@ window.BeforeLoadEvent.prototype.stopImmediatePropagation [function]
 window.BeforeLoadEvent.prototype.stopPropagation [function]
 window.Blob [object BlobConstructor]
 window.Blob.prototype [object BlobPrototype]
+window.BlobBuilder [object BlobBuilderConstructor]
+window.BlobBuilder.prototype [object BlobBuilderPrototype]
+window.BlobBuilder.prototype.append [function]
+window.BlobBuilder.prototype.getBlob [function]
 window.CDATASection [object CDATASectionConstructor]
 window.CDATASection.prototype [object CDATASectionPrototype]
 window.CDATASection.prototype.ATTRIBUTE_NODE [number]
index 2bf9144..16b0382 100644 (file)
@@ -8,6 +8,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'Attr') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Audio') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'BeforeLoadEvent') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Blob') is 'object'
+PASS typeof Object.getOwnPropertyDescriptor(window, 'BlobBuilder') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Boolean') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CDATASection') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CSSCharsetRule') is 'object'
index 5721922..ce2f6b6 100644 (file)
@@ -11,6 +11,8 @@ PASS inner.BeforeLoadEvent.isInner is true
 PASS inner.BeforeLoadEvent.constructor.isInner is true
 PASS inner.Blob.isInner is true
 PASS inner.Blob.constructor.isInner is true
+PASS inner.BlobBuilder.isInner is true
+PASS inner.BlobBuilder.constructor.isInner is true
 PASS inner.CDATASection.isInner is true
 PASS inner.CDATASection.constructor.isInner is true
 PASS inner.CSSCharsetRule.isInner is true
index fa3fda4..f4722c6 100644 (file)
@@ -680,10 +680,14 @@ 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
+http/tests/local/blob/send-hybrid-blob.html
 http/tests/local/formdata/send-form-data.html
 http/tests/local/formdata/send-form-data-with-sliced-file.html
 http/tests/local/formdata/upload-events.html
 
+# Need Blob.slice support
+http/tests/local/blob/send-sliced-data-blob.html
+
 # <https://bugs.webkit.org/show_bug.cgi?id=29289>
 plugins/destroy-during-npp-new.html
 
index a95b307..c218017 100644 (file)
@@ -8,6 +8,7 @@ PASS typeof Object.getOwnPropertyDescriptor(window, 'Attr') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Audio') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'BeforeLoadEvent') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Blob') is 'object'
+PASS typeof Object.getOwnPropertyDescriptor(window, 'BlobBuilder') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'Boolean') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CDATASection') is 'object'
 PASS typeof Object.getOwnPropertyDescriptor(window, 'CSSCharsetRule') is 'object'
index cd7d6ec..db75c81 100644 (file)
@@ -209,6 +209,7 @@ PASS WebKitCSSKeyframesRuleConstructor from inner.document.getElementById("dummy
 PASS WebKitCSSKeyframesRulePrototype from inner.document.getElementById("dummyStyle").sheet.cssRules.6.__proto__
 Never found Audio
 Never found Blob
+Never found BlobBuilder
 Never found CDATASection
 Never found CSSRule
 Never found CSSVariablesDeclaration
index 801018f..51d727a 100644 (file)
@@ -11,6 +11,8 @@ PASS inner.BeforeLoadEvent.isInner is true
 PASS inner.BeforeLoadEvent.constructor.isInner is true
 PASS inner.Blob.isInner is true
 PASS inner.Blob.constructor.isInner is true
+PASS inner.BlobBuilder.isInner is true
+PASS inner.BlobBuilder.constructor.isInner is true
 PASS inner.CDATASection.isInner is true
 PASS inner.CDATASection.constructor.isInner is true
 PASS inner.CSSCharsetRule.isInner is true
index 5dcacc4..01b5c82 100644 (file)
@@ -155,6 +155,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/dom/%.cpp : $(intermediates)/dom/
 # HTML
 GEN := \
     $(intermediates)/html/JSBlob.h \
+    $(intermediates)/html/JSBlobBuilder.h \
     $(intermediates)/html/JSDOMFormData.h \
     $(intermediates)/html/JSDataGridColumn.h \
     $(intermediates)/html/JSDataGridColumnList.h \
index d269469..2552cd9 100644 (file)
@@ -138,6 +138,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)
 # HTML
 GEN := \
     $(intermediates)/bindings/V8Blob.h \
+    $(intermediates)/bindings/V8BlobBuilder.h \
     $(intermediates)/bindings/V8DataGridColumn.h \
     $(intermediates)/bindings/V8DataGridColumnList.h \
     $(intermediates)/bindings/V8File.h \
index 6b2553c..5f4fcb2 100644 (file)
@@ -182,6 +182,7 @@ SET(WebCore_IDL_FILES
     dom/WheelEvent.idl
 
     html/Blob.idl
+    html/BlobBuilder.idl
     html/DataGridColumn.idl
     html/DataGridColumnList.idl
     html/DOMFormData.idl
index ec20ed0..de18981 100644 (file)
@@ -1,3 +1,38 @@
+2010-06-22  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add BlobBuilder.idl to expose BlobBuilder interface
+        https://bugs.webkit.org/show_bug.cgi?id=40593
+
+        (Resubmitting with the correct file set.)
+
+        BlobBuilder is defined in FileAPI's FileWriter spec.
+        (http://dev.w3.org/2009/dap/file-system/file-writer.html)
+
+        Also removes the ENABLE_FILE_WRITER ifdef guard for BlobBuilder.
+
+        Tests: http/tests/local/blob/send-data-blob.html
+               http/tests/local/blob/send-hybrid-blob.html
+               http/tests/local/blob/send-sliced-data-blob.html
+
+        * Android.derived.jscbindings.mk:
+        * Android.derived.v8bindings.mk:
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/BlobBuilder.cpp:
+        (WebCore::BlobBuilder::append):
+        * html/BlobBuilder.h:
+        * html/BlobBuilder.idl: Added.
+        * page/DOMWindow.idl:
+
 2010-06-22  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed, build fix for r61648.
index 5020e13..904ea55 100644 (file)
@@ -30,6 +30,7 @@
 #include "JSBarInfo.cpp"
 #include "JSBeforeLoadEvent.cpp"
 #include "JSBlob.cpp"
+#include "JSBlobBuilder.cpp"
 #include "JSCanvasGradient.cpp"
 #include "JSCanvasPattern.cpp"
 #include "JSCanvasRenderingContext.cpp"
index 2b4207c..bf09a22 100644 (file)
@@ -54,6 +54,7 @@ DOM_CLASSES = \
     BarInfo \
     BeforeLoadEvent \
     Blob \
+    BlobBuilder \
     CDATASection \
     CSSCharsetRule \
     CSSFontFaceRule \
index ea6948c..3781927 100644 (file)
@@ -180,6 +180,7 @@ IDL_BINDINGS += \
        WebCore/dom/WebKitTransitionEvent.idl \
        WebCore/dom/WheelEvent.idl \
        WebCore/html/Blob.idl \
+       WebCore/html/BlobBuilder.idl \
        WebCore/html/canvas/ArrayBufferView.idl \
        WebCore/html/canvas/ArrayBuffer.idl \
        WebCore/html/canvas/Int8Array.idl \
index ba1099e..6e4a492 100644 (file)
@@ -83,6 +83,7 @@
             'dom/WebKitTransitionEvent.idl',
             'dom/WheelEvent.idl',
             'html/Blob.idl',
+            'html/BlobBuilder.idl',
             'html/canvas/WebGLActiveInfo.idl',
             'html/canvas/ArrayBufferView.idl',
             'html/canvas/ArrayBuffer.idl',
index bb0be6f..66e77ca 100644 (file)
@@ -320,6 +320,7 @@ IDL_BINDINGS += \
     dom/WebKitTransitionEvent.idl \
     dom/WheelEvent.idl \
     html/Blob.idl \
+    html/BlobBuilder.idl \
     html/canvas/ArrayBufferView.idl \
     html/canvas/ArrayBuffer.idl \
     html/canvas/Int8Array.idl \
index f9e9359..cff52b7 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBlobBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBlobBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCanvasGradient.cpp"\r
                                >\r
                                <FileConfiguration\r
index fc8a837..22221c3 100644 (file)
                8988E10F11A3508B00DB732E /* BlobItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8988E10D11A3508B00DB732E /* BlobItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
                89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */; };
                89BED5EC11BE11CE00448492 /* BlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BED5EA11BE11CE00448492 /* BlobBuilder.h */; };
+               89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89CD029111C85B870070B791 /* JSBlobBuilder.cpp */; };
+               89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89CD029211C85B870070B791 /* JSBlobBuilder.h */; };
                8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; };
                9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
                9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; };
                89BED5E911BE11CE00448492 /* BlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobBuilder.cpp; sourceTree = "<group>"; };
                89BED5EA11BE11CE00448492 /* BlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobBuilder.h; sourceTree = "<group>"; };
+               89CD027911C859A80070B791 /* BlobBuilder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BlobBuilder.idl; sourceTree = "<group>"; };
+               89CD029111C85B870070B791 /* JSBlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobBuilder.cpp; sourceTree = "<group>"; };
+               89CD029211C85B870070B791 /* JSBlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobBuilder.h; sourceTree = "<group>"; };
                8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; };
                8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; };
                9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
                                2EAFAF0D10E2AF2D007ED3D6 /* Blob.idl */,
                                89BED5E911BE11CE00448492 /* BlobBuilder.cpp */,
                                89BED5EA11BE11CE00448492 /* BlobBuilder.h */,
+                               89CD027911C859A80070B791 /* BlobBuilder.idl */,
                                93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */,
                                93C441EE0F813A1A00C1A634 /* CollectionCache.h */,
                                93C441FF0F813AE100C1A634 /* CollectionType.h */,
                                49EECF1A105072F300099FAB /* JSArrayBufferView.h */,
                                2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */,
                                2E2D99CC10E2BBDA00496337 /* JSBlob.h */,
+                               89CD029111C85B870070B791 /* JSBlobBuilder.cpp */,
+                               89CD029211C85B870070B791 /* JSBlobBuilder.h */,
                                65DF323309D1DE65000BE325 /* JSCanvasGradient.cpp */,
                                65DF323409D1DE65000BE325 /* JSCanvasGradient.h */,
                                65DF323509D1DE65000BE325 /* JSCanvasPattern.cpp */,
                                BC124F000C26447A009E2349 /* JSBarInfo.h in Headers */,
                                BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */,
                                2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */,
+                               89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */,
                                1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */,
                                65DF323A09D1DE65000BE325 /* JSCanvasGradient.h in Headers */,
                                65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */,
                                BC124EFF0C26447A009E2349 /* JSBarInfo.cpp in Sources */,
                                BC946346107A934B00857193 /* JSBeforeLoadEvent.cpp in Sources */,
                                2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */,
+                               89CD029311C85B870070B791 /* JSBlobBuilder.cpp in Sources */,
                                1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
                                65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
                                65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
index 0599f48..cda1568 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "config.h"
 
-#if ENABLE(FILE_WRITER)
-
 #include "BlobBuilder.h"
 
 #include "AtomicString.h"
@@ -57,7 +55,7 @@ static bool getLineEndingTypeFromString(const AtomicString& typeString, LineEndi
     return false;
 }
 
-bool BlobBuilder::appendString(const String& text, const String& type, ExceptionCode& ec)
+bool BlobBuilder::append(const String& text, const String& type, ExceptionCode& ec)
 {
     ec = 0;
     LineEnding endingType;
@@ -69,7 +67,12 @@ bool BlobBuilder::appendString(const String& text, const String& type, Exception
     return true;
 }
 
-bool BlobBuilder::appendBlob(PassRefPtr<Blob> blob)
+bool BlobBuilder::append(const String& text, ExceptionCode& ec)
+{
+    return append(text, String(), ec);
+}
+
+bool BlobBuilder::append(PassRefPtr<Blob> blob)
 {
     if (blob) {
         for (size_t i = 0; i < blob->items().size(); ++i)
@@ -85,5 +88,3 @@ PassRefPtr<Blob> BlobBuilder::getBlob(const String& contentType) const
 }
 
 } // namespace WebCore
-
-#endif // ENABLE(FILE_WRITER)
index 0d434a3..1173c04 100644 (file)
@@ -31,8 +31,6 @@
 #ifndef BlobBuilder_h
 #define BlobBuilder_h
 
-#if ENABLE(FILE_WRITER)
-
 #include "BlobItem.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -47,10 +45,11 @@ class BlobBuilder : public RefCounted<BlobBuilder> {
 public:
     static PassRefPtr<BlobBuilder> create() { return adoptRef(new BlobBuilder()); }
 
-    bool appendString(const String& text, const String& ending, ExceptionCode&);
-    bool appendBlob(PassRefPtr<Blob>);
+    bool append(PassRefPtr<Blob>);
+    bool append(const String& text, ExceptionCode&);
+    bool append(const String& text, const String& ending, ExceptionCode&);
 
-    PassRefPtr<Blob> getBlob(const String& contentType) const;
+    PassRefPtr<Blob> getBlob(const String& contentType = String()) const;
 
 private:
     BlobItemList m_items;
@@ -58,7 +57,4 @@ private:
 
 } // namespace WebCore
 
-
-#endif // ENABLE(FILE_WRITER)
-
 #endif // BlobBuilder_h
diff --git a/WebCore/html/BlobBuilder.idl b/WebCore/html/BlobBuilder.idl
new file mode 100644 (file)
index 0000000..93cb87f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module html {
+    interface [
+        CanBeConstructed,
+        GenerateNativeConverter,
+        NoStaticTables
+    ] BlobBuilder {
+        Blob getBlob(in [Optional, ConvertUndefinedOrNullToNullString] DOMString contentType);
+        void append(in Blob blob);
+        void append(in DOMString value, in [Optional, ConvertUndefinedOrNullToNullString] DOMString endings) raises (DOMException);
+    };
+
+}
+
index 1b19359..ce239d6 100644 (file)
@@ -740,6 +740,8 @@ module window {
         attribute [Conditional=FILE_READER|FILE_WRITER] FileErrorConstructor FileError;
         attribute [Conditional=FILE_READER] FileReaderConstructor FileReader;
 
+        attribute BlobBuilderConstructor BlobBuilder;
+
 #endif // defined(LANGUAGE_JAVASCRIPT)
 
 #if defined(V8_BINDING) && V8_BINDING