Index: third_party/WebKit/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp |
diff --git a/third_party/WebKit/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp |
index ddcde17601ffe90911027ed7909630e6e3bda4cf..1266a558028d2efc5e5db2801701401186e58676 100644 |
--- a/third_party/WebKit/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp |
+++ b/third_party/WebKit/Source/modules/mediasession/HTMLMediaElementMediaSession.cpp |
@@ -5,6 +5,8 @@ |
#include "config.h" |
#include "modules/mediasession/HTMLMediaElementMediaSession.h" |
+#include "core/dom/ExceptionCode.h" |
+ |
namespace blink { |
MediaSession* HTMLMediaElementMediaSession::session(HTMLMediaElement& mediaElement) |
@@ -14,8 +16,14 @@ MediaSession* HTMLMediaElementMediaSession::session(HTMLMediaElement& mediaEleme |
return nullptr; |
} |
-void HTMLMediaElementMediaSession::setSession(HTMLMediaElement& mediaElement, MediaSession* session) |
+void HTMLMediaElementMediaSession::setSession(HTMLMediaElement& mediaElement, MediaSession* session, ExceptionState& exceptionState) |
{ |
+ HTMLMediaElement::NetworkState networkState = mediaElement.networkState(); |
+ if (networkState == HTMLMediaElement::NETWORK_IDLE || networkState == HTMLMediaElement::NETWORK_LOADING) { |
+ exceptionState.throwDOMException(InvalidStateError, "networkState must be NETWORK_EMPTY or NETWORK_NO_SOURCE."); |
+ return; |
+ } |
+ |
from(mediaElement).m_session = session; |
} |