Title: [210862] trunk
- Revision
- 210862
- Author
- commit-qu...@webkit.org
- Date
- 2017-01-18 12:06:46 -0800 (Wed, 18 Jan 2017)
Log Message
[Streams API] ReadableStream generic reader constructor does not need to call ReadableStream getReader
https://bugs.webkit.org/show_bug.cgi?id=167137
Patch by Youenn Fablet <you...@apple.com> on 2017-01-18
Reviewed by Xabier Rodriguez-Calvar.
Source/WebCore:
Test: streams/shadowing-getReader.html
* bindings/js/JSReadableStreamPrivateConstructors.cpp:
(WebCore::constructJSReadableStreamDefaultReader): Using private constructor instead of getReader.
LayoutTests:
* streams/shadowing-getReader-expected.txt: Added.
* streams/shadowing-getReader.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (210861 => 210862)
--- trunk/LayoutTests/ChangeLog 2017-01-18 19:57:16 UTC (rev 210861)
+++ trunk/LayoutTests/ChangeLog 2017-01-18 20:06:46 UTC (rev 210862)
@@ -1,5 +1,15 @@
2017-01-18 Youenn Fablet <you...@apple.com>
+ [Streams API] ReadableStream generic reader constructor does not need to call ReadableStream getReader
+ https://bugs.webkit.org/show_bug.cgi?id=167137
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ * streams/shadowing-getReader-expected.txt: Added.
+ * streams/shadowing-getReader.html: Added.
+
+2017-01-18 Youenn Fablet <you...@apple.com>
+
Reject fetch promise in case of ReadableStream upload
https://bugs.webkit.org/show_bug.cgi?id=167145
Added: trunk/LayoutTests/streams/shadowing-getReader-expected.txt (0 => 210862)
--- trunk/LayoutTests/streams/shadowing-getReader-expected.txt (rev 0)
+++ trunk/LayoutTests/streams/shadowing-getReader-expected.txt 2017-01-18 20:06:46 UTC (rev 210862)
@@ -0,0 +1,10 @@
+This test should run without throwing an exception.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new readerConstructor(stream) instanceof readerConstructor is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/streams/shadowing-getReader.html (0 => 210862)
--- trunk/LayoutTests/streams/shadowing-getReader.html (rev 0)
+++ trunk/LayoutTests/streams/shadowing-getReader.html 2017-01-18 20:06:46 UTC (rev 210862)
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test should run without throwing an exception.");
+
+var readerConstructor = new ReadableStream().getReader().constructor;
+
+var stream = new ReadableStream();
+stream.getReader = "foo";
+
+shouldBeTrue("new readerConstructor(stream) instanceof readerConstructor");
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (210861 => 210862)
--- trunk/Source/WebCore/ChangeLog 2017-01-18 19:57:16 UTC (rev 210861)
+++ trunk/Source/WebCore/ChangeLog 2017-01-18 20:06:46 UTC (rev 210862)
@@ -1,5 +1,17 @@
2017-01-18 Youenn Fablet <you...@apple.com>
+ [Streams API] ReadableStream generic reader constructor does not need to call ReadableStream getReader
+ https://bugs.webkit.org/show_bug.cgi?id=167137
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Test: streams/shadowing-getReader.html
+
+ * bindings/js/JSReadableStreamPrivateConstructors.cpp:
+ (WebCore::constructJSReadableStreamDefaultReader): Using private constructor instead of getReader.
+
+2017-01-18 Youenn Fablet <you...@apple.com>
+
Reject fetch promise in case of ReadableStream upload
https://bugs.webkit.org/show_bug.cgi?id=167145
Modified: trunk/Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.cpp (210861 => 210862)
--- trunk/Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.cpp 2017-01-18 19:57:16 UTC (rev 210861)
+++ trunk/Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.cpp 2017-01-18 20:06:46 UTC (rev 210862)
@@ -30,7 +30,7 @@
#include "JSReadableStreamDefaultReader.h"
#include "ReadableByteStreamInternalsBuiltins.h"
#include "ReadableStreamInternalsBuiltins.h"
-#include <runtime/CallData.h>
+#include "WebCoreJSClientData.h"
using namespace JSC;
@@ -56,19 +56,17 @@
EncodedJSValue JSC_HOST_CALL constructJSReadableStreamDefaultReader(ExecState& exec)
{
- VM& vm = exec.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
+ JSVMClientData& clientData = *static_cast<JSVMClientData*>(exec.vm().clientData);
+ JSDOMGlobalObject& globalObject = *static_cast<JSDOMGlobalObject*>(exec.lexicalGlobalObject());
- JSReadableStream* stream = jsDynamicDowncast<JSReadableStream*>(exec.argument(0));
- if (!stream)
- return throwArgumentTypeError(exec, scope, 0, "stream", "ReadableStreamReader", nullptr, "ReadableStream");
+ JSC::JSObject* constructor = JSC::asObject(globalObject.get(&exec, clientData.builtinNames().ReadableStreamDefaultReaderPrivateName()));
+ ConstructData constructData;
+ ConstructType constructType = constructor->methodTable()->getConstructData(constructor, constructData);
+ ASSERT(constructType != ConstructType::None);
- JSValue jsFunction = stream->get(&exec, Identifier::fromString(&exec, "getReader"));
-
- CallData callData;
- CallType callType = getCallData(jsFunction, callData);
- MarkedArgumentBuffer noArguments;
- return JSValue::encode(call(&exec, jsFunction, callType, callData, stream, noArguments));
+ MarkedArgumentBuffer args;
+ args.append(exec.argument(0));
+ return JSValue::encode(JSC::construct(&exec, constructor, constructType, constructData, args));
}
// Private JS ReadableStreamDefaultReader and ReadableStreamDefaultController constructors.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes