mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1882399 - Add pref media.peerconnection.treat_warnings_as_errors to catch warnings in mochitests. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D203813
This commit is contained in:
parent
ebfe61b4bf
commit
b75ea4dd09
@ -24,7 +24,7 @@ const PC_COREQUEST_CID = Components.ID(
|
||||
"{74b2122d-65a8-4824-aa9e-3d664cb75dc2}"
|
||||
);
|
||||
|
||||
function logMsg(msg, file, line, flag, winID) {
|
||||
function logWebRTCMsg(msg, file, line, flag, win) {
|
||||
let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
|
||||
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
|
||||
scriptError.initWithWindowID(
|
||||
@ -35,9 +35,14 @@ function logMsg(msg, file, line, flag, winID) {
|
||||
0,
|
||||
flag,
|
||||
"content javascript",
|
||||
winID
|
||||
win.windowGlobalChild.innerWindowId
|
||||
);
|
||||
Services.console.logMessage(scriptError);
|
||||
if (
|
||||
Services.prefs.getBoolPref("media.peerconnection.treat_warnings_as_errors")
|
||||
) {
|
||||
throw new win.TypeError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
let setupPrototype = (_class, dict) => {
|
||||
@ -277,12 +282,12 @@ export class RTCSessionDescription {
|
||||
|
||||
logWarning(msg) {
|
||||
let err = this._win.Error();
|
||||
logMsg(
|
||||
logWebRTCMsg(
|
||||
msg,
|
||||
err.fileName,
|
||||
err.lineNumber,
|
||||
Ci.nsIScriptError.warningFlag,
|
||||
this._winID
|
||||
this._win
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -861,7 +866,7 @@ export class RTCPeerConnection {
|
||||
}
|
||||
|
||||
logMsg(msg, file, line, flag) {
|
||||
return logMsg(msg, file, line, flag, this._winID);
|
||||
return logWebRTCMsg(msg, file, line, flag, this._win);
|
||||
}
|
||||
|
||||
getEH(type) {
|
||||
|
@ -424,6 +424,7 @@ function setupEnvironment() {
|
||||
["media.peerconnection.nat_simulator.block_udp", false],
|
||||
["media.peerconnection.nat_simulator.redirect_address", ""],
|
||||
["media.peerconnection.nat_simulator.redirect_targets", ""],
|
||||
["media.peerconnection.treat_warnings_as_errors", true],
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -367,9 +367,7 @@ PeerConnectionTest.prototype.createDataChannel = function (options) {
|
||||
PeerConnectionTest.prototype.createAnswer = function (peer) {
|
||||
return peer.createAnswer().then(answer => {
|
||||
// make a copy so this does not get updated with ICE candidates
|
||||
this.originalAnswer = new RTCSessionDescription(
|
||||
JSON.parse(JSON.stringify(answer))
|
||||
);
|
||||
this.originalAnswer = JSON.parse(JSON.stringify(answer));
|
||||
return answer;
|
||||
});
|
||||
};
|
||||
@ -384,9 +382,7 @@ PeerConnectionTest.prototype.createAnswer = function (peer) {
|
||||
PeerConnectionTest.prototype.createOffer = function (peer) {
|
||||
return peer.createOffer().then(offer => {
|
||||
// make a copy so this does not get updated with ICE candidates
|
||||
this.originalOffer = new RTCSessionDescription(
|
||||
JSON.parse(JSON.stringify(offer))
|
||||
);
|
||||
this.originalOffer = JSON.parse(JSON.stringify(offer));
|
||||
return offer;
|
||||
});
|
||||
};
|
||||
|
@ -98,10 +98,10 @@ runNetworkTest(async () => {
|
||||
//info("Original OFFER: " + JSON.stringify(offer));
|
||||
offer.sdp = sdputils.removeBundle(offer.sdp);
|
||||
//info("OFFER w/o BUNDLE: " + JSON.stringify(offer));
|
||||
const offerAudio = new RTCSessionDescription(JSON.parse(JSON.stringify(offer)));
|
||||
const offerAudio = JSON.parse(JSON.stringify(offer));
|
||||
offerAudio.sdp = offerAudio.sdp.replace('m=video 9', 'm=video 0');
|
||||
//info("offerAudio: " + JSON.stringify(offerAudio));
|
||||
const offerVideo = new RTCSessionDescription(JSON.parse(JSON.stringify(offer)));
|
||||
const offerVideo = JSON.parse(JSON.stringify(offer));
|
||||
offerVideo.sdp = offerVideo.sdp.replace('m=audio 9', 'm=audio 0');
|
||||
//info("offerVideo: " + JSON.stringify(offerVideo));
|
||||
|
||||
|
@ -335,6 +335,7 @@ pref("media.videocontrols.keyboard-tab-to-all-controls", true);
|
||||
pref("media.peerconnection.ice.proxy_only", false);
|
||||
pref("media.peerconnection.ice.proxy_only_if_pbmode", false);
|
||||
pref("media.peerconnection.turn.disable", false);
|
||||
pref("media.peerconnection.treat_warnings_as_errors", false);
|
||||
|
||||
// 770 = DTLS 1.0, 771 = DTLS 1.2, 772 = DTLS 1.3
|
||||
pref("media.peerconnection.dtls.version.min", 771);
|
||||
|
Loading…
x
Reference in New Issue
Block a user