chromium/third_party/blink/web_tests/http/tests/streams/chromium/err-invalid-hwm.html

<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// These are a regression tests for
// https://bugs.chromium.org/p/chromium/issues/detail?id=719763. Checking the
// message text of exceptions is not normally good practice but here it is the
// only way to verify that the bug is fixed.

test(() => {
  try {
    new ReadableStream({}, {highWaterMark: NaN});
    assert_unreached('constructing with invalid highWaterMark should throw');
  } catch (e) {
    assert_equals(
        e.message,
        'Failed to construct \'ReadableStream\': ' +
        'A queuing strategy\'s highWaterMark property must be a nonnegative,' +
            ' non-NaN number',
        'message should be relevant');
  }
}, 'ReadableStream RangeError on invalid highWaterMark should have an ' +
    'appropriate message');

test(() => {
  try {
    new WritableStream({}, {highWaterMark: NaN});
    assert_unreached('constructing with invalid highWaterMark should throw');
  } catch (e) {
    assert_equals(
        e.message,
        'Failed to construct \'WritableStream\': ' +
        'A queuing strategy\'s highWaterMark property must be a nonnegative,' +
            ' non-NaN number',
        'message should be relevant');
  }
}, 'WritableStream RangeError on invalid highWaterMark should have an ' +
    'appropriate message');
</script>