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 "StreamUtils.h"
8 #include "mozilla/dom/QueuingStrategyBinding.h"
10 namespace mozilla::dom
{
13 // https://streams.spec.whatwg.org/#validate-and-normalize-high-water-mark
14 double ExtractHighWaterMark(const QueuingStrategy
& aStrategy
,
15 double aDefaultHWM
, mozilla::ErrorResult
& aRv
) {
17 if (!aStrategy
.mHighWaterMark
.WasPassed()) {
22 double highWaterMark
= aStrategy
.mHighWaterMark
.Value();
25 if (std::isnan(highWaterMark
) || highWaterMark
< 0) {
26 aRv
.ThrowRangeError("Invalid highWaterMark");
34 } // namespace mozilla::dom