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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return TimeRanges::create(m_webSourceBuffer->buffered()); 168 return TimeRanges::create(m_webSourceBuffer->buffered());
169 } 169 }
170 170
171 double SourceBuffer::timestampOffset() const 171 double SourceBuffer::timestampOffset() const
172 { 172 {
173 return m_timestampOffset; 173 return m_timestampOffset;
174 } 174 }
175 175
176 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionSt ate) 176 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionSt ate)
177 { 177 {
178 // Enforce throwing an exception on restricted double values.
179 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.
180 || offset == std::numeric_limits<double>::infinity()
181 || offset == -std::numeric_limits<double>::infinity()) {
182 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::n otAFiniteNumber(offset));
183 return;
184 }
185
178 // Section 3.1 timestampOffset attribute setter steps. 186 // Section 3.1 timestampOffset attribute setter steps.
179 // 1. Let new timestamp offset equal the new value being assigned to this at tribute. 187 // 1. Let new timestamp offset equal the new value being assigned to this at tribute.
180 // 2. If this object has been removed from the sourceBuffers attribute of th e parent media source, then throw an 188 // 2. If this object has been removed from the sourceBuffers attribute of th e parent media source, then throw an
181 // InvalidStateError exception and abort these steps. 189 // InvalidStateError exception and abort these steps.
182 // 3. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps. 190 // 3. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps.
183 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) 191 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e))
184 return; 192 return;
185 193
186 // 4. If the readyState attribute of the parent media source is in the "ende d" state then run the following steps: 194 // 4. If the readyState attribute of the parent media source is in the "ende d" state then run the following steps:
187 // 4.1 Set the readyState attribute of the parent media source to "open" 195 // 4.1 Set the readyState attribute of the parent media source to "open"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 appendStreamDone(false); 711 appendStreamDone(false);
704 } 712 }
705 713
706 void SourceBuffer::trace(Visitor* visitor) 714 void SourceBuffer::trace(Visitor* visitor)
707 { 715 {
708 visitor->trace(m_source); 716 visitor->trace(m_source);
709 visitor->trace(m_stream); 717 visitor->trace(m_stream);
710 } 718 }
711 719
712 } // namespace WebCore 720 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698