Changeset 183107 in webkit


Ignore:
Timestamp:
Apr 22, 2015 8:55:20 AM (9 years ago)
Author:
youenn.fablet@crf.canon.fr
Message:

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

Reviewed by Benjamin Poulain.

Source/WebCore:

Introducing ReadableStreamController, an abstraction to manage JS source stream queues.
This new interface is not exposed to JS scripts as specified, using NoInterfaceObject.

A controller is created at the time a ReadableJSStream is started and it is owned by it.
The controller may outlive the stream but as its reference will be reset, the calls to
its methods would result in exceptions.

The constructor is not implemented yet.

Change covered by existing tests and rebased expectations.

  • CMakeLists.txt:
  • DerivedSources.cpp:
  • DerivedSources.make: Added ReadableStreamController.idl related files.
  • Modules/streams/ReadableStreamController.h: Added.
  • Modules/streams/ReadableStreamController.idl: Added.
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.vcxproj/WebCore.vcxproj.filters:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSBindingsAllInOne.cpp: Added ReadableStreamController.idl related files.
  • bindings/js/JSReadableStreamControllerCustom.cpp: Added.
  • bindings/js/ReadableStreamJSSource.cpp:
  • bindings/js/ReadableStreamJSSource.h: Removed custom controller implementation.

LayoutTests:

Updated expectations as more tests are passed.
ReadableStreamController constructor tests fail due to the custom constructor being not implemented yet.
Added a test to ensure that calling a controller method when its stream is collected is throwing an error.

  • streams/readable-stream.html:
  • streams/readable-stream-expected.txt:
  • streams/reference-implementation/bad-underlying-sources-expected.txt:
  • streams/reference-implementation/brand-checks-expected.txt:
  • streams/reference-implementation/count-queuing-strategy-expected.txt:
  • streams/reference-implementation/readable-stream-expected.txt:
Location:
trunk
Files:
2 added
17 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r183102 r183107  
     12015-04-22  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Implement ReadableStreamController
     4        https://bugs.webkit.org/show_bug.cgi?id=143608
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Updated expectations as more tests are passed.
     9        ReadableStreamController constructor tests fail due to the custom constructor being not implemented yet.
     10        Added a test to ensure that calling a controller method when its stream is collected is throwing an error.
     11
     12        * streams/readable-stream.html:
     13        * streams/readable-stream-expected.txt:
     14        * streams/reference-implementation/bad-underlying-sources-expected.txt:
     15        * streams/reference-implementation/brand-checks-expected.txt:
     16        * streams/reference-implementation/count-queuing-strategy-expected.txt:
     17        * streams/reference-implementation/readable-stream-expected.txt:
     18
    1192015-04-22  Marcos Chavarría Teijeiro  <chavarria1991@gmail.com>
    220
  • trunk/LayoutTests/streams/readable-stream-expected.txt

    r182783 r183107  
    11
    22PASS ReadableStream can't be constructed with garbage
    3 FAIL ReadableStream start should be called with the proper parameters null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
    4 FAIL ReadableStream start controller parameter should be updatable null is not an object (evaluating 'Object.getOwnPropertyNames(Object.getPrototypeOf(controller))')
     3PASS ReadableStream start should be called with the proper parameters
    54PASS ReadableStream should be able to call start method within prototype chain of its source
     5PASS A readable stream controller methods should throw if its readablestream is collected
    66
  • trunk/LayoutTests/streams/readable-stream.html

    r182783 r183107  
    22<script src='../resources/testharness.js'></script>
    33<script src='../resources/testharnessreport.js'></script>
     4<script src='../resources/gc.js'></script>
    45<script>
    56test(function() {
     
    1617            assert_equals(this, source, 'source is this during start');
    1718
    18             var unnamedMethods = [ 'close', 'enqueue', 'error' ];
    19             var methods = unnamedMethods.concat(['constructor']).sort();
     19            // FIXME: We should add constructor at some point.
     20            var methods = [ 'close', 'enqueue', 'error' ];
    2021            var proto = Object.getPrototypeOf(controller);
    2122
     
    2324                        'the controller should have the right methods');
    2425
    25             for (var m of unnamedMethods) {
    26                 assert_equals(controller[m].name, '', 'method should have no name');
    27             }
    28 
    2926            for (var m of methods) {
    30                 var methodProperties = [ 'arguments', 'caller', 'length', 'name', 'prototype' ];
     27                var methodProperties = [ 'length', 'name' ];
    3128                var propDesc = Object.getOwnPropertyDescriptor(proto, m);
    32                 assert_equals(propDesc.enumerable, false, 'method should be non-enumerable');
     29                assert_equals(propDesc.enumerable, true, 'method should be enumerable');
    3330                assert_equals(propDesc.configurable, true, 'method should be configurable');
    3431                assert_equals(propDesc.writable, true, 'method should be writable');
     
    3835
    3936            assert_equals(controller.close.length, 0, 'close should have no parameters');
    40             assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters');
    4137            assert_equals(controller.enqueue.length, 1, 'enqueue should have 1 parameter');
    4238            assert_equals(controller.error.length, 1, 'error should have 1 parameter');
     39            //assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters');
    4340
    4441            isStartCalled = true;
     
    5350{
    5451    var isStartCalled = false;
    55     var source = {
    56         start: function(controller) {
    57       const methods = [ 'close', 'constructor', 'enqueue', 'error' ];
    58             assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), methods, 'prototype should have the right methods');
    59             controller.test = "";
    60             assert_array_equals(Object.getOwnPropertyNames(Object.getPrototypeOf(controller)).sort(), methods, 'prototype should still have the right methods');
    61             assert_not_equals(Object.getOwnPropertyNames(controller).indexOf('test'), '\'test\' is a property of the controller');
    62 
    63             isStartCalled = true;
    64         }
    65     };
    66 
    67     var rs = new ReadableStream(source);
    68     assert_true(isStartCalled);
    69 }, 'ReadableStream start controller parameter should be updatable');
    70 
    71 test(function()
    72 {
    73     var isStartCalled = false;
    7452
    7553    var SimpleStreamSource = function() { };
     
    8058    assert_true(isStartCalled);
    8159}, 'ReadableStream should be able to call start method within prototype chain of its source');
     60
     61t1 = async_test('A readable stream controller methods should throw if its readablestream is collected');
     62t1.step(function() {
     63    var controller;
     64    new ReadableStream({
     65        start: function(c) {
     66            controller = c;
     67        }
     68    });
     69    setTimeout(t1.step_func(function() {
     70        window.gc();
     71        assert_throws(new TypeError(), function() { controller.close(); });
     72        assert_throws(new TypeError(), function() { controller.error(); });
     73        assert_throws(new TypeError(), function() { controller.enqueue(); });
     74        t1.done();
     75    }), 10);
     76});
    8277</script>
  • trunk/LayoutTests/streams/reference-implementation/bad-underlying-sources-expected.txt

    r182625 r183107  
    1818FAIL Underlying source: strategy.size returning -Infinity assert_unreached: enqueue didn't throw Reached unreachable code
    1919FAIL Underlying source: strategy.size returning +Infinity assert_unreached: enqueue didn't throw Reached unreachable code
    20 FAIL Underlying source: calling close twice on an empty stream should throw the second time assert_throws: second call to close should throw a TypeError function "function () {
    21     [native code]
    22 }" did not throw
    23 FAIL Underlying source: calling close twice on a non-empty stream should throw the second time assert_throws: second call to close should throw a TypeError function "function () {
    24     [native code]
    25 }" did not throw
     20TIMEOUT Underlying source: calling close twice on an empty stream should throw the second time Test timed out
     21FAIL Underlying source: calling close twice on a non-empty stream should throw the second time read is not implemented
    2622FAIL Underlying source: calling close on an empty canceled stream should not throw cancel is not implemented
    2723FAIL Underlying source: calling close on a non-empty canceled stream should not throw cancel is not implemented
    28 FAIL Underlying source: calling close after error should throw assert_throws: call to close should throw a TypeError function "function () {
    29     [native code]
    30 }" did not throw
    31 FAIL Underlying source: calling error twice should throw the second time assert_throws: second call to error should throw a TypeError function "function () {
    32     [native code]
    33 }" did not throw
    34 FAIL Underlying source: calling error after close should throw assert_throws: call to error should throw a TypeError function "function () {
    35     [native code]
    36 }" did not throw
     24TIMEOUT Underlying source: calling close after error should throw Test timed out
     25TIMEOUT Underlying source: calling error twice should throw the second time Test timed out
     26TIMEOUT Underlying source: calling error after close should throw Test timed out
    3727
  • trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt

    r182625 r183107  
    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 PASS ReadableStreamController enforces a brand check on its argument
    10 PASS ReadableStreamController can't be given a fully-constructed ReadableStream
    11 FAIL ReadableStreamController.prototype.close enforces a brand check undefined is not an object (evaluating 'ReadableStreamController.prototype')
    12 FAIL ReadableStreamController.prototype.enqueue enforces a brand check undefined is not an object (evaluating 'ReadableStreamController.prototype')
    13 FAIL ReadableStreamController.prototype.error enforces a brand check undefined is not an object (evaluating 'ReadableStreamController.prototype')
     9FAIL ReadableStreamController enforces a brand check on its argument assert_throws: Constructing a ReadableStreamController should throw function "function () { new ReadableStreamController(fakeReadableSt..." did not throw
     10FAIL ReadableStreamController can't be given a fully-constructed ReadableStream assert_throws: Constructing a ReadableStreamController should throw function "function () { new ReadableStreamController(realReadableSt..." did not throw
     11PASS ReadableStreamController.prototype.close enforces a brand check
     12PASS ReadableStreamController.prototype.enqueue enforces a brand check
     13PASS ReadableStreamController.prototype.error enforces a brand check
    1414PASS ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure enforces a brand check
    1515PASS ByteLengthQueuingStrategy.prototype.size should work generically on its this and its arguments
  • trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt

    r182625 r183107  
    33PASS Gives a RangeError when the number is negative
    44PASS Can construct a readable stream with a valid CountQueuingStrategy
    5 FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 0) assert_equals: After 0 reads, 1st enqueue should return false (queue now contains 1 chunk) expected (boolean) false but got (undefined) undefined
    6 FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 1) assert_equals: After 0 reads, 1st enqueue should return true (queue now contains 1 chunk) expected (boolean) true but got (undefined) undefined
    7 FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 4) assert_equals: After 0 reads, 1st enqueue should return true (queue now contains 1 chunk) expected (boolean) true but got (undefined) undefined
     5FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 0) read is not implemented
     6FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 1) assert_equals: After 0 reads, 1st enqueue should return true (queue now contains 1 chunk) expected true but got false
     7FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 4) assert_equals: After 0 reads, 1st enqueue should return true (queue now contains 1 chunk) expected true but got false
    88
  • trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt

    r182942 r183107  
    1515FAIL ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows assert_equals: pull() should have been called four times expected 4 but got 0
    1616TIMEOUT ReadableStream pull should be able to close a stream. Test timed out
    17 FAIL ReadableStream: enqueue should throw when the stream is readable but draining assert_equals: the first enqueue should return true expected (boolean) true but got (undefined) undefined
     17FAIL ReadableStream: enqueue should throw when the stream is readable but draining assert_equals: the first enqueue should return true expected true but got false
    1818FAIL ReadableStream: enqueue should throw when the stream is closed assert_throws: enqueue after close should throw a TypeError function "function () { c.enqueue('a'); }" did not throw
    1919FAIL ReadableStream: enqueue should throw the stored error when the stream is errored assert_throws: enqueue after error should throw that error function "function () { c.enqueue('a'); }" did not throw
    2020FAIL ReadableStream: should call underlying source methods as methods read is not implemented
    21 FAIL ReadableStream strategies: the default strategy should return false for all but the first enqueue call assert_equals: first enqueue should return true expected (boolean) true but got (undefined) undefined
    22 FAIL ReadableStream strategies: the default strategy should continue returning true from enqueue if the chunks are read immediately assert_equals: first enqueue should return true expected (boolean) true but got (undefined) undefined
     21FAIL ReadableStream strategies: the default strategy should return false for all but the first enqueue call assert_equals: first enqueue should return true expected true but got false
     22FAIL ReadableStream strategies: the default strategy should continue returning true from enqueue if the chunks are read immediately assert_equals: first enqueue should return true expected true but got false
    2323FAIL ReadableStream integration test: adapting a random push source read is not implemented
    2424FAIL ReadableStream integration test: adapting a sync pull source read is not implemented
  • trunk/Source/WebCore/CMakeLists.txt

    r183012 r183107  
    276276
    277277    Modules/streams/ReadableStream.idl
     278    Modules/streams/ReadableStreamController.idl
    278279    Modules/streams/ReadableStreamReader.idl
    279280
     
    11561157    bindings/js/JSRTCStatsResponseCustom.cpp
    11571158    bindings/js/JSReadableStreamCustom.cpp
     1159    bindings/js/JSReadableStreamControllerCustom.cpp
    11581160    bindings/js/JSReadableStreamReaderCustom.cpp
    11591161    bindings/js/ReadableStreamJSSource.cpp
  • trunk/Source/WebCore/ChangeLog

    r183100 r183107  
     12015-04-22  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [Streams API] Implement ReadableStreamController
     4        https://bugs.webkit.org/show_bug.cgi?id=143608
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Introducing ReadableStreamController, an abstraction to manage JS source stream queues.
     9        This new interface is not exposed to JS scripts as specified, using NoInterfaceObject.
     10
     11        A controller is created at the time a ReadableJSStream is started and it is owned by it.
     12        The controller may outlive the stream but as its reference will be reset, the calls to
     13        its methods would result in exceptions.
     14
     15        The constructor is not implemented yet.
     16
     17        Change covered by existing tests and rebased expectations.
     18
     19        * CMakeLists.txt:
     20        * DerivedSources.cpp:
     21        * DerivedSources.make: Added ReadableStreamController.idl related files.
     22        * Modules/streams/ReadableStreamController.h: Added.
     23        * Modules/streams/ReadableStreamController.idl: Added.
     24        * WebCore.vcxproj/WebCore.vcxproj:
     25        * WebCore.vcxproj/WebCore.vcxproj.filters:
     26        * WebCore.xcodeproj/project.pbxproj:
     27        * bindings/js/JSBindingsAllInOne.cpp: Added ReadableStreamController.idl related files.
     28        * bindings/js/JSReadableStreamControllerCustom.cpp: Added.
     29        * bindings/js/ReadableStreamJSSource.cpp:
     30        * bindings/js/ReadableStreamJSSource.h: Removed custom controller implementation.
     31
    1322015-04-22  Manuel Rego Casasnovas  <rego@igalia.com>
    233
  • trunk/Source/WebCore/DerivedSources.cpp

    r182748 r183107  
    306306#if ENABLE(STREAMS_API)
    307307#include "JSReadableStream.cpp"
     308#include "JSReadableStreamController.cpp"
    308309#include "JSReadableStreamReader.cpp"
    309310#endif
  • trunk/Source/WebCore/DerivedSources.make

    r182748 r183107  
    170170    $(WebCore)/Modules/speech/SpeechSynthesisVoice.idl \
    171171    $(WebCore)/Modules/streams/ReadableStream.idl \
     172    $(WebCore)/Modules/streams/ReadableStreamController.idl \
    172173    $(WebCore)/Modules/streams/ReadableStreamReader.idl \
    173174    $(WebCore)/Modules/webaudio/AudioBuffer.idl \
  • trunk/Source/WebCore/Modules/streams/ReadableStreamController.h

    r183105 r183107  
    11/*
    2  * Copyright (C) 2O15 Canon Inc. 2015
    3  * Copyright (C) 2015 Igalia S.L. 2015
     2 * Copyright (C) 2015 Canon Inc.
     3 * Copyright (C) 2015 Igalia S.L.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    2828 */
    2929
    30 #ifndef ReadableStreamJSSource_h
    31 #define ReadableStreamJSSource_h
     30#ifndef ReadableStreamController_h
     31#define ReadableStreamController_h
    3232
    3333#if ENABLE(STREAMS_API)
    3434
    35 #include "ReadableStream.h"
    36 #include "ReadableStreamReader.h"
    37 #include "ReadableStreamSource.h"
    38 #include <heap/Strong.h>
    39 #include <heap/StrongInlines.h>
    40 #include <runtime/JSCJSValue.h>
    41 #include <runtime/PrivateName.h>
    4235#include <wtf/Ref.h>
     36#include <wtf/RefCounted.h>
    4337
    4438namespace WebCore {
    4539
    46 class JSReadableStream;
     40class ReadableJSStream;
    4741
    48 class ReadableStreamJSSource: public ReadableStreamSource {
     42// This class is only used for JS source readable streams to allow enqueuing, closing or erroring a readable stream.
     43// Its definition is at https://streams.spec.whatwg.org/#rs-controller-class.
     44// Note that its constructor is taking a ReadableJSStream as it should only be used for JS sources.
     45class ReadableStreamController : public RefCounted<ReadableStreamController> {
    4946public:
    50     static Ref<ReadableStreamJSSource> create(JSC::ExecState*);
    51     ~ReadableStreamJSSource() { }
     47    static Ref<ReadableStreamController> create(ReadableJSStream& stream)
     48    {
     49        auto controller = adoptRef(*new ReadableStreamController(stream));
     50        return controller;
     51    }
     52    ~ReadableStreamController() { }
    5253
    53     void start(JSC::ExecState*, JSReadableStream*);
     54    void resetStream() { m_stream = nullptr; }
     55    ReadableJSStream* stream() { return m_stream; }
    5456
    5557private:
    56     ReadableStreamJSSource(JSC::ExecState*);
     58    ReadableStreamController(ReadableJSStream& stream) { m_stream = &stream; }
    5759
    58     // Object passed to constructor.
    59     JSC::Strong<JSC::JSObject> m_source;
    60 
    61     JSC::Strong<JSC::JSObject> m_controller;
     60    ReadableJSStream* m_stream;
    6261};
    6362
    64 class ReadableJSStream: public ReadableStream {
    65 public:
    66     static Ref<ReadableJSStream> create(ScriptExecutionContext&, Ref<ReadableStreamJSSource>&&);
    67     virtual Ref<ReadableStreamReader> createReader() override;
    68 private:
    69     ReadableJSStream(ScriptExecutionContext&, Ref<ReadableStreamJSSource>&&);
    70 };
     63}
    7164
    72 class ReadableJSStreamReader: public ReadableStreamReader {
    73 public:
    74     static Ref<ReadableJSStreamReader> create(ReadableJSStream&);
    75 private:
    76     ReadableJSStreamReader(ReadableJSStream&);
    77 };
     65#endif
    7866
    79 void setInternalSlotToObject(JSC::ExecState*, JSC::JSValue, JSC::PrivateName&, JSC::JSValue);
    80 JSC::JSValue getInternalSlotFromObject(JSC::ExecState*, JSC::JSValue, JSC::PrivateName&);
    81 
    82 } // namespace WebCore
    83 
    84 #endif // ENABLE(STREAMS_API)
    85 
    86 #endif // ReadableStreamJSSource_h
     67#endif // ReadableStream_h
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r183009 r183107  
    39473947      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
    39483948    </ClCompile>
     3949    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.cpp">
     3950      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     3951      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     3952      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     3953      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     3954      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     3955      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     3956      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     3957      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     3958      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     3959      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     3960      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     3961      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     3962    </ClCompile>
    39493963    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.cpp">
    39503964      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     
    1742217436    </ClCompile>
    1742317437    <ClCompile Include="..\bindings\js\JSReadableStreamCustom.cpp">
     17438      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     17439      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     17440      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     17441      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     17442      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     17443      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     17444      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     17445      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     17446      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     17447      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     17448      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     17449      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     17450    </ClCompile>
     17451    <ClCompile Include="..\bindings\js\JSReadableStreamControllerCustom.cpp">
    1742417452      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    1742517453      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     
    1891918947    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRangeException.h" />
    1892018948    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStream.h" />
     18949    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.h" />
    1892118950    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.h" />
    1892218951    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRect.h" />
     
    1944019469    <ClInclude Include="..\Modules\plugins\PluginReplacement.h" />
    1944119470    <ClInclude Include="..\Modules\streams\ReadableStream.h" />
     19471    <ClInclude Include="..\Modules\streams\ReadableStreamController.h" />
    1944219472    <ClInclude Include="..\Modules\streams\ReadableStreamReader.h" />
    1944319473    <ClInclude Include="..\Modules\streams\ReadableStreamSource.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r183009 r183107  
    44114411      <Filter>bindings\js</Filter>
    44124412    </ClCompile>
     4413    <ClCompile Include="..\bindings\js\JSReadableStreamControllerCustom.cpp">
     4414      <Filter>bindings\js</Filter>
     4415    </ClCompile>
    44134416    <ClCompile Include="..\bindings\js\JSReadableStreamReaderCustom.cpp">
    44144417      <Filter>bindings\js</Filter>
     
    56915694    </ClCompile>
    56925695    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStream.cpp">
     5696      <Filter>DerivedSources</Filter>
     5697    </ClCompile>
     5698    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.cpp">
    56935699      <Filter>DerivedSources</Filter>
    56945700    </ClCompile>
     
    1362613632      <Filter>DerivedSources</Filter>
    1362713633    </ClInclude>
     13634    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.h">
     13635      <Filter>DerivedSources</Filter>
     13636    </ClInclude>
    1362813637    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.h">
    1362913638      <Filter>DerivedSources</Filter>
     
    1522015229    </ClInclude>
    1522115230    <ClInclude Include="..\Modules\streams\ReadableStream.h">
     15231      <Filter>Modules\streams</Filter>
     15232    </ClInclude>
     15233    <ClInclude Include="..\Modules\streams\ReadableStreamController.h">
    1522215234      <Filter>Modules\streams</Filter>
    1522315235    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r183096 r183107  
    14431443                40ECAE8116B8B68A00C36103 /* JSDOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */; };
    14441444                410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; };
     1445                41189EF91AD8273700B90A0D /* JSReadableStreamControllerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41189EF81AD8233C00B90A0D /* JSReadableStreamControllerCustom.cpp */; };
    14451446                4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F19B1A08245E5A001E9ABC /* WebCore.framework */; };
    14461447                41230913138C42FF00BCCFCA /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
     
    22942295                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
    22952296                6B3480940EEF50D400AC1B41 /* NativeImagePtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImagePtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2297                6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */; };
     2298                6C4C96DF1AD4483500365A50 /* JSReadableStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500365A50 /* JSReadableStreamController.h */; };
    22962299                6C568CB019DAFEA000430CA2 /* MaskImageOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C568CAE19DAFEA000430CA2 /* MaskImageOperation.cpp */; };
    22972300                6C568CB119DAFEA000430CA2 /* MaskImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C568CAF19DAFEA000430CA2 /* MaskImageOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    85598562                40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMError.cpp; sourceTree = "<group>"; };
    85608563                410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = "<group>"; };
     8564                41189EF61AD8232800B90A0D /* ReadableStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamController.h; sourceTree = "<group>"; };
     8565                41189EF71AD8232800B90A0D /* ReadableStreamController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadableStreamController.idl; sourceTree = "<group>"; };
     8566                41189EF81AD8233C00B90A0D /* JSReadableStreamControllerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamControllerCustom.cpp; sourceTree = "<group>"; };
    85618567                4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
    85628568                4138D3331244054800323D33 /* EventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventContext.h; sourceTree = "<group>"; };
     
    95199525                65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
    95209526                6B3480920EEF50D400AC1B41 /* NativeImagePtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NativeImagePtr.h; sourceTree = "<group>"; };
     9527                6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamController.cpp; sourceTree = "<group>"; };
     9528                6C4C96DB1AD4483500365A50 /* JSReadableStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStreamController.h; sourceTree = "<group>"; };
    95219529                6C568CAE19DAFEA000430CA2 /* MaskImageOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MaskImageOperation.cpp; sourceTree = "<group>"; };
    95229530                6C568CAF19DAFEA000430CA2 /* MaskImageOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskImageOperation.h; sourceTree = "<group>"; };
     
    1588015888                        isa = PBXGroup;
    1588115889                        children = (
     15890                                41189EF61AD8232800B90A0D /* ReadableStreamController.h */,
     15891                                41189EF71AD8232800B90A0D /* ReadableStreamController.idl */,
    1588215892                                41A023EB1A39DB7900F722CF /* ReadableStream.cpp */,
    1588315893                                41A023EC1A39DB7900F722CF /* ReadableStream.h */,
     
    1589615906                                7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */,
    1589715907                                7C4C96D91AD4483500365A50 /* JSReadableStream.h */,
     15908                                6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */,
     15909                                6C4C96DB1AD4483500365A50 /* JSReadableStreamController.h */,
    1589815910                                7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */,
    1589915911                                7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */,
     
    2112121133                                E1C36D320EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp */,
    2112221134                                E1C36D330EB0A094007410BC /* JSWorkerGlobalScopeBase.h */,
     21135                                41189EF81AD8233C00B90A0D /* JSReadableStreamControllerCustom.cpp */,
    2112321136                                4198BDEE1A81123600B22FB5 /* ReadableStreamJSSource.cpp */,
    2112421137                                4198BDEF1A81123600B22FB5 /* ReadableStreamJSSource.h */,
     
    2428324296                                85E7119F0AC5D5350053270F /* DOMHTMLBodyElementInternal.h in Headers */,
    2428424297                                85183B420AA6926100F19FA3 /* DOMHTMLBRElement.h in Headers */,
     24298                                6C4C96DF1AD4483500365A50 /* JSReadableStreamController.h in Headers */,
    2428524299                                7C4C96DF1AD4483500365A50 /* JSReadableStreamReader.h in Headers */,
    2428624300                                85E711A00AC5D5350053270F /* DOMHTMLBRElementInternal.h in Headers */,
     
    2934829362                                93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */,
    2934929363                                FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */,
     29364                                41189EF91AD8273700B90A0D /* JSReadableStreamControllerCustom.cpp in Sources */,
    2935029365                                46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */,
    2935129366                                85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */,
     
    2978429799                                26AA0F9E18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp in Sources */,
    2978529800                                E45322AB140CE267005A0F92 /* SelectorQuery.cpp in Sources */,
     29801                                6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */,
    2978629802                                7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */,
    2978729803                                99CC0B5F18BE984A006CEBCC /* SerializationMethods.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r182180 r183107  
    113113#include "JSPopStateEventCustom.cpp"
    114114#if ENABLE(STREAMS_API)
     115#include "JSReadableStreamControllerCustom.cpp"
    115116#include "JSReadableStreamCustom.cpp"
    116117#include "JSReadableStreamReaderCustom.cpp"
  • trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.cpp

    r182797 r183107  
    7070}
    7171
    72 static inline void setPropertyToObject(ExecState* exec, JSValue objectValue, const char* name, JSValue value)
    73 {
    74     JSObject* object = objectValue.toObject(exec);
    75     PutPropertySlot propertySlot(objectValue);
    76     object->put(object, exec, Identifier::fromString(exec, name), value, propertySlot);
    77 }
    78 
    7972static inline JSValue callFunction(ExecState* exec, JSValue jsFunction, JSValue thisValue, const ArgList& arguments, JSValue* exception)
    8073{
     
    9689}
    9790
    98 static EncodedJSValue JSC_HOST_CALL notImplementedFunction(ExecState*)
     91ReadableStreamJSSource::~ReadableStreamJSSource()
    9992{
    100     notImplemented();
    101     return JSValue::encode(jsUndefined());
    102 }
    103 
    104 static inline JSFunction* createReadableStreamEnqueueFunction(ExecState* exec)
    105 {
    106     return JSFunction::create(exec->vm(), exec->callee()->globalObject(), 1, String(), notImplementedFunction);
    107 }
    108 
    109 static inline JSFunction* createReadableStreamCloseFunction(ExecState* exec)
    110 {
    111     return JSFunction::create(exec->vm(), exec->callee()->globalObject(), 0, String(), notImplementedFunction);
    112 }
    113 
    114 static inline JSFunction* createReadableStreamErrorFunction(ExecState* exec)
    115 {
    116     return JSFunction::create(exec->vm(), exec->callee()->globalObject(), 1, String(), notImplementedFunction);
     93    if (m_controller)
     94        m_controller.get()->impl().resetStream();
    11795}
    11896
     
    125103}
    126104
    127 static inline JSObject* createReadableStreamController(JSC::ExecState* exec)
    128 {
    129     JSFunction* enqueueFunction = createReadableStreamEnqueueFunction(exec);
    130     JSFunction* closeFunction = createReadableStreamCloseFunction(exec);
    131     JSFunction* errorFunction = createReadableStreamErrorFunction(exec);
    132 
    133     JSObject* controller =  JSFinalObject::create(exec->vm(), JSFinalObject::createStructure(exec->vm(), exec->callee()->globalObject(), jsNull(), 3));
    134     setPropertyToObject(exec, controller, "enqueue", enqueueFunction);
    135     setPropertyToObject(exec, controller, "close", closeFunction);
    136     setPropertyToObject(exec, controller, "error", errorFunction);
    137     return controller;
    138 }
    139 
    140105void ReadableStreamJSSource::start(JSC::ExecState* exec, JSReadableStream* readableStream)
    141106{
    142107    JSLockHolder lock(exec);
    143108
    144     m_controller.set(exec->vm(), createReadableStreamController(exec));
     109    Ref<ReadableStreamController> controller = ReadableStreamController::create(static_cast<ReadableJSStream&>(readableStream->impl()));
     110    m_controller.set(exec->vm(), jsDynamicCast<JSReadableStreamController*>(toJS(exec, readableStream->globalObject(), controller)));
    145111
    146112    JSValue startFunction = getPropertyFromObject(exec, m_source.get(), "start");
  • trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.h

    r182591 r183107  
    3333#if ENABLE(STREAMS_API)
    3434
     35#include "JSReadableStreamController.h"
    3536#include "ReadableStream.h"
    3637#include "ReadableStreamReader.h"
     
    4950public:
    5051    static Ref<ReadableStreamJSSource> create(JSC::ExecState*);
    51     ~ReadableStreamJSSource() { }
     52    ~ReadableStreamJSSource();
    5253
    5354    void start(JSC::ExecState*, JSReadableStream*);
     
    5960    JSC::Strong<JSC::JSObject> m_source;
    6061
    61     JSC::Strong<JSC::JSObject> m_controller;
     62    JSC::Strong<JSReadableStreamController> m_controller;
    6263};
    6364
Note: See TracChangeset for help on using the changeset viewer.