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

Unified Diff: Source/core/html/MediaController.cpp

Issue 217053009: Validate finiteness of HTMLMediaElement properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add more FIXMEs. 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
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/MediaController.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/MediaController.cpp
diff --git a/Source/core/html/MediaController.cpp b/Source/core/html/MediaController.cpp
index e887df31c4cd44f4394dc47658dcc31265ae5169..a47c02cb6c892a41ec5750f35078bc0b744d9910 100644
--- a/Source/core/html/MediaController.cpp
+++ b/Source/core/html/MediaController.cpp
@@ -160,6 +160,12 @@ double MediaController::currentTime() const
void MediaController::setCurrentTime(double time, ExceptionState& exceptionState)
{
+ // FIXME: generated bindings should check isfinite: http://crbug.com/354298
+ if (!std::isfinite(time)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(time));
+ return;
+ }
+
// When the user agent is to seek the media controller to a particular new playback position,
// it must follow these steps:
// If the new playback position is less than zero, then set it to zero.
@@ -218,8 +224,14 @@ void MediaController::pause()
reportControllerState();
}
-void MediaController::setDefaultPlaybackRate(double rate)
+void MediaController::setDefaultPlaybackRate(double rate, ExceptionState& exceptionState)
{
+ // FIXME: generated bindings should check isfinite: http://crbug.com/354298
+ if (!std::isfinite(rate)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate));
+ return;
+ }
+
if (m_defaultPlaybackRate == rate)
return;
@@ -236,8 +248,14 @@ double MediaController::playbackRate() const
return m_clock->playRate();
}
-void MediaController::setPlaybackRate(double rate)
+void MediaController::setPlaybackRate(double rate, ExceptionState& exceptionState)
{
+ // FIXME: generated bindings should check isfinite: http://crbug.com/354298
+ if (!std::isfinite(rate)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate));
+ return;
+ }
+
if (m_clock->playRate() == rate)
return;
@@ -254,6 +272,12 @@ void MediaController::setPlaybackRate(double rate)
void MediaController::setVolume(double level, ExceptionState& exceptionState)
{
+ // FIXME: generated bindings should check isfinite: http://crbug.com/354298
+ if (!std::isfinite(level)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(level));
+ return;
+ }
+
if (m_volume == level)
return;
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/MediaController.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698