Bug 1585805 [wpt PR 19478] - [encoding] Defer API reference, a=testonly
authorjugglinmike <mike@mikepennisi.com>
Mon, 07 Oct 2019 22:04:49 +0000
changeset 497541 e54fa578d6cdf58fb3b35ec52bc83d40699e72a2
parent 497540 55d59c7c78b1735bf927836d608f18fc624ceb4c
child 497542 c4418df2ebb61eb531963e353fa2c95b1ca43793
push id36692
push userdvarga@mozilla.com
push dateTue, 15 Oct 2019 10:58:25 +0000
treeherdermozilla-central@dcedbb1d3fd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1585805, 19478
milestone71.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 1585805 [wpt PR 19478] - [encoding] Defer API reference, a=testonly Automatic update from web-platform-tests [encoding] Defer API reference (#19478) This test references the API under test outside the context of a subtest. This produces an uncaught exception in non-conforming implementations. Currently, testharness.js interprets this result as a failing "single-page test," although it will soon be more accurately reported as a harness error [1]. Update the test to only reference the API from within the body of a subtest. [1] https://github.com/web-platform-tests/rfcs/blob/master/rfcs/single_test.md -- wpt-commits: 4048e00ff8a82125d05e267fbd4c1b317d135a6e wpt-pr: 19478
testing/web-platform/tests/encoding/streams/backpressure.any.js
--- a/testing/web-platform/tests/encoding/streams/backpressure.any.js
+++ b/testing/web-platform/tests/encoding/streams/backpressure.any.js
@@ -1,46 +1,46 @@
 // META: global=worker
 
 'use strict';
 
 const classes = [
   {
-    constructor: TextDecoderStream,
+    name: 'TextDecoderStream',
     input: new Uint8Array([65])
   },
   {
-    constructor: TextEncoderStream,
+    name: 'TextEncoderStream',
     input: 'A'
   }
 ];
 
 const microtasksRun = () => new Promise(resolve => step_timeout(resolve, 0));
 
 for (const streamClass of classes) {
   promise_test(async () => {
-    const stream = new streamClass.constructor();
+    const stream = new self[streamClass.name]();
     const writer = stream.writable.getWriter();
     const reader = stream.readable.getReader();
     const events = [];
     await microtasksRun();
     const writePromise = writer.write(streamClass.input);
     writePromise.then(() => events.push('write'));
     await microtasksRun();
     events.push('paused');
     await reader.read();
     events.push('read');
     await writePromise;
     assert_array_equals(events, ['paused', 'read', 'write'],
                         'write should happen after read');
   }, 'write() should not complete until read relieves backpressure for ' +
-     `${streamClass.constructor.name}`);
+     `${streamClass.name}`);
 
   promise_test(async () => {
-    const stream = new streamClass.constructor();
+    const stream = new self[streamClass.name]();
     const writer = stream.writable.getWriter();
     const reader = stream.readable.getReader();
     const events = [];
     await microtasksRun();
     const readPromise1 = reader.read();
     readPromise1.then(() => events.push('read1'));
     const writePromise1 = writer.write(streamClass.input);
     const writePromise2 = writer.write(streamClass.input);
@@ -51,10 +51,10 @@ for (const streamClass of classes) {
     const readPromise2 = reader.read();
     readPromise2.then(() => events.push('read2'));
     await Promise.all([writePromise1, writePromise2,
                        readPromise1, readPromise2]);
     assert_array_equals(events, ['read1', 'write1', 'paused', 'read2',
                                  'write2'],
                         'writes should not happen before read2');
   }, 'additional writes should wait for backpressure to be relieved for ' +
-     `class ${streamClass.constructor.name}`);
+     `class ${streamClass.name}`);
 }