- Revision
- 119702
- Author
- [email protected]
- Date
- 2012-06-07 04:06:58 -0700 (Thu, 07 Jun 2012)
Log Message
FileAPI: If type consists of non-ASCII characters in Blob constructor, it should throw a SyntaxError.
https://bugs.webkit.org/show_bug.cgi?id=88411
Patch by Li Yin <[email protected]> on 2012-06-07
Reviewed by Kentaro Hara.
Source/WebCore:
>From spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
If type consists of any non-ASCII characters, throw a SyntaxError and
return from this algorithm.
This patch checks the String is ASCii or not, if not, throw SyntaxError.
Test: fast/files/blob-constructor.html
* bindings/js/JSBlobCustom.cpp:
(WebCore::JSBlobConstructor::constructJSBlob):
* bindings/v8/custom/V8BlobCustom.cpp:
(WebCore::V8Blob::constructorCallback):
LayoutTests:
>From Spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
If type consists of any non-ASCII characters, throw a SyntaxError and
return from this algorithm.
* fast/files/blob-constructor-expected.txt:
* fast/files/script-tests/blob-constructor.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (119701 => 119702)
--- trunk/LayoutTests/ChangeLog 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/LayoutTests/ChangeLog 2012-06-07 11:06:58 UTC (rev 119702)
@@ -1,3 +1,17 @@
+2012-06-07 Li Yin <[email protected]>
+
+ FileAPI: If type consists of non-ASCII characters in Blob constructor, it should throw a SyntaxError.
+ https://bugs.webkit.org/show_bug.cgi?id=88411
+
+ Reviewed by Kentaro Hara.
+
+ From Spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
+ If type consists of any non-ASCII characters, throw a SyntaxError and
+ return from this algorithm.
+
+ * fast/files/blob-constructor-expected.txt:
+ * fast/files/script-tests/blob-constructor.js:
+
2012-06-07 Arpita Bahuguna <[email protected]>
InsertUnorderedList and InsertOrderedList (execCommand) do not remove bullets
Modified: trunk/LayoutTests/fast/files/blob-constructor-expected.txt (119701 => 119702)
--- trunk/LayoutTests/fast/files/blob-constructor-expected.txt 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/LayoutTests/fast/files/blob-constructor-expected.txt 2012-06-07 11:06:58 UTC (rev 119702)
@@ -28,6 +28,7 @@
PASS new Blob([], {endings:'illegalValue'}) threw exception TypeError: The endings property must be either "transparent" or "native".
PASS new Blob([], {endings:throwingObj}) threw exception Error.
PASS new Blob([], {type:throwingObj}) threw exception Error.
+PASS new Blob([], {type:'helloĆ®'}) threw exception SyntaxError: type must consist of ASCII characters.
PASS new Blob([], {endings:throwingObj1, type:throwingObj2}) threw exception Error 1.
PASS new Blob([], {type:throwingObj2, endings:throwingObj1}) threw exception Error 1.
PASS new Blob([], {type:throwingObj2, endings:'illegal'}) threw exception TypeError: The endings property must be either "transparent" or "native".
Modified: trunk/LayoutTests/fast/files/script-tests/blob-constructor.js (119701 => 119702)
--- trunk/LayoutTests/fast/files/script-tests/blob-constructor.js 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/LayoutTests/fast/files/script-tests/blob-constructor.js 2012-06-07 11:06:58 UTC (rev 119702)
@@ -38,6 +38,7 @@
shouldThrow("new Blob([], {endings:'illegalValue'})", "'TypeError: The endings property must be either \"transparent\" or \"native\"'");
shouldThrow("new Blob([], {endings:throwingObj})", "'Error'");
shouldThrow("new Blob([], {type:throwingObj})", "'Error'");
+shouldThrow("new Blob([], {type:'hello\u00EE'})", "'SyntaxError: type must consist of ASCII characters'");
// Test that order of property bag evaluation is lexigraphical
var throwingObj1 = { toString: function() { throw "Error 1"; } };
Modified: trunk/Source/WebCore/ChangeLog (119701 => 119702)
--- trunk/Source/WebCore/ChangeLog 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/Source/WebCore/ChangeLog 2012-06-07 11:06:58 UTC (rev 119702)
@@ -1,3 +1,22 @@
+2012-06-07 Li Yin <[email protected]>
+
+ FileAPI: If type consists of non-ASCII characters in Blob constructor, it should throw a SyntaxError.
+ https://bugs.webkit.org/show_bug.cgi?id=88411
+
+ Reviewed by Kentaro Hara.
+
+ From spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
+ If type consists of any non-ASCII characters, throw a SyntaxError and
+ return from this algorithm.
+ This patch checks the String is ASCii or not, if not, throw SyntaxError.
+
+ Test: fast/files/blob-constructor.html
+
+ * bindings/js/JSBlobCustom.cpp:
+ (WebCore::JSBlobConstructor::constructJSBlob):
+ * bindings/v8/custom/V8BlobCustom.cpp:
+ (WebCore::V8Blob::constructorCallback):
+
2012-06-07 Arpita Bahuguna <[email protected]>
InsertUnorderedList and InsertOrderedList (execCommand) do not remove bullets
Modified: trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp (119701 => 119702)
--- trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp 2012-06-07 11:06:58 UTC (rev 119702)
@@ -103,6 +103,8 @@
dictionary.get("type", type);
if (exec->hadException())
return JSValue::encode(jsUndefined());
+ if (!type.containsOnlyASCII())
+ return throwVMError(exec, createSyntaxError(exec, "type must consist of ASCII characters"));
}
ASSERT(endings == "transparent" || endings == "native");
Modified: trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp (119701 => 119702)
--- trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-06-07 10:36:38 UTC (rev 119701)
+++ trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-06-07 11:06:58 UTC (rev 119702)
@@ -102,6 +102,8 @@
dictionary.get("type", type);
if (tryCatchType.HasCaught())
return throwError(tryCatchType.Exception(), args.GetIsolate());
+ if (!type.containsOnlyASCII())
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "type must consist of ASCII characters", args.GetIsolate());
}
ASSERT(endings == "transparent" || endings == "native");