Changeset 183107 in webkit
- Timestamp:
- Apr 22, 2015 8:55:20 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183102 r183107 1 2015-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 1 19 2015-04-22 Marcos Chavarría Teijeiro <chavarria1991@gmail.com> 2 20 -
trunk/LayoutTests/streams/readable-stream-expected.txt
r182783 r183107 1 1 2 2 PASS 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))') 3 PASS ReadableStream start should be called with the proper parameters 5 4 PASS ReadableStream should be able to call start method within prototype chain of its source 5 PASS A readable stream controller methods should throw if its readablestream is collected 6 6 -
trunk/LayoutTests/streams/readable-stream.html
r182783 r183107 2 2 <script src='../resources/testharness.js'></script> 3 3 <script src='../resources/testharnessreport.js'></script> 4 <script src='../resources/gc.js'></script> 4 5 <script> 5 6 test(function() { … … 16 17 assert_equals(this, source, 'source is this during start'); 17 18 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' ]; 20 21 var proto = Object.getPrototypeOf(controller); 21 22 … … 23 24 'the controller should have the right methods'); 24 25 25 for (var m of unnamedMethods) {26 assert_equals(controller[m].name, '', 'method should have no name');27 }28 29 26 for (var m of methods) { 30 var methodProperties = [ ' arguments', 'caller', 'length', 'name', 'prototype' ];27 var methodProperties = [ 'length', 'name' ]; 31 28 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'); 33 30 assert_equals(propDesc.configurable, true, 'method should be configurable'); 34 31 assert_equals(propDesc.writable, true, 'method should be writable'); … … 38 35 39 36 assert_equals(controller.close.length, 0, 'close should have no parameters'); 40 assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters');41 37 assert_equals(controller.enqueue.length, 1, 'enqueue should have 1 parameter'); 42 38 assert_equals(controller.error.length, 1, 'error should have 1 parameter'); 39 //assert_equals(controller.constructor.length, 1, 'constructor should have 1 parameters'); 43 40 44 41 isStartCalled = true; … … 53 50 { 54 51 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;74 52 75 53 var SimpleStreamSource = function() { }; … … 80 58 assert_true(isStartCalled); 81 59 }, 'ReadableStream should be able to call start method within prototype chain of its source'); 60 61 t1 = async_test('A readable stream controller methods should throw if its readablestream is collected'); 62 t1.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 }); 82 77 </script> -
trunk/LayoutTests/streams/reference-implementation/bad-underlying-sources-expected.txt
r182625 r183107 18 18 FAIL Underlying source: strategy.size returning -Infinity assert_unreached: enqueue didn't throw Reached unreachable code 19 19 FAIL 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 20 TIMEOUT Underlying source: calling close twice on an empty stream should throw the second time Test timed out 21 FAIL Underlying source: calling close twice on a non-empty stream should throw the second time read is not implemented 26 22 FAIL Underlying source: calling close on an empty canceled stream should not throw cancel is not implemented 27 23 FAIL 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 24 TIMEOUT Underlying source: calling close after error should throw Test timed out 25 TIMEOUT Underlying source: calling error twice should throw the second time Test timed out 26 TIMEOUT Underlying source: calling error after close should throw Test timed out 37 27 -
trunk/LayoutTests/streams/reference-implementation/brand-checks-expected.txt
r182625 r183107 7 7 FAIL ReadableStreamReader.prototype.read enforces a brand check Can only call ReadableStreamReader.read on instances of ReadableStreamReader 8 8 PASS 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') 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 11 PASS ReadableStreamController.prototype.close enforces a brand check 12 PASS ReadableStreamController.prototype.enqueue enforces a brand check 13 PASS ReadableStreamController.prototype.error enforces a brand check 14 14 PASS ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure enforces a brand check 15 15 PASS ByteLengthQueuingStrategy.prototype.size should work generically on its this and its arguments -
trunk/LayoutTests/streams/reference-implementation/count-queuing-strategy-expected.txt
r182625 r183107 3 3 PASS Gives a RangeError when the number is negative 4 4 PASS 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) undefined6 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) undefined7 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) undefined5 FAIL Correctly governs the return value of a ReadableStream's enqueue function (HWM = 0) read is not implemented 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 true but got false 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 true but got false 8 8 -
trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt
r182942 r183107 15 15 FAIL 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 16 16 TIMEOUT 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) undefined17 FAIL ReadableStream: enqueue should throw when the stream is readable but draining assert_equals: the first enqueue should return true expected true but got false 18 18 FAIL 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 19 19 FAIL 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 20 20 FAIL 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) undefined22 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) undefined21 FAIL 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 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 true but got false 23 23 FAIL ReadableStream integration test: adapting a random push source read is not implemented 24 24 FAIL ReadableStream integration test: adapting a sync pull source read is not implemented -
trunk/Source/WebCore/CMakeLists.txt
r183012 r183107 276 276 277 277 Modules/streams/ReadableStream.idl 278 Modules/streams/ReadableStreamController.idl 278 279 Modules/streams/ReadableStreamReader.idl 279 280 … … 1156 1157 bindings/js/JSRTCStatsResponseCustom.cpp 1157 1158 bindings/js/JSReadableStreamCustom.cpp 1159 bindings/js/JSReadableStreamControllerCustom.cpp 1158 1160 bindings/js/JSReadableStreamReaderCustom.cpp 1159 1161 bindings/js/ReadableStreamJSSource.cpp -
trunk/Source/WebCore/ChangeLog
r183100 r183107 1 2015-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 1 32 2015-04-22 Manuel Rego Casasnovas <rego@igalia.com> 2 33 -
trunk/Source/WebCore/DerivedSources.cpp
r182748 r183107 306 306 #if ENABLE(STREAMS_API) 307 307 #include "JSReadableStream.cpp" 308 #include "JSReadableStreamController.cpp" 308 309 #include "JSReadableStreamReader.cpp" 309 310 #endif -
trunk/Source/WebCore/DerivedSources.make
r182748 r183107 170 170 $(WebCore)/Modules/speech/SpeechSynthesisVoice.idl \ 171 171 $(WebCore)/Modules/streams/ReadableStream.idl \ 172 $(WebCore)/Modules/streams/ReadableStreamController.idl \ 172 173 $(WebCore)/Modules/streams/ReadableStreamReader.idl \ 173 174 $(WebCore)/Modules/webaudio/AudioBuffer.idl \ -
trunk/Source/WebCore/Modules/streams/ReadableStreamController.h
r183105 r183107 1 1 /* 2 * Copyright (C) 2 O15 Canon Inc. 20153 * Copyright (C) 2015 Igalia S.L. 20152 * Copyright (C) 2015 Canon Inc. 3 * Copyright (C) 2015 Igalia S.L. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 28 28 */ 29 29 30 #ifndef ReadableStream JSSource_h31 #define ReadableStream JSSource_h30 #ifndef ReadableStreamController_h 31 #define ReadableStreamController_h 32 32 33 33 #if ENABLE(STREAMS_API) 34 34 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>42 35 #include <wtf/Ref.h> 36 #include <wtf/RefCounted.h> 43 37 44 38 namespace WebCore { 45 39 46 class JSReadableStream;40 class ReadableJSStream; 47 41 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. 45 class ReadableStreamController : public RefCounted<ReadableStreamController> { 49 46 public: 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() { } 52 53 53 void start(JSC::ExecState*, JSReadableStream*); 54 void resetStream() { m_stream = nullptr; } 55 ReadableJSStream* stream() { return m_stream; } 54 56 55 57 private: 56 ReadableStream JSSource(JSC::ExecState*);58 ReadableStreamController(ReadableJSStream& stream) { m_stream = &stream; } 57 59 58 // Object passed to constructor. 59 JSC::Strong<JSC::JSObject> m_source; 60 61 JSC::Strong<JSC::JSObject> m_controller; 60 ReadableJSStream* m_stream; 62 61 }; 63 62 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 } 71 64 72 class ReadableJSStreamReader: public ReadableStreamReader { 73 public: 74 static Ref<ReadableJSStreamReader> create(ReadableJSStream&); 75 private: 76 ReadableJSStreamReader(ReadableJSStream&); 77 }; 65 #endif 78 66 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 3947 3947 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> 3948 3948 </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> 3949 3963 <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.cpp"> 3950 3964 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> … … 17422 17436 </ClCompile> 17423 17437 <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"> 17424 17452 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 17425 17453 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> … … 18919 18947 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRangeException.h" /> 18920 18948 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStream.h" /> 18949 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.h" /> 18921 18950 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.h" /> 18922 18951 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSRect.h" /> … … 19440 19469 <ClInclude Include="..\Modules\plugins\PluginReplacement.h" /> 19441 19470 <ClInclude Include="..\Modules\streams\ReadableStream.h" /> 19471 <ClInclude Include="..\Modules\streams\ReadableStreamController.h" /> 19442 19472 <ClInclude Include="..\Modules\streams\ReadableStreamReader.h" /> 19443 19473 <ClInclude Include="..\Modules\streams\ReadableStreamSource.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r183009 r183107 4411 4411 <Filter>bindings\js</Filter> 4412 4412 </ClCompile> 4413 <ClCompile Include="..\bindings\js\JSReadableStreamControllerCustom.cpp"> 4414 <Filter>bindings\js</Filter> 4415 </ClCompile> 4413 4416 <ClCompile Include="..\bindings\js\JSReadableStreamReaderCustom.cpp"> 4414 4417 <Filter>bindings\js</Filter> … … 5691 5694 </ClCompile> 5692 5695 <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"> 5693 5699 <Filter>DerivedSources</Filter> 5694 5700 </ClCompile> … … 13626 13632 <Filter>DerivedSources</Filter> 13627 13633 </ClInclude> 13634 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamController.h"> 13635 <Filter>DerivedSources</Filter> 13636 </ClInclude> 13628 13637 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSReadableStreamReader.h"> 13629 13638 <Filter>DerivedSources</Filter> … … 15220 15229 </ClInclude> 15221 15230 <ClInclude Include="..\Modules\streams\ReadableStream.h"> 15231 <Filter>Modules\streams</Filter> 15232 </ClInclude> 15233 <ClInclude Include="..\Modules\streams\ReadableStreamController.h"> 15222 15234 <Filter>Modules\streams</Filter> 15223 15235 </ClInclude> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r183096 r183107 1443 1443 40ECAE8116B8B68A00C36103 /* JSDOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */; }; 1444 1444 410B7E721045FAB000D8224F /* JSMessageEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */; }; 1445 41189EF91AD8273700B90A0D /* JSReadableStreamControllerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41189EF81AD8233C00B90A0D /* JSReadableStreamControllerCustom.cpp */; }; 1445 1446 4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F19B1A08245E5A001E9ABC /* WebCore.framework */; }; 1446 1447 41230913138C42FF00BCCFCA /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; }; … … 2294 2295 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; }; 2295 2296 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 */; }; 2296 2299 6C568CB019DAFEA000430CA2 /* MaskImageOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C568CAE19DAFEA000430CA2 /* MaskImageOperation.cpp */; }; 2297 2300 6C568CB119DAFEA000430CA2 /* MaskImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C568CAF19DAFEA000430CA2 /* MaskImageOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8559 8562 40ECAE8016B8B68A00C36103 /* JSDOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMError.cpp; sourceTree = "<group>"; }; 8560 8563 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>"; }; 8561 8567 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; }; 8562 8568 4138D3331244054800323D33 /* EventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventContext.h; sourceTree = "<group>"; }; … … 9519 9525 65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; }; 9520 9526 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>"; }; 9521 9529 6C568CAE19DAFEA000430CA2 /* MaskImageOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MaskImageOperation.cpp; sourceTree = "<group>"; }; 9522 9530 6C568CAF19DAFEA000430CA2 /* MaskImageOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskImageOperation.h; sourceTree = "<group>"; }; … … 15880 15888 isa = PBXGroup; 15881 15889 children = ( 15890 41189EF61AD8232800B90A0D /* ReadableStreamController.h */, 15891 41189EF71AD8232800B90A0D /* ReadableStreamController.idl */, 15882 15892 41A023EB1A39DB7900F722CF /* ReadableStream.cpp */, 15883 15893 41A023EC1A39DB7900F722CF /* ReadableStream.h */, … … 15896 15906 7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */, 15897 15907 7C4C96D91AD4483500365A50 /* JSReadableStream.h */, 15908 6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */, 15909 6C4C96DB1AD4483500365A50 /* JSReadableStreamController.h */, 15898 15910 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */, 15899 15911 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */, … … 21121 21133 E1C36D320EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp */, 21122 21134 E1C36D330EB0A094007410BC /* JSWorkerGlobalScopeBase.h */, 21135 41189EF81AD8233C00B90A0D /* JSReadableStreamControllerCustom.cpp */, 21123 21136 4198BDEE1A81123600B22FB5 /* ReadableStreamJSSource.cpp */, 21124 21137 4198BDEF1A81123600B22FB5 /* ReadableStreamJSSource.h */, … … 24283 24296 85E7119F0AC5D5350053270F /* DOMHTMLBodyElementInternal.h in Headers */, 24284 24297 85183B420AA6926100F19FA3 /* DOMHTMLBRElement.h in Headers */, 24298 6C4C96DF1AD4483500365A50 /* JSReadableStreamController.h in Headers */, 24285 24299 7C4C96DF1AD4483500365A50 /* JSReadableStreamReader.h in Headers */, 24286 24300 85E711A00AC5D5350053270F /* DOMHTMLBRElementInternal.h in Headers */, … … 29348 29362 93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */, 29349 29363 FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */, 29364 41189EF91AD8273700B90A0D /* JSReadableStreamControllerCustom.cpp in Sources */, 29350 29365 46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */, 29351 29366 85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */, … … 29784 29799 26AA0F9E18D2A18B00419381 /* SelectorPseudoElementTypeMap.cpp in Sources */, 29785 29800 E45322AB140CE267005A0F92 /* SelectorQuery.cpp in Sources */, 29801 6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */, 29786 29802 7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */, 29787 29803 99CC0B5F18BE984A006CEBCC /* SerializationMethods.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r182180 r183107 113 113 #include "JSPopStateEventCustom.cpp" 114 114 #if ENABLE(STREAMS_API) 115 #include "JSReadableStreamControllerCustom.cpp" 115 116 #include "JSReadableStreamCustom.cpp" 116 117 #include "JSReadableStreamReaderCustom.cpp" -
trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.cpp
r182797 r183107 70 70 } 71 71 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 79 72 static inline JSValue callFunction(ExecState* exec, JSValue jsFunction, JSValue thisValue, const ArgList& arguments, JSValue* exception) 80 73 { … … 96 89 } 97 90 98 static EncodedJSValue JSC_HOST_CALL notImplementedFunction(ExecState*)91 ReadableStreamJSSource::~ReadableStreamJSSource() 99 92 { 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(); 117 95 } 118 96 … … 125 103 } 126 104 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 140 105 void ReadableStreamJSSource::start(JSC::ExecState* exec, JSReadableStream* readableStream) 141 106 { 142 107 JSLockHolder lock(exec); 143 108 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))); 145 111 146 112 JSValue startFunction = getPropertyFromObject(exec, m_source.get(), "start"); -
trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.h
r182591 r183107 33 33 #if ENABLE(STREAMS_API) 34 34 35 #include "JSReadableStreamController.h" 35 36 #include "ReadableStream.h" 36 37 #include "ReadableStreamReader.h" … … 49 50 public: 50 51 static Ref<ReadableStreamJSSource> create(JSC::ExecState*); 51 ~ReadableStreamJSSource() { }52 ~ReadableStreamJSSource(); 52 53 53 54 void start(JSC::ExecState*, JSReadableStream*); … … 59 60 JSC::Strong<JSC::JSObject> m_source; 60 61 61 JSC::Strong<JS C::JSObject> m_controller;62 JSC::Strong<JSReadableStreamController> m_controller; 62 63 }; 63 64
Note: See TracChangeset
for help on using the changeset viewer.