Bug 1528868 [wpt PR 15437] - Fill testing holes for WritableStream, a=testonly
☠☠ backed out by 66b1aba3fb43 ☠ ☠
authorAdam Rice <ricea@chromium.org>
Wed, 06 Mar 2019 10:34:06 +0000
changeset 464265 577ea54d1b0c56ed6da7d9bd2831f1791a8f2b7d
parent 464264 b3bae9f26b98b9d287175acc59541ef91af4718b
child 464266 f7d636225ed1b5769a64878c13f5b253161dff19
push id35713
push usercbrindusan@mozilla.com
push dateFri, 15 Mar 2019 21:55:43 +0000
treeherdermozilla-central@66b1aba3fb43 [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');