Bug 1528868 [wpt PR 15437] - Fill testing holes for WritableStream, a=testonly
authorAdam Rice <ricea@chromium.org>
Wed, 06 Mar 2019 10:34:06 +0000
changeset 464599 fbdc04ae24b2
parent 464598 f877aa6c6bb3
child 464600 22cd2b24f924
push id35717
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:45:26 +0000
treeherdermozilla-central@e0861be8d6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1528868, 15437
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528868 [wpt PR 15437] - Fill testing holes for WritableStream, a=testonly Automatic update from web-platform-tests Fill testing holes for WritableStream * Verify that the ready promise is initialised on a writer created on a closed stream. * Add a brand check test for writer.releaseLock() * Test that writing to a released writer throws an exception -- wpt-commits: 697a11a5397c57634125e4e6c7315b9759063925 wpt-pr: 15437
testing/web-platform/tests/streams/writable-streams/brand-checks.any.js
testing/web-platform/tests/streams/writable-streams/close.any.js
testing/web-platform/tests/streams/writable-streams/write.any.js
--- a/testing/web-platform/tests/streams/writable-streams/brand-checks.any.js
+++ b/testing/web-platform/tests/streams/writable-streams/brand-checks.any.js
@@ -99,11 +99,16 @@ promise_test(t => {
 }, 'WritableStreamDefaultWriter.prototype.write enforces a brand check');
 
 promise_test(t => {
   return methodRejectsForAll(t, WriterProto, 'close',
                              [fakeWSDefaultWriter(), realWS(), realWSDefaultController(), undefined, null]);
 }, 'WritableStreamDefaultWriter.prototype.close enforces a brand check');
 
 test(() => {
+  methodThrowsForAll(WriterProto, 'releaseLock',
+                     [fakeWSDefaultWriter(), realWS(), realWSDefaultController(), undefined, null]);
+}, 'WritableStreamDefaultWriter.prototype.releaseLock enforces a brand check');
+
+test(() => {
   methodThrowsForAll(WritableStreamDefaultController.prototype, 'error',
                      [fakeWSDefaultController(), realWS(), realWSDefaultWriter(), undefined, null]);
 }, 'WritableStreamDefaultController.prototype.error enforces a brand check');
--- a/testing/web-platform/tests/streams/writable-streams/close.any.js
+++ b/testing/web-platform/tests/streams/writable-streams/close.any.js
@@ -394,8 +394,20 @@ promise_test(t => {
         writePromise,
         promise_rejects(t, error1, closePromise, 'close() should reject')
       ]).then(() => {
         assert_true(closeRejected);
       });
     });
   });
 }, 'close() should not reject until no sink methods are in flight');
+
+promise_test(() => {
+  const ws = new WritableStream();
+  const writer1 = ws.getWriter();
+  return writer1.close().then(() => {
+    writer1.releaseLock();
+    const writer2 = ws.getWriter();
+    const ready = writer2.ready;
+    assert_equals(ready.constructor, Promise);
+    return ready;
+  });
+}, 'ready promise should be initialised as fulfilled for a writer on a closed stream');
--- a/testing/web-platform/tests/streams/writable-streams/write.any.js
+++ b/testing/web-platform/tests/streams/writable-streams/write.any.js
@@ -270,8 +270,15 @@ promise_test(t => {
     }
   }, { highWaterMark: 0 });
   const writer = ws.getWriter();
   return Promise.all([
     promise_rejects(t, error1, writer.ready, 'ready should be rejected'),
     promise_rejects(t, error1, writer.write(), 'write() should be rejected')
   ]);
 }, 'write() on a stream with HWM 0 should not cause the ready Promise to resolve');
+
+promise_test(t => {
+  const ws = new WritableStream();
+  const writer = ws.getWriter();
+  writer.releaseLock();
+  return promise_rejects(t, new TypeError(), writer.write(), 'write should reject');
+}, 'writing to a released writer should reject the returned promise');