Diff
Modified: trunk/Source/WebCore/ChangeLog (186230 => 186231)
--- trunk/Source/WebCore/ChangeLog 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/ChangeLog 2015-07-02 19:27:24 UTC (rev 186231)
@@ -1,3 +1,29 @@
+2015-07-02 Youenn Fablet <youenn.fab...@crf.canon.fr>
+
+ [Streams API] Remove ReadableStreamController.enqueue() custom binding
+ https://bugs.webkit.org/show_bug.cgi?id=146455
+
+ Reviewed by Darin Adler.
+
+ Made enqueue not custom. Updated error to use Default=Undefined in IDL.
+
+ No change in behavior.
+
+ * Modules/streams/ReadableStreamController.h:
+ (WebCore::ReadableStreamController::error): Removed unneeded variation of error.
+ (WebCore::ReadableStreamController::enqueue): Calling ReadableJSStream enqueue method.
+ * Modules/streams/ReadableStreamController.idl: Updated error with Default=Undefined and made enqueue not custom.
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::createDOMException): Adding support for RangeError exceptions.
+ * bindings/js/JSReadableStreamControllerCustom.cpp:
+ (WebCore::constructJSReadableStreamController): Deleted.
+ * bindings/js/ReadableJSStream.cpp:
+ (WebCore::ReadableJSStream::error): Updated to pass error value as parameter.
+ (WebCore::ReadableJSStream::enqueue): Added exception throwing through ExceptionCode.
+ (WebCore::ReadableJSStream::retrieveChunkSize): Ditto.
+ * bindings/js/ReadableJSStream.h:
+ * dom/ExceptionCode.h: Adding RangeError.
+
2015-07-02 Brady Eidson <beid...@apple.com>
[Content Extensions] Block synchronous XMLHTTPRequest.
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamController.h (186230 => 186231)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamController.h 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamController.h 2015-07-02 19:27:24 UTC (rev 186231)
@@ -48,9 +48,10 @@
ReadableJSStream& stream() { return m_stream; }
- void error(JSC::ExecState* state, ExceptionCode& ec) { m_stream.error(*state, ec); }
- void error(JSC::ExecState* state, JSC::JSValue, ExceptionCode& ec) { m_stream.error(*state, ec); }
+ void error(JSC::ExecState* state, JSC::JSValue value, ExceptionCode& ec) { m_stream.error(*state, value, ec); }
+ void enqueue(JSC::ExecState* state, JSC::JSValue value) { m_stream.enqueue(*state, value); }
+
void ref() { m_stream.ref(); }
void deref() { m_stream.deref(); }
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamController.idl (186230 => 186231)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamController.idl 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamController.idl 2015-07-02 19:27:24 UTC (rev 186231)
@@ -33,9 +33,9 @@
ImplementationLacksVTable,
NoInterfaceObject
] interface ReadableStreamController {
- [Custom, RaisesException] boolean enqueue(any chunk);
+ [CallWith=ScriptState] void enqueue([Default=Undefined] optional any chunk);
[RaisesException] void close();
- [CallWith=ScriptState, RaisesException] void error(optional any error);
+ [CallWith=ScriptState, RaisesException] void error([Default=Undefined] optional any error);
readonly attribute double desiredSize;
};
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (186230 => 186231)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2015-07-02 19:27:24 UTC (rev 186231)
@@ -224,7 +224,10 @@
// FIXME: Handle other WebIDL exception types.
if (ec == TypeError)
return createTypeError(exec);
+ if (ec == RangeError)
+ return createRangeError(exec, ASCIILiteral("Bad value"));
+
// FIXME: All callers to setDOMException need to pass in the right global object
// for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this:
// frames[0].document.createElement(null, null); // throws an exception which should have the subframes prototypes.
Modified: trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp (186230 => 186231)
--- trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp 2015-07-02 19:27:24 UTC (rev 186231)
@@ -40,17 +40,6 @@
namespace WebCore {
-JSValue JSReadableStreamController::enqueue(ExecState* exec)
-{
- ReadableJSStream& stream = impl().stream();
- if (stream.isErrored())
- return exec->vm().throwException(exec, stream.error());
- if (stream.isCloseRequested())
- return exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Calling enqueue on a stream which is closing")));
- stream.enqueue(*exec);
- return jsUndefined();
-}
-
EncodedJSValue JSC_HOST_CALL constructJSReadableStreamController(ExecState* exec)
{
return throwVMError(exec, createTypeError(exec, ASCIILiteral("ReadableStreamController constructor should not be called directly")));
Modified: trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp (186230 => 186231)
--- trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp 2015-07-02 19:27:24 UTC (rev 186231)
@@ -298,13 +298,13 @@
changeStateToClosed();
}
-void ReadableJSStream::error(JSC::ExecState& state, ExceptionCode& ec)
+void ReadableJSStream::error(JSC::ExecState& state, JSC::JSValue value, ExceptionCode& ec)
{
if (!isReadable()) {
ec = TypeError;
return;
}
- storeError(state, state.argument(0));
+ storeError(state, value);
}
void ReadableJSStream::storeException(JSC::ExecState& state)
@@ -338,24 +338,27 @@
return chunk.value.get();
}
-void ReadableJSStream::enqueue(ExecState& state)
+void ReadableJSStream::enqueue(JSC::ExecState& state, JSC::JSValue chunk)
{
- ASSERT(!isCloseRequested());
-
+ if (isErrored()) {
+ throwVMError(&state, error());
+ return;
+ }
+ if (isCloseRequested()) {
+ throwVMError(&state, createDOMException(&state, TypeError));
+ return;
+ }
if (!isReadable())
return;
- JSValue chunk = state.argument(0);
if (resolveReadCallback(chunk)) {
pull();
return;
}
double size = retrieveChunkSize(state, chunk);
- if (state.hadException()) {
- storeError(state, state.exception()->value());
+ if (state.hadException())
return;
- }
m_chunkQueue.append({ JSC::Strong<JSC::Unknown>(state.vm(), chunk), size });
m_totalQueueSize += size;
@@ -372,15 +375,20 @@
arguments.append(chunk);
JSValue sizeValue = callFunction(state, m_sizeFunction.get(), jsUndefined(), arguments);
- if (state.hadException())
+ if (state.hadException()) {
+ storeError(state, state.exception()->value());
return 0;
+ }
double size = sizeValue.toNumber(&state);
- if (state.hadException())
+ if (state.hadException()) {
+ storeError(state, state.exception()->value());
return 0;
+ }
if (!std::isfinite(size) || size < 0) {
- throwVMError(&state, createRangeError(&state, ASCIILiteral("Incorrect double value")));
+ storeError(state, createDOMException(&state, RangeError));
+ throwVMError(&state, error());
return 0;
}
Modified: trunk/Source/WebCore/bindings/js/ReadableJSStream.h (186230 => 186231)
--- trunk/Source/WebCore/bindings/js/ReadableJSStream.h 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/bindings/js/ReadableJSStream.h 2015-07-02 19:27:24 UTC (rev 186231)
@@ -62,8 +62,8 @@
void storeError(JSC::ExecState&, JSC::JSValue);
JSC::JSValue error() override { return m_error.get(); }
- void enqueue(JSC::ExecState&);
- void error(JSC::ExecState&, ExceptionCode&);
+ void enqueue(JSC::ExecState&, JSC::JSValue);
+ void error(JSC::ExecState&, JSC::JSValue, ExceptionCode&);
double desiredSize() const { return m_highWaterMark - m_totalQueueSize; }
Modified: trunk/Source/WebCore/dom/ExceptionCode.h (186230 => 186231)
--- trunk/Source/WebCore/dom/ExceptionCode.h 2015-07-02 18:44:30 UTC (rev 186230)
+++ trunk/Source/WebCore/dom/ExceptionCode.h 2015-07-02 19:27:24 UTC (rev 186231)
@@ -65,6 +65,7 @@
// WebIDL exception types, handled by the binding layer.
// FIXME: Add GeneralError, EvalError, etc. when implemented in the bindings.
TypeError = 105,
+ RangeError = 106,
};
} // namespace WebCore