mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1313966 - Add deprecation warnings to writable RTCSessionDescription. r=drno,smaug
MozReview-Commit-ID: AZAjbgJHTAc --HG-- extra : rebase_source : 23e368ed80414fb3a9b546b2842d5141dbcb4c0a
This commit is contained in:
parent
d28e124637
commit
42cfd0d3ab
@ -40,6 +40,16 @@ const PC_RECEIVER_CID = Components.ID("{d974b814-8fde-411c-8c45-b86791b81030}");
|
||||
const PC_COREQUEST_CID = Components.ID("{74b2122d-65a8-4824-aa9e-3d664cb75dc2}");
|
||||
const PC_DTMF_SENDER_CID = Components.ID("{3610C242-654E-11E6-8EC0-6D1BE389A607}");
|
||||
|
||||
function logMsg(msg, file, line, flag, winID) {
|
||||
let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
|
||||
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
|
||||
scriptError.initWithWindowID(msg, file, null, line, 0, flag,
|
||||
"content javascript", winID);
|
||||
let console = Cc["@mozilla.org/consoleservice;1"].
|
||||
getService(Ci.nsIConsoleService);
|
||||
console.logMessage(scriptError);
|
||||
};
|
||||
|
||||
// Global list of PeerConnection objects, so they can be cleaned up when
|
||||
// a page is torn down. (Maps inner window ID to an array of PC objects).
|
||||
function GlobalPCList() {
|
||||
@ -238,9 +248,7 @@ RTCIceCandidate.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function RTCSessionDescription() {
|
||||
this.type = this.sdp = null;
|
||||
}
|
||||
function RTCSessionDescription() {}
|
||||
RTCSessionDescription.prototype = {
|
||||
classDescription: "RTCSessionDescription",
|
||||
classID: PC_SESSION_CID,
|
||||
@ -248,11 +256,41 @@ RTCSessionDescription.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
|
||||
Ci.nsIDOMGlobalPropertyInitializer]),
|
||||
|
||||
init: function(win) { this._win = win; },
|
||||
init: function(win) {
|
||||
this._win = win;
|
||||
this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
},
|
||||
|
||||
__init: function(dict) {
|
||||
this.type = dict.type;
|
||||
this.sdp = dict.sdp;
|
||||
__init: function({ type, sdp }) {
|
||||
Object.assign(this, { _type: type, _sdp: sdp });
|
||||
},
|
||||
|
||||
get type() { return this._type; },
|
||||
set type(type) {
|
||||
this.warn();
|
||||
this._type = type;
|
||||
},
|
||||
|
||||
get sdp() { return this._sdp; },
|
||||
set sdp(sdp) {
|
||||
this.warn();
|
||||
this._sdp = sdp;
|
||||
},
|
||||
|
||||
warn: function() {
|
||||
if (!this._warned) {
|
||||
// Warn once per RTCSessionDescription about deprecated writable usage.
|
||||
this.logWarning("RTCSessionDescription's members are readonly! " +
|
||||
"Writing to them is deprecated and will break soon!");
|
||||
this._warned = true;
|
||||
}
|
||||
},
|
||||
|
||||
logWarning: function(msg) {
|
||||
let err = this._win.Error();
|
||||
logMsg(msg, err.fileName, err.lineNumber, Ci.nsIScriptError.warningFlag,
|
||||
this._winID);
|
||||
}
|
||||
};
|
||||
|
||||
@ -635,13 +673,7 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
logMsg: function(msg, file, line, flag) {
|
||||
let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
|
||||
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
|
||||
scriptError.initWithWindowID(msg, file, null, line, 0, flag,
|
||||
"content javascript", this._winID);
|
||||
let console = Cc["@mozilla.org/consoleservice;1"].
|
||||
getService(Ci.nsIConsoleService);
|
||||
console.logMessage(scriptError);
|
||||
return logMsg(msg, file, line, flag, this._winID);
|
||||
},
|
||||
|
||||
getEH: function(type) {
|
||||
|
@ -15,16 +15,17 @@ enum RTCSdpType {
|
||||
};
|
||||
|
||||
dictionary RTCSessionDescriptionInit {
|
||||
RTCSdpType? type = null;
|
||||
DOMString? sdp = "";
|
||||
required RTCSdpType type;
|
||||
DOMString sdp = "";
|
||||
};
|
||||
|
||||
[Pref="media.peerconnection.enabled",
|
||||
JSImplementation="@mozilla.org/dom/rtcsessiondescription;1",
|
||||
Constructor(optional RTCSessionDescriptionInit descriptionInitDict)]
|
||||
interface RTCSessionDescription {
|
||||
attribute RTCSdpType? type;
|
||||
attribute DOMString? sdp;
|
||||
// These should be readonly, but writing causes deprecation warnings for a bit
|
||||
attribute RTCSdpType type;
|
||||
attribute DOMString sdp;
|
||||
|
||||
jsonifier;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user