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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1858073002: Media: Report HTMLMediaElement player errors to devtools console Base URL: https://chromium.googlesource.com/chromium/src.git@fix_472253_1
Patch Set: Fixes comment typo Created 4 years, 8 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
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 06d4a93b6dfca9cb3d42b26427ecb7be2d3f6673..778b3ef0ec4d09c31d1d78688030380766f90efe 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -1316,6 +1316,20 @@ void HTMLMediaElement::waitForSourceChange()
layoutObject()->updateFromElement();
}
+void HTMLMediaElement::reportPlayerErrorToDevToolsConsole()
+{
+ WTF_LOG(Media, "HTMLMediaElement::reportPlayerErrorToDevToolsConsole(%p)", this);
+
+ if (!m_webMediaPlayer)
+ return;
+
+ const WebString& message = m_webMediaPlayer->getErrorMessage();
+ if (message.isEmpty())
+ return;
+
+ document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message));
pfeldman 2016/04/06 21:45:41 Looks more like OtherMessageSource to me.
+}
+
void HTMLMediaElement::noneSupported()
{
WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this);
@@ -1330,6 +1344,7 @@ void HTMLMediaElement::noneSupported()
// 1 - Set the error attribute to a new MediaError object whose code attribute is set to
// MEDIA_ERR_SRC_NOT_SUPPORTED.
m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
+ reportPlayerErrorToDevToolsConsole();
// 2 - Forget the media element's media-resource-specific text tracks.
forgetResourceSpecificTracks();
@@ -1367,6 +1382,7 @@ void HTMLMediaElement::mediaEngineError(MediaError* err)
// 2 - Set the error attribute to a new MediaError object whose code attribute is
// set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
m_error = err;
+ reportPlayerErrorToDevToolsConsole();
// 3 - Queue a task to fire a simple event named error at the media element.
scheduleEvent(EventTypeNames::error);

Powered by Google App Engine
This is Rietveld 408576698