Changeset 185039 in webkit


Ignore:
Timestamp:
May 31, 2015 4:29:24 AM (9 years ago)
Author:
youenn.fablet@crf.canon.fr
Message:

[Streams API] Implement ReadableStreamController constructor
https://bugs.webkit.org/show_bug.cgi?id=143752

Reviewed by Darin Adler.

Source/WebCore:

Covered by rebased test and expectation.

  • Modules/streams/ReadableStreamController.idl: Adding CustomConstructor.
  • bindings/js/JSReadableStreamControllerCustom.cpp:

(WebCore::constructJSReadableStreamController): Throws an exception whenever called.

LayoutTests:

  • streams/readable-stream.html: checking controller constructor.
  • streams/reference-implementation/brand-checks-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185038 r185039  
     12015-05-31  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Implement ReadableStreamController constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=143752
     5
     6        Reviewed by Darin Adler.
     7
     8        * streams/readable-stream.html: checking controller constructor.
     9        * streams/reference-implementation/brand-checks-expected.txt:
     10
    1112015-05-31  Jordan Harband  <ljharb@gmail.com>
    212
  • trunk/LayoutTests/streams/readable-stream.html

    r183803 r185039  
    1717
    1818            // FIXME: We should add constructor at some point.
    19             var methods = [ 'close', 'enqueue', 'error' ];
     19            var methods = [ 'close', 'constructor', 'enqueue', 'error' ];
    2020            var proto = Object.getPrototypeOf(controller);
    2121
     
    2323                        'the controller should have the right methods');
    2424
    25             for (var m of methods) {
     25            for (var m of [ 'close', 'enqueue', 'error' ]) {
    2626                var methodProperties = [ 'length', 'name' ];
    2727                var propDesc = Object.getOwnPropertyDescriptor(proto, m);
     
    3636            assert_equals(controller.enqueue.length, 1, 'enqueue should have 1 parameter');
    3737            assert_equals(controller.error.length, 1, 'error should have 1 parameter');
    38             //assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters');
     38
     39            var propDesc = Object.getOwnPropertyDescriptor(proto, 'constructor');
     40            assert_equals(propDesc.enumerable, false, 'constructor should not be enumerable');
     41            assert_equals(propDesc.configurable, true, 'constructor should be configurable');
     42            assert_equals(propDesc.writable, false, 'constructor should not be writable');
     43            assert_equals(typeof controller.constructor, 'object', 'constructor should be an object');
    3944
    4045            isStartCalled = true;
  • trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt

    r183107 r185039  
    77FAIL ReadableStreamReader.prototype.read enforces a brand check Can only call ReadableStreamReader.read on instances of ReadableStreamReader
    88PASS ReadableStreamReader.prototype.releaseLock enforces a brand check
    9 FAIL ReadableStreamController enforces a brand check on its argument assert_throws: Constructing a ReadableStreamController should throw function "function () { new ReadableStreamController(fakeReadableSt..." did not throw
    10 FAIL ReadableStreamController can't be given a fully-constructed ReadableStream assert_throws: Constructing a ReadableStreamController should throw function "function () { new ReadableStreamController(realReadableSt..." did not throw
     9PASS ReadableStreamController enforces a brand check on its argument
     10PASS ReadableStreamController can't be given a fully-constructed ReadableStream
    1111PASS ReadableStreamController.prototype.close enforces a brand check
    1212PASS ReadableStreamController.prototype.enqueue enforces a brand check
  • trunk/Source/WebCore/ChangeLog

    r185037 r185039  
     12015-05-31  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Implement ReadableStreamController constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=143752
     5
     6        Reviewed by Darin Adler.
     7
     8        Covered by rebased test and expectation.
     9
     10        * Modules/streams/ReadableStreamController.idl: Adding CustomConstructor.
     11        * bindings/js/JSReadableStreamControllerCustom.cpp:
     12        (WebCore::constructJSReadableStreamController): Throws an exception whenever called.
     13
    1142015-05-30  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Source/WebCore/Modules/streams/ReadableStreamController.idl

    r183107 r185039  
    3030[
    3131    Conditional=STREAMS_API,
     32    CustomConstructor,
    3233    ImplementationLacksVTable,
    3334    NoInterfaceObject
  • trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp

    r184585 r185039  
    6767}
    6868
     69EncodedJSValue JSC_HOST_CALL constructJSReadableStreamController(ExecState* exec)
     70{
     71    return throwVMError(exec, createTypeError(exec, ASCIILiteral("ReadableStreamController constructor should not be called directly")));
     72}
     73
    6974} // namespace WebCore
    7075
Note: See TracChangeset for help on using the changeset viewer.