Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265746 => 265747)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-17 07:26:46 UTC (rev 265747)
@@ -1,3 +1,15 @@
+2020-08-17 Youenn Fablet <[email protected]>
+
+ Check WritableStream underlyingSink methods
+ https://bugs.webkit.org/show_bug.cgi?id=215539
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/streams/writable-streams/bad-underlying-sinks.any-expected.txt:
+ * web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.js:
+ (test):
+ * web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.worker-expected.txt:
+
2020-08-15 Youenn Fablet <[email protected]>
WritableStream rejected promises should be marked as handled as per spec
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any-expected.txt (265746 => 265747)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any-expected.txt 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any-expected.txt 2020-08-17 07:26:46 UTC (rev 265747)
@@ -7,9 +7,10 @@
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
-FAIL abort: non-function abort method with .apply assert_throws_js: constructor should throw function "() => new WritableStream({
- abort: { apply() {} }
- })" did not throw
+PASS start: non-function start method
+PASS write: non-function write method
+PASS close: non-function close method
+PASS abort: non-function abort method with .apply
PASS abort: throwing getter should cause abort() and closed to reject
PASS abort: throwing method should cause abort() and closed to reject
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.js (265746 => 265747)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.js 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.js 2020-08-17 07:26:46 UTC (rev 265747)
@@ -159,6 +159,24 @@
test(() => {
assert_throws_js(TypeError, () => new WritableStream({
+ start: 'test'
+ }), 'constructor should throw');
+}, 'start: non-function start method');
+
+test(() => {
+ assert_throws_js(TypeError, () => new WritableStream({
+ write: 'test'
+ }), 'constructor should throw');
+}, 'write: non-function write method');
+
+test(() => {
+ assert_throws_js(TypeError, () => new WritableStream({
+ close: 'test'
+ }), 'constructor should throw');
+}, 'close: non-function close method');
+
+test(() => {
+ assert_throws_js(TypeError, () => new WritableStream({
abort: { apply() {} }
}), 'constructor should throw');
}, 'abort: non-function abort method with .apply');
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.worker-expected.txt (265746 => 265747)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.worker-expected.txt 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/writable-streams/bad-underlying-sinks.any.worker-expected.txt 2020-08-17 07:26:46 UTC (rev 265747)
@@ -7,9 +7,10 @@
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
-FAIL abort: non-function abort method with .apply assert_throws_js: constructor should throw function "() => new WritableStream({
- abort: { apply() {} }
- })" did not throw
+PASS start: non-function start method
+PASS write: non-function write method
+PASS close: non-function close method
+PASS abort: non-function abort method with .apply
PASS abort: throwing getter should cause abort() and closed to reject
PASS abort: throwing method should cause abort() and closed to reject
Modified: trunk/Source/WebCore/ChangeLog (265746 => 265747)
--- trunk/Source/WebCore/ChangeLog 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/Source/WebCore/ChangeLog 2020-08-17 07:26:46 UTC (rev 265747)
@@ -1,3 +1,15 @@
+2020-08-17 Youenn Fablet <[email protected]>
+
+ Check WritableStream underlyingSink methods
+ https://bugs.webkit.org/show_bug.cgi?id=215539
+
+ Reviewed by Darin Adler.
+
+ Covered by updated tests.
+
+ * Modules/streams/WritableStream.js:
+ (initializeWritableStream):
+
2020-08-16 Simon Fraser <[email protected]>
Fix some spelling and editorial issues
Modified: trunk/Source/WebCore/Modules/streams/WritableStream.js (265746 => 265747)
--- trunk/Source/WebCore/Modules/streams/WritableStream.js 2020-08-17 06:29:54 UTC (rev 265746)
+++ trunk/Source/WebCore/Modules/streams/WritableStream.js 2020-08-17 07:26:46 UTC (rev 265747)
@@ -40,6 +40,31 @@
if ("type" in underlyingSink)
@throwRangeError("Invalid type is specified");
+ const sizeAlgorithm = @extractSizeAlgorithm(strategy);
+ const highWaterMark = @extractHighWaterMark(strategy, 1);
+
+ const underlyingSinkDict = { };
+ if ("start" in underlyingSink) {
+ underlyingSinkDict["start"] = underlyingSink["start"];
+ if (typeof underlyingSinkDict["start"] !== "function")
+ @throwTypeError("underlyingSink.start should be a function");
+ }
+ if ("write" in underlyingSink) {
+ underlyingSinkDict["write"] = underlyingSink["write"];
+ if (typeof underlyingSinkDict["write"] !== "function")
+ @throwTypeError("underlyingSink.write should be a function");
+ }
+ if ("close" in underlyingSink) {
+ underlyingSinkDict["close"] = underlyingSink["close"];
+ if (typeof underlyingSinkDict["close"] !== "function")
+ @throwTypeError("underlyingSink.close should be a function");
+ }
+ if ("abort" in underlyingSink) {
+ underlyingSinkDict["abort"] = underlyingSink["abort"];
+ if (typeof underlyingSinkDict["abort"] !== "function")
+ @throwTypeError("underlyingSink.abort should be a function");
+ }
+
// Initialize Writable Stream
@putByIdDirectPrivate(this, "state", "writable");
@putByIdDirectPrivate(this, "storedError", @undefined);
@@ -53,11 +78,8 @@
@putByIdDirectPrivate(this, "backpressure", false);
@putByIdDirectPrivate(this, "underlyingSink", underlyingSink);
- const sizeAlgorithm = @extractSizeAlgorithm(strategy);
- const highWaterMark = @extractHighWaterMark(strategy, 1);
+ @setUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm)
- @setUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, underlyingSink, highWaterMark, sizeAlgorithm)
-
return this;
}