Changeset 182140 in webkit
- Timestamp:
- Mar 30, 2015 8:23:24 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/streams/readablestream-constructor-expected.txt
r181736 r182140 3 3 PASS ReadableStream can be constructed with no arguments 4 4 PASS ReadableStream instances should have the correct list of properties 5 PASS ReadableStream can be constructed with an empty object as argument 5 6 -
trunk/LayoutTests/streams/readablestream-constructor.html
r181736 r182140 46 46 }, 'ReadableStream instances should have the correct list of properties'); 47 47 48 test(function() { 49 new ReadableStream({ }); 50 }, 'ReadableStream can be constructed with an empty object as argument'); 51 48 52 </script> -
trunk/Source/WebCore/ChangeLog
r182139 r182140 1 2015-03-25 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 [Streams API] Error storage should be moved from source to stream/reader 4 https://bugs.webkit.org/show_bug.cgi?id=143048 5 6 Reviewed by Benjamin Poulain. 7 8 This patch removes error storage from the source as it should be stored at the stream level as error access goes through the reader. 9 It removes abstract ReadableStreamSource::isErrored and the storage of JavaScript errors from ReadableStreamJSSource. 10 11 Existing tests cover most of the changes. 12 Added test case for creating readable stream from empty JS object. 13 14 * Modules/streams/ReadableStreamSource.h: Removing isErrored(). 15 * bindings/js/JSReadableStreamCustom.cpp: 16 (WebCore::constructJSReadableStream): Added JS stream constructor parameters checking. 17 * bindings/js/ReadableStreamJSSource.cpp: 18 (WebCore::ReadableStreamJSSource::ReadableStreamJSSource): Removed JS stream constructor parameters checking. 19 (WebCore::ReadableStreamJSSource::start): Changed prototype of start so that start can throw errors directly. 20 (WebCore::ReadableStreamJSSource::setInternalError): Deleted. 21 * bindings/js/ReadableStreamJSSource.h: Removed m_error, setInternalError and updated start declaration. 22 1 23 2015-03-30 Philippe Normand <pnormand@igalia.com> 2 24 -
trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h
r179687 r182140 56 56 return true; 57 57 } 58 59 virtual bool isErrored() { return false; }60 58 }; 61 59 -
trunk/Source/WebCore/bindings/js/JSReadableStreamCustom.cpp
r181736 r182140 69 69 EncodedJSValue JSC_HOST_CALL constructJSReadableStream(ExecState* exec) 70 70 { 71 if (exec->argumentCount() && !exec->argument(0).isObject()) 72 return throwVMError(exec, createTypeError(exec, ASCIILiteral("ReadableStream constructor should get an object as argument."))); 73 71 74 DOMConstructorObject* jsConstructor = jsCast<DOMConstructorObject*>(exec->callee()); 72 75 ASSERT(jsConstructor); 73 76 ScriptExecutionContext* scriptExecutionContext = jsConstructor->scriptExecutionContext(); 74 77 78 75 79 Ref<ReadableStreamJSSource> source = ReadableStreamJSSource::create(exec); 76 if (source->isErrored())77 return throwVMError(exec, source->error());78 79 80 RefPtr<ReadableStream> readableStream = ReadableStream::create(*scriptExecutionContext, Ref<ReadableStreamSource>(source.get())); 80 81 … … 83 84 JSReadableStream* jsReadableStream = JSReadableStream::create(JSReadableStream::createStructure(vm, globalObject, JSReadableStream::createPrototype(vm, globalObject)), jsCast<JSDOMGlobalObject*>(globalObject), readableStream.releaseNonNull()); 84 85 85 if (!source->start()) 86 return throwVMError(exec, source->error()); 86 source->start(exec); 87 87 88 88 return JSValue::encode(jsReadableStream); -
trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.cpp
r181814 r182140 35 35 #include "JSDOMPromise.h" 36 36 #include "JSReadableStream.h" 37 #include "NotImplemented.h" 37 38 #include <runtime/Error.h> 38 39 #include <runtime/JSCJSValueInlines.h> … … 69 70 ReadableStreamJSSource::ReadableStreamJSSource(JSC::ExecState* exec) 70 71 { 71 if (!exec->argumentCount()) 72 return; 73 74 if (!exec->argument(0).isObject()) { 75 setInternalError(exec, ASCIILiteral("ReadableStream constructor should get an object as argument.")); 76 return; 72 if (exec->argumentCount()) { 73 ASSERT(exec->argument(0).isObject()); 74 // FIXME: Implement parameters support; 77 75 } 78 79 // FIXME: Implement parameters support80 setInternalError(exec, ASCIILiteral("ReadableStream constructor does not support parameter yet."));81 76 } 82 77 83 void ReadableStreamJSSource::s etInternalError(JSC::ExecState* exec, const String& message)78 void ReadableStreamJSSource::start(JSC::ExecState*) 84 79 { 85 m_error.set(exec->vm(), createTypeError(exec, message));80 notImplemented(); 86 81 } 87 82 -
trunk/Source/WebCore/bindings/js/ReadableStreamJSSource.h
r181264 r182140 49 49 ~ReadableStreamJSSource() { } 50 50 51 JSC::JSValue error() { return m_error.get(); } 52 bool start() { return true; } 53 54 // ReadableStreamSource API. 55 virtual bool isErrored() { return !!m_error; } 51 void start(JSC::ExecState*); 56 52 57 53 private: 58 void setInternalError(JSC::ExecState*, const String&);59 60 54 ReadableStreamJSSource(JSC::ExecState*); 61 // m_error may be an error generated from ReadableStreamJSSource or from JS callbacks.62 JSC::Strong<JSC::Unknown> m_error;63 55 }; 64 56
Note: See TracChangeset
for help on using the changeset viewer.