Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1346)

Unified Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 202423002: Fix SourceBuffer.timestampOffset setter behavior for invalid values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/mediasource/SourceBuffer.cpp
diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp
index c0d64a19a4fbc826d2c88a0836020271ba4cc64e..2730be3020d7163cb7ddba6e275189780b167965 100644
--- a/Source/modules/mediasource/SourceBuffer.cpp
+++ b/Source/modules/mediasource/SourceBuffer.cpp
@@ -175,6 +175,14 @@ double SourceBuffer::timestampOffset() const
void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionState)
{
+ // Enforce throwing an exception on restricted double values.
+ if (std::isnan(offset)
wolenetz 2014/03/17 20:11:39 nit: use !std::isfinite(offset)?
acolwell GONE FROM CHROMIUM 2014/03/17 20:28:27 Done.
+ || offset == std::numeric_limits<double>::infinity()
+ || offset == -std::numeric_limits<double>::infinity()) {
+ exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::notAFiniteNumber(offset));
+ return;
+ }
+
// Section 3.1 timestampOffset attribute setter steps.
// 1. Let new timestamp offset equal the new value being assigned to this attribute.
// 2. If this object has been removed from the sourceBuffers attribute of the parent media source, then throw an

Powered by Google App Engine
This is Rietveld 408576698