Changeset 119702 in webkit


Ignore:
Timestamp:
Jun 7, 2012 4:06:58 AM (12 years ago)
Author:
commit-queue@webkit.org
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 <li.yin@intel.com> 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:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r119701 r119702  
     12012-06-07  Li Yin  <li.yin@intel.com>
     2
     3        FileAPI: If type consists of non-ASCII characters in Blob constructor, it should throw a SyntaxError.
     4        https://bugs.webkit.org/show_bug.cgi?id=88411
     5
     6        Reviewed by Kentaro Hara.
     7
     8        From Spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
     9        If type consists of any non-ASCII characters, throw a SyntaxError and
     10        return from this algorithm.
     11
     12        * fast/files/blob-constructor-expected.txt:
     13        * fast/files/script-tests/blob-constructor.js:
     14
    1152012-06-07  Arpita Bahuguna  <arpitabahuguna@gmail.com>
    216
  • trunk/LayoutTests/fast/files/blob-constructor-expected.txt

    r115599 r119702  
    2929PASS new Blob([], {endings:throwingObj}) threw exception Error.
    3030PASS new Blob([], {type:throwingObj}) threw exception Error.
     31PASS new Blob([], {type:'helloî'}) threw exception SyntaxError: type must consist of ASCII characters.
    3132PASS new Blob([], {endings:throwingObj1, type:throwingObj2}) threw exception Error 1.
    3233PASS new Blob([], {type:throwingObj2, endings:throwingObj1}) threw exception Error 1.
  • trunk/LayoutTests/fast/files/script-tests/blob-constructor.js

    r115599 r119702  
    3939shouldThrow("new Blob([], {endings:throwingObj})", "'Error'");
    4040shouldThrow("new Blob([], {type:throwingObj})", "'Error'");
     41shouldThrow("new Blob([], {type:'hello\u00EE'})", "'SyntaxError: type must consist of ASCII characters'");
    4142
    4243// Test that order of property bag evaluation is lexigraphical
  • trunk/Source/WebCore/ChangeLog

    r119701 r119702  
     12012-06-07  Li Yin  <li.yin@intel.com>
     2
     3        FileAPI: If type consists of non-ASCII characters in Blob constructor, it should throw a SyntaxError.
     4        https://bugs.webkit.org/show_bug.cgi?id=88411
     5
     6        Reviewed by Kentaro Hara.
     7
     8        From spec: http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
     9        If type consists of any non-ASCII characters, throw a SyntaxError and
     10        return from this algorithm.
     11        This patch checks the String is ASCii or not, if not, throw SyntaxError.
     12
     13        Test: fast/files/blob-constructor.html
     14
     15        * bindings/js/JSBlobCustom.cpp:
     16        (WebCore::JSBlobConstructor::constructJSBlob):
     17        * bindings/v8/custom/V8BlobCustom.cpp:
     18        (WebCore::V8Blob::constructorCallback):
     19
    1202012-06-07  Arpita Bahuguna  <arpitabahuguna@gmail.com>
    221
  • trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp

    r115599 r119702  
    104104        if (exec->hadException())
    105105            return JSValue::encode(jsUndefined());
     106        if (!type.containsOnlyASCII())
     107            return throwVMError(exec, createSyntaxError(exec, "type must consist of ASCII characters"));
    106108    }
    107109
  • trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp

    r119479 r119702  
    103103        if (tryCatchType.HasCaught())
    104104            return throwError(tryCatchType.Exception(), args.GetIsolate());
     105        if (!type.containsOnlyASCII())
     106            return V8Proxy::throwError(V8Proxy::SyntaxError, "type must consist of ASCII characters", args.GetIsolate());
    105107    }
    106108
Note: See TracChangeset for help on using the changeset viewer.