Title: [185592] trunk
Revision
185592
Author
calva...@igalia.com
Date
2015-06-16 10:36:08 -0700 (Tue, 16 Jun 2015)

Log Message

[Streams API] Calling controller.error() should trigger storing an undefined error
https://bugs.webkit.org/show_bug.cgi?id=145976

Reviewed by Darin Adler.

Source/WebCore:

Covered by rebased test.

* bindings/js/JSReadableStreamControllerCustom.cpp:
(WebCore::JSReadableStreamController::error): Storing undefined if no error value passed.
* bindings/js/ReadableJSStream.cpp: Removed storeError(ExecState*).
(WebCore::ReadableJSStream::ReadableJSStream):

LayoutTests:

* streams/readable-stream-controller-error-expected.txt: Rebasing expectation as test is passing now.
* streams/readable-stream-reader-read-expected.txt:
* streams/readable-stream-reader-read.html: Adding test for promise rejection without any parameter.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185591 => 185592)


--- trunk/LayoutTests/ChangeLog	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/LayoutTests/ChangeLog	2015-06-16 17:36:08 UTC (rev 185592)
@@ -1,5 +1,16 @@
 2015-06-16  Youenn Fablet <youenn.fab...@crf.canon.fr> and Xabier Rodriguez Calvar  <calva...@igalia.com>
 
+        [Streams API] Calling controller.error() should trigger storing an undefined error
+        https://bugs.webkit.org/show_bug.cgi?id=145976
+
+        Reviewed by Darin Adler.
+
+        * streams/readable-stream-controller-error-expected.txt: Rebasing expectation as test is passing now.
+        * streams/readable-stream-reader-read-expected.txt:
+        * streams/readable-stream-reader-read.html: Adding test for promise rejection without any parameter.
+
+2015-06-16  Youenn Fablet <youenn.fab...@crf.canon.fr> and Xabier Rodriguez Calvar  <calva...@igalia.com>
+
         [Streams API] Sync tests with spec
         https://bugs.webkit.org/show_bug.cgi?id=145839
 

Modified: trunk/LayoutTests/streams/readable-stream-controller-error-expected.txt (185591 => 185592)


--- trunk/LayoutTests/streams/readable-stream-controller-error-expected.txt	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/LayoutTests/streams/readable-stream-controller-error-expected.txt	2015-06-16 17:36:08 UTC (rev 185592)
@@ -1,5 +1,5 @@
 
 PASS Erroring a ReadableStream should reject ReadableStreamReader close promise 
 PASS Erroring a ReadableStream should reject ReadableStreamReader close promise 
-FAIL Erroring a ReadableStream without any value assert_equals: expected (undefined) undefined but got (object) object "Error: Error function called."
+PASS Erroring a ReadableStream without any value 
 

Modified: trunk/LayoutTests/streams/readable-stream-reader-read-expected.txt (185591 => 185592)


--- trunk/LayoutTests/streams/readable-stream-reader-read-expected.txt	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/LayoutTests/streams/readable-stream-reader-read-expected.txt	2015-06-16 17:36:08 UTC (rev 185592)
@@ -4,4 +4,5 @@
 PASS Reading twice on an errored stream 
 PASS Reading twice on a stream that gets errored 
 PASS Reading within a read promise resolve callback on a stream that gets closed 
+PASS ReadableStream: if start rejects with no parameter, it should error the stream with an undefined error 
 

Modified: trunk/LayoutTests/streams/readable-stream-reader-read.html (185591 => 185592)


--- trunk/LayoutTests/streams/readable-stream-reader-read.html	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/LayoutTests/streams/readable-stream-reader-read.html	2015-06-16 17:36:08 UTC (rev 185592)
@@ -159,4 +159,19 @@
     }));
     controller.close();
 });
+
+var test6 = async_test('ReadableStream: if start rejects with no parameter, it should error the stream with an undefined error');
+test6.step(function() {
+    var rs = new ReadableStream({
+        start: function(c) {
+            return Promise.reject();
+        }
+    });
+
+    rs.getReader().read().catch(test6.step_func(function(e) {
+        assert_equals(typeof e, "undefined");
+        test6.done();
+    }));
+});
+
 </script>

Modified: trunk/Source/WebCore/ChangeLog (185591 => 185592)


--- trunk/Source/WebCore/ChangeLog	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/Source/WebCore/ChangeLog	2015-06-16 17:36:08 UTC (rev 185592)
@@ -1,3 +1,17 @@
+2015-06-16  Youenn Fablet <youenn.fab...@crf.canon.fr> and Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [Streams API] Calling controller.error() should trigger storing an undefined error
+        https://bugs.webkit.org/show_bug.cgi?id=145976
+
+        Reviewed by Darin Adler.
+
+        Covered by rebased test.
+
+        * bindings/js/JSReadableStreamControllerCustom.cpp:
+        (WebCore::JSReadableStreamController::error): Storing undefined if no error value passed.
+        * bindings/js/ReadableJSStream.cpp: Removed storeError(ExecState*).
+        (WebCore::ReadableJSStream::ReadableJSStream):
+
 2015-06-16  Chris Dumez  <cdu...@apple.com>
 
         Purge StyledElement's presentation attribute cache on memory pressure

Modified: trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp (185591 => 185592)


--- trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp	2015-06-16 17:36:08 UTC (rev 185592)
@@ -61,12 +61,12 @@
     return jsUndefined();
 }
 
-JSValue JSReadableStreamController::error(ExecState* exec)
+JSValue JSReadableStreamController::error(ExecState* state)
 {
     ReadableJSStream& stream = impl().stream();
     if (!stream.isReadable())
-        return exec->vm().throwException(exec, createTypeError(exec, ASCIILiteral("Calling error on a stream which is not readable")));
-    stream.storeError(*exec);
+        return state->vm().throwException(state, createTypeError(state, ASCIILiteral("Calling error on a stream which is not readable")));
+    stream.storeError(*state, state->argument(0));
     return jsUndefined();
 }
 

Modified: trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp (185591 => 185592)


--- trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/Source/WebCore/bindings/js/ReadableJSStream.cpp	2015-06-16 17:36:08 UTC (rev 185592)
@@ -176,7 +176,7 @@
     // We do not take a Ref to the stream as this would cause a Ref cycle.
     // The resolution callback used jointly with m_errorFunction as promise callbacks should protect the stream instead.
     m_errorFunction.set(state.vm(), JSFunction::create(state.vm(), state.callee()->globalObject(), 1, String(), [this](ExecState* state) {
-        storeError(*state);
+        storeError(*state, state->argument(0));
         return JSValue::encode(jsUndefined());
     }));
 }
@@ -195,11 +195,6 @@
     storeError(state, exception);
 }
 
-void ReadableJSStream::storeError(JSC::ExecState& exec)
-{
-    storeError(exec, exec.argumentCount() ? exec.argument(0) : createError(&exec, ASCIILiteral("Error function called.")));
-}
-
 void ReadableJSStream::storeError(JSC::ExecState& exec, JSValue error)
 {
     if (m_error)

Modified: trunk/Source/WebCore/bindings/js/ReadableJSStream.h (185591 => 185592)


--- trunk/Source/WebCore/bindings/js/ReadableJSStream.h	2015-06-16 15:45:57 UTC (rev 185591)
+++ trunk/Source/WebCore/bindings/js/ReadableJSStream.h	2015-06-16 17:36:08 UTC (rev 185592)
@@ -56,7 +56,7 @@
 
     JSC::JSValue jsController(JSC::ExecState&, JSDOMGlobalObject*);
 
-    void storeError(JSC::ExecState&);
+    void storeError(JSC::ExecState&, JSC::JSValue);
     JSC::JSValue error() override { return m_error.get(); }
 
     void enqueue(JSC::ExecState&);
@@ -68,7 +68,6 @@
 
     JSC::JSPromise* invoke(JSC::ExecState&, const char*);
     void storeException(JSC::ExecState&);
-    void storeError(JSC::ExecState&, JSC::JSValue);
 
     virtual bool hasValue() const override;
     virtual JSC::JSValue read() override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to