Bug 1197021 - Remove deprecation errors for obsolete RTCOfferOptions (w/mandatory optional). r=drno,mrbkap

MozReview-Commit-ID: BzCxOML3i2p

--HG--
extra : rebase_source : 0471f0333924cfeb63062240fa55d993361263d8
This commit is contained in:
Jan-Ivar Bruaroey 2016-11-20 12:16:20 -05:00
Родитель bdc29beadc
Коммит a51271cdc7
2 изменённых файлов: 0 добавлений и 54 удалений

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

@ -725,49 +725,6 @@ RTCPeerConnection.prototype = {
options = optionsOrOnSuccess;
}
return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
// TODO: Remove error on constraint-like RTCOptions next cycle (1197021).
// Note that webidl bindings make o.mandatory implicit but not o.optional.
function convertLegacyOptions(o) {
// Detect (mandatory OR optional) AND no other top-level members.
let lcy = ((o.mandatory && Object.keys(o.mandatory).length) || o.optional) &&
Object.keys(o).length == (o.mandatory? 1 : 0) + (o.optional? 1 : 0);
if (!lcy) {
return false;
}
let old = o.mandatory || {};
if (o.mandatory) {
delete o.mandatory;
}
if (o.optional) {
o.optional.forEach(one => {
// The old spec had optional as an array of objects w/1 attribute each.
// Assumes our JS-webidl bindings only populate passed-in properties.
let key = Object.keys(one)[0];
if (key && old[key] === undefined) {
old[key] = one[key];
}
});
delete o.optional;
}
o.offerToReceiveAudio = old.OfferToReceiveAudio;
o.offerToReceiveVideo = old.OfferToReceiveVideo;
o.mozDontOfferDataChannel = old.MozDontOfferDataChannel;
o.mozBundleOnly = old.MozBundleOnly;
Object.keys(o).forEach(k => {
if (o[k] === undefined) {
delete o[k];
}
});
return true;
}
if (options && convertLegacyOptions(options)) {
this.logError(
"Mandatory/optional in createOffer options no longer works! Use " +
JSON.stringify(options) + " instead (note the case difference)!");
options = {};
}
let origin = Cu.getWebIDLCallerPrincipal().origin;
return this._chain(() => {
let p = Promise.all([this.getPermission(), this._certificateReady])

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

@ -67,17 +67,6 @@ dictionary RTCOfferOptions : RTCOfferAnswerOptions {
// Mozilla proprietary options (at risk: Bug 1196974)
boolean mozDontOfferDataChannel;
boolean mozBundleOnly;
// TODO: Remove old constraint-like RTCOptions support soon (Bug 1064223).
DeprecatedRTCOfferOptionsSet mandatory;
sequence<DeprecatedRTCOfferOptionsSet> _optional;
};
dictionary DeprecatedRTCOfferOptionsSet {
boolean OfferToReceiveAudio; // Note the uppercase 'O'
boolean OfferToReceiveVideo; // Note the uppercase 'O'
boolean MozDontOfferDataChannel; // Note the uppercase 'M'
boolean MozBundleOnly; // Note the uppercase 'M'
};
interface RTCDataChannel;