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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1309
1310 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event. 1310 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop s delaying the load event.
1311 setShouldDelayLoadEvent(false); 1311 setShouldDelayLoadEvent(false);
1312 1312
1313 updateDisplayState(); 1313 updateDisplayState();
1314 1314
1315 if (layoutObject()) 1315 if (layoutObject())
1316 layoutObject()->updateFromElement(); 1316 layoutObject()->updateFromElement();
1317 } 1317 }
1318 1318
1319 void HTMLMediaElement::reportPlayerErrorToDevToolsConsole()
1320 {
1321 WTF_LOG(Media, "HTMLMediaElement::reportPlayerErrorToDevToolsConsole(%p)", t his);
1322
1323 if (!m_webMediaPlayer)
1324 return;
1325
1326 const WebString& message = m_webMediaPlayer->getErrorMessage();
1327 if (message.isEmpty())
1328 return;
1329
1330 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMe ssageLevel, message));
pfeldman 2016/04/06 21:45:41 Looks more like OtherMessageSource to me.
1331 }
1332
1319 void HTMLMediaElement::noneSupported() 1333 void HTMLMediaElement::noneSupported()
1320 { 1334 {
1321 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this); 1335 WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this);
1322 1336
1323 stopPeriodicTimers(); 1337 stopPeriodicTimers();
1324 m_loadState = WaitingForSource; 1338 m_loadState = WaitingForSource;
1325 m_currentSourceNode = nullptr; 1339 m_currentSourceNode = nullptr;
1326 1340
1327 // 4.8.13.5 1341 // 4.8.13.5
1328 // The dedicated media source failure steps are the following steps: 1342 // The dedicated media source failure steps are the following steps:
1329 1343
1330 // 1 - Set the error attribute to a new MediaError object whose code attribu te is set to 1344 // 1 - Set the error attribute to a new MediaError object whose code attribu te is set to
1331 // MEDIA_ERR_SRC_NOT_SUPPORTED. 1345 // MEDIA_ERR_SRC_NOT_SUPPORTED.
1332 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); 1346 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
1347 reportPlayerErrorToDevToolsConsole();
1333 1348
1334 // 2 - Forget the media element's media-resource-specific text tracks. 1349 // 2 - Forget the media element's media-resource-specific text tracks.
1335 forgetResourceSpecificTracks(); 1350 forgetResourceSpecificTracks();
1336 1351
1337 // 3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE val ue. 1352 // 3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE val ue.
1338 setNetworkState(NETWORK_NO_SOURCE); 1353 setNetworkState(NETWORK_NO_SOURCE);
1339 1354
1340 // 4 - Set the element's show poster flag to true. 1355 // 4 - Set the element's show poster flag to true.
1341 updateDisplayState(); 1356 updateDisplayState();
1342 1357
(...skipping 17 matching lines...) Expand all
1360 ASSERT(m_readyState >= HAVE_METADATA); 1375 ASSERT(m_readyState >= HAVE_METADATA);
1361 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca st<int>(err->code())); 1376 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca st<int>(err->code()));
1362 1377
1363 // 1 - The user agent should cancel the fetching process. 1378 // 1 - The user agent should cancel the fetching process.
1364 stopPeriodicTimers(); 1379 stopPeriodicTimers();
1365 m_loadState = WaitingForSource; 1380 m_loadState = WaitingForSource;
1366 1381
1367 // 2 - Set the error attribute to a new MediaError object whose code attribu te is 1382 // 2 - Set the error attribute to a new MediaError object whose code attribu te is
1368 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. 1383 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
1369 m_error = err; 1384 m_error = err;
1385 reportPlayerErrorToDevToolsConsole();
1370 1386
1371 // 3 - Queue a task to fire a simple event named error at the media element. 1387 // 3 - Queue a task to fire a simple event named error at the media element.
1372 scheduleEvent(EventTypeNames::error); 1388 scheduleEvent(EventTypeNames::error);
1373 1389
1374 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value. 1390 // 4 - Set the element's networkState attribute to the NETWORK_IDLE value.
1375 setNetworkState(NETWORK_IDLE); 1391 setNetworkState(NETWORK_IDLE);
1376 1392
1377 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 1393 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
1378 setShouldDelayLoadEvent(false); 1394 setShouldDelayLoadEvent(false);
1379 1395
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3882 } 3898 }
3883 3899
3884 #if !ENABLE(OILPAN) 3900 #if !ENABLE(OILPAN)
3885 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr() 3901 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr()
3886 { 3902 {
3887 return m_weakPtrFactory.createWeakPtr(); 3903 return m_weakPtrFactory.createWeakPtr();
3888 } 3904 }
3889 #endif 3905 #endif
3890 3906
3891 } // namespace blink 3907 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698