Bug 1254839 - include file and line number in RTCPeerConnection warnings. r=bz

MozReview-Commit-ID: HfSUBjRtFMC

--HG--
extra : rebase_source : 02a5b4b4ed1d8594d9aa42cd53d7e4ba7264e393
This commit is contained in:
Jan-Ivar Bruaroey 2016-03-08 22:44:06 -05:00
Родитель 15ee4d0aaa
Коммит 0e33523335
1 изменённых файлов: 23 добавлений и 22 удалений

Просмотреть файл

@ -375,15 +375,14 @@ RTCPeerConnection.prototype = {
JSON.parse(Services.prefs.getCharPref("media.peerconnection.default_iceservers") || "[]"); JSON.parse(Services.prefs.getCharPref("media.peerconnection.default_iceservers") || "[]");
} catch (e) { } catch (e) {
this.logWarning( this.logWarning(
"Ignoring invalid media.peerconnection.default_iceservers in about:config", "Ignoring invalid media.peerconnection.default_iceservers in about:config");
null, 0);
rtcConfig.iceServers = []; rtcConfig.iceServers = [];
} }
try { try {
this._mustValidateRTCConfiguration(rtcConfig, this._mustValidateRTCConfiguration(rtcConfig,
"Ignoring invalid media.peerconnection.default_iceservers in about:config"); "Ignoring invalid media.peerconnection.default_iceservers in about:config");
} catch (e) { } catch (e) {
this.logWarning(e.message, null, 0); this.logWarning(e.message);
rtcConfig.iceServers = []; rtcConfig.iceServers = [];
} }
} else { } else {
@ -562,7 +561,7 @@ RTCPeerConnection.prototype = {
} else if (!server.urls && server.url) { } else if (!server.urls && server.url) {
// TODO: Remove support for legacy iceServer.url eventually (Bug 1116766) // TODO: Remove support for legacy iceServer.url eventually (Bug 1116766)
server.urls = [server.url]; server.urls = [server.url];
this.logWarning("RTCIceServer.url is deprecated! Use urls instead.", null, 0); this.logWarning("RTCIceServer.url is deprecated! Use urls instead.");
} }
}); });
@ -596,8 +595,7 @@ RTCPeerConnection.prototype = {
this.logWarning("RTCConfiguration TURN credentialType \""+ this.logWarning("RTCConfiguration TURN credentialType \""+
server.credentialType + server.credentialType +
"\" is not yet implemented. Treating as password."+ "\" is not yet implemented. Treating as password."+
" https://bugzil.la/1247616", " https://bugzil.la/1247616");
null, 0);
} }
} }
else if (!(url.scheme in { stun:1, stuns:1 })) { else if (!(url.scheme in { stun:1, stuns:1 })) {
@ -605,7 +603,7 @@ RTCPeerConnection.prototype = {
"SyntaxError"); "SyntaxError");
} }
if (url.scheme in { stuns:1, turns:1 }) { if (url.scheme in { stuns:1, turns:1 }) {
this.logWarning(url.scheme.toUpperCase() + " is not yet supported.", null, 0); this.logWarning(url.scheme.toUpperCase() + " is not yet supported.");
} }
}); });
}); });
@ -642,17 +640,22 @@ RTCPeerConnection.prototype = {
} catch(e) { } catch(e) {
// If onerror itself throws, service it. // If onerror itself throws, service it.
try { try {
this.logError(e.message, e.fileName, e.lineNumber); this.logMsg(e.message, e.fileName, e.lineNumber, Ci.nsIScriptError.errorFlag);
} catch(e) {} } catch(e) {}
} }
}, },
logError: function(msg, file, line) { logError: function(msg) {
this.logMsg(msg, file, line, Ci.nsIScriptError.errorFlag); this.logStackMsg(msg, Ci.nsIScriptError.errorFlag);
}, },
logWarning: function(msg, file, line) { logWarning: function(msg) {
this.logMsg(msg, file, line, Ci.nsIScriptError.warningFlag); this.logStackMsg(msg, Ci.nsIScriptError.warningFlag);
},
logStackMsg: function(msg, flag) {
let err = this._win.Error();
this.logMsg(msg, err.fileName, err.lineNumber, flag);
}, },
logMsg: function(msg, file, line, flag) { logMsg: function(msg, file, line, flag) {
@ -686,8 +689,7 @@ RTCPeerConnection.prototype = {
{ {
get:function() { return this.getEH(name); }, get:function() { return this.getEH(name); },
set:function(h) { set:function(h) {
this.logWarning(name + " is deprecated! " + msg, this.logWarning(name + " is deprecated! " + msg);
null, 0);
return this.setEH(name, h); return this.setEH(name, h);
} }
}); });
@ -753,8 +755,7 @@ RTCPeerConnection.prototype = {
if (options && convertLegacyOptions(options)) { if (options && convertLegacyOptions(options)) {
this.logError( this.logError(
"Mandatory/optional in createOffer options no longer works! Use " + "Mandatory/optional in createOffer options no longer works! Use " +
JSON.stringify(options) + " instead (note the case difference)!", JSON.stringify(options) + " instead (note the case difference)!");
null, 0);
options = {}; options = {};
} }
@ -1235,21 +1236,21 @@ RTCPeerConnection.prototype = {
} }
if (dict.maxRetransmitNum != undefined) { if (dict.maxRetransmitNum != undefined) {
dict.maxRetransmits = dict.maxRetransmitNum; dict.maxRetransmits = dict.maxRetransmitNum;
this.logWarning("Deprecated RTCDataChannelInit dictionary entry maxRetransmitNum used!", null, 0); this.logWarning("Deprecated RTCDataChannelInit dictionary entry maxRetransmitNum used!");
} }
if (dict.outOfOrderAllowed != undefined) { if (dict.outOfOrderAllowed != undefined) {
dict.ordered = !dict.outOfOrderAllowed; // the meaning is swapped with dict.ordered = !dict.outOfOrderAllowed; // the meaning is swapped with
// the name change // the name change
this.logWarning("Deprecated RTCDataChannelInit dictionary entry outOfOrderAllowed used!", null, 0); this.logWarning("Deprecated RTCDataChannelInit dictionary entry outOfOrderAllowed used!");
} }
if (dict.preset != undefined) { if (dict.preset != undefined) {
dict.negotiated = dict.preset; dict.negotiated = dict.preset;
this.logWarning("Deprecated RTCDataChannelInit dictionary entry preset used!", null, 0); this.logWarning("Deprecated RTCDataChannelInit dictionary entry preset used!");
} }
if (dict.stream != undefined) { if (dict.stream != undefined) {
dict.id = dict.stream; dict.id = dict.stream;
this.logWarning("Deprecated RTCDataChannelInit dictionary entry stream used!", null, 0); this.logWarning("Deprecated RTCDataChannelInit dictionary entry stream used!");
} }
if (dict.maxRetransmitTime !== null && dict.maxRetransmits !== null) { if (dict.maxRetransmitTime !== null && dict.maxRetransmits !== null) {
@ -1439,7 +1440,7 @@ PeerConnectionObserver.prototype = {
} }
if (iceConnectionState === 'failed') { if (iceConnectionState === 'failed') {
pc.logError("ICE failed, see about:webrtc for more details", null, 0); pc.logError("ICE failed, see about:webrtc for more details");
} }
pc.changeIceConnectionState(iceConnectionState); pc.changeIceConnectionState(iceConnectionState);
@ -1491,7 +1492,7 @@ PeerConnectionObserver.prototype = {
break; break;
default: default:
this._dompc.logWarning("Unhandled state type: " + state, null, 0); this._dompc.logWarning("Unhandled state type: " + state);
break; break;
} }
}, },