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

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: Fix LayoutTests, nits. 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..9528749d2a541c70e56dc1f664fed97feb43d5a0 100644
--- a/Source/core/html/MediaController.cpp
+++ b/Source/core/html/MediaController.cpp
@@ -160,6 +160,11 @@ double MediaController::currentTime() const
void MediaController::setCurrentTime(double time, ExceptionState& exceptionState)
{
+ if (!std::isfinite(time)) {
acolwell GONE FROM CHROMIUM 2014/03/31 21:58:29 nit: You should probably add FIXME's to above this
+ 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 +223,13 @@ void MediaController::pause()
reportControllerState();
}
-void MediaController::setDefaultPlaybackRate(double rate)
+void MediaController::setDefaultPlaybackRate(double rate, ExceptionState& exceptionState)
{
+ if (!std::isfinite(rate)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate));
+ return;
+ }
+
if (m_defaultPlaybackRate == rate)
return;
@@ -236,8 +246,13 @@ double MediaController::playbackRate() const
return m_clock->playRate();
}
-void MediaController::setPlaybackRate(double rate)
+void MediaController::setPlaybackRate(double rate, ExceptionState& exceptionState)
{
+ if (!std::isfinite(rate)) {
+ exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(rate));
+ return;
+ }
+
if (m_clock->playRate() == rate)
return;
@@ -254,6 +269,11 @@ void MediaController::setPlaybackRate(double rate)
void MediaController::setVolume(double level, ExceptionState& exceptionState)
{
+ 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