зеркало из https://github.com/mozilla/gecko-dev.git
Bug 906990: Part 14. Catch exceptions thrown by getStats, since this can fail in fairly innocuous circumstances. Also, do a better job of error reporting when the stats API is used on a closed PeerConnection. r=jib
This commit is contained in:
Родитель
1492d9d112
Коммит
1ff222c375
|
@ -120,8 +120,10 @@ GlobalPCList.prototype = {
|
|||
|
||||
getStatsForEachPC: function(callback, errorCallback) {
|
||||
function getStatsFromPC(pcref) {
|
||||
if (pcref.get()) {
|
||||
try {
|
||||
pcref.get().getStatsInternal(null, callback, errorCallback);
|
||||
} catch (e) {
|
||||
errorCallback("Some error getting stats from PC: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +137,8 @@ GlobalPCList.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
// TODO(bcampen@mozilla.com): Handle this with a global object in c++
|
||||
// (Bug 958221)
|
||||
getLoggingFromFirstPC: function(pattern, callback, errorCallback) {
|
||||
for (let winId in this._list) {
|
||||
this.removeNullRefs(winId);
|
||||
|
@ -158,6 +162,8 @@ WebrtcGlobalInformation.prototype = {
|
|||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
|
||||
getAllStats: function(successCallback, failureCallback) {
|
||||
// TODO(bcampen@mozilla.com): Move the work of fanout into c++, and
|
||||
// only callback once. (Bug 958221)
|
||||
if (_globalPCList) {
|
||||
_globalPCList.getStatsForEachPC(successCallback, failureCallback);
|
||||
} else {
|
||||
|
|
|
@ -1349,7 +1349,7 @@ PeerConnectionImpl::GetStats(MediaStreamTrack *aSelector, bool internalStats) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
PeerConnectionImpl::GetLogging(const nsAString& aPattern) {
|
||||
PC_AUTO_ENTER_API_CALL(true);
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
std::string pattern(NS_ConvertUTF16toUTF8(aPattern).get());
|
||||
|
|
Загрузка…
Ссылка в новой задаче