1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "mozilla/dom/StreamUtils.h"
6 #include "mozilla/FloatingPoint.h"
7 #include "mozilla/dom/QueuingStrategyBinding.h"
9 namespace mozilla::dom
{
12 // https://streams.spec.whatwg.org/#validate-and-normalize-high-water-mark
13 double ExtractHighWaterMark(const QueuingStrategy
& aStrategy
,
14 double aDefaultHWM
, mozilla::ErrorResult
& aRv
) {
16 if (!aStrategy
.mHighWaterMark
.WasPassed()) {
21 double highWaterMark
= aStrategy
.mHighWaterMark
.Value();
24 if (mozilla::IsNaN(highWaterMark
) || highWaterMark
< 0) {
25 aRv
.ThrowRangeError("Invalid highWaterMark");
33 } // namespace mozilla::dom