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

Side by Side Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 212953004: Have SourceBuffer throw TypeError for non-finite doubles. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 178 // Enforce throwing an exception on restricted double values.
179 if (!std::isfinite(offset)) { 179 if (!std::isfinite(offset)) {
180 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::n otAFiniteNumber(offset)); 180 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(offset ));
181 return; 181 return;
182 } 182 }
183 183
184 // Section 3.1 timestampOffset attribute setter steps. 184 // Section 3.1 timestampOffset attribute setter steps.
185 // 1. Let new timestamp offset equal the new value being assigned to this at tribute. 185 // 1. Let new timestamp offset equal the new value being assigned to this at tribute.
186 // 2. If this object has been removed from the sourceBuffers attribute of th e parent media source, then throw an 186 // 2. If this object has been removed from the sourceBuffers attribute of th e parent media source, then throw an
187 // InvalidStateError exception and abort these steps. 187 // InvalidStateError exception and abort these steps.
188 // 3. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps. 188 // 3. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps.
189 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) 189 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e))
190 return; 190 return;
(...skipping 15 matching lines...) Expand all
206 } 206 }
207 207
208 double SourceBuffer::appendWindowStart() const 208 double SourceBuffer::appendWindowStart() const
209 { 209 {
210 return m_appendWindowStart; 210 return m_appendWindowStart;
211 } 211 }
212 212
213 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& exceptionS tate) 213 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& exceptionS tate)
214 { 214 {
215 // Enforce throwing an exception on restricted double values. 215 // Enforce throwing an exception on restricted double values.
216 if (std::isnan(start) 216 if (!std::isfinite(start)) {
217 || start == std::numeric_limits<double>::infinity() 217 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(start) );
218 || start == -std::numeric_limits<double>::infinity()) {
219 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::n otAFiniteNumber(start));
220 return; 218 return;
221 } 219 }
222 220
223 // Section 3.1 appendWindowStart attribute setter steps. 221 // Section 3.1 appendWindowStart attribute setter steps.
224 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an 222 // 1. If this object has been removed from the sourceBuffers attribute of th e parent media source then throw an
225 // InvalidStateError exception and abort these steps. 223 // InvalidStateError exception and abort these steps.
226 // 2. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps. 224 // 2. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps.
227 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) 225 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e))
228 return; 226 return;
229 227
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 appendStreamDone(false); 707 appendStreamDone(false);
710 } 708 }
711 709
712 void SourceBuffer::trace(Visitor* visitor) 710 void SourceBuffer::trace(Visitor* visitor)
713 { 711 {
714 visitor->trace(m_source); 712 visitor->trace(m_source);
715 visitor->trace(m_stream); 713 visitor->trace(m_stream);
716 } 714 }
717 715
718 } // namespace WebCore 716 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698