Bug 1489040 Update WebRTC ICE candidate stats field name ipAddress to address r=mjf,jib,smaug

Bug 1489040 - P1 - Update WebRTC ICE candidate stats field ipAddress to new name, address
Bug 1489040 - P2 - adjust WebRTC stats mochitest for new stat name 'address'
Bug 1489040 - P3 - add test for legacy WebRTC stat names

Differential Revision: https://phabricator.services.mozilla.com/D5560

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nico Grunbaum 2018-11-22 00:14:36 +00:00
parent 30fe7d0849
commit 0c719fb462
7 changed files with 26 additions and 15 deletions

View File

@ -306,6 +306,17 @@ class RTCStatsReport {
makeStatsPublic(warnNullable, warnRemoteNullable, isLegacy) {
let legacyProps = {};
for (let key in this._report) {
const underlying = this._report[key];
// Add legacy names for renamed stats
if (underlying.type == "local-candidate" || underlying.type == "remote-candidate") {
// Copy stat.address to the legacy field name
underlying.ipAddress = underlying.address;
if (isLegacy) {
// Callback stats are frozen to have legacy names
delete underlying.address;
}
}
let internal = Cu.cloneInto(this._report[key], this._win);
if (isLegacy) {
internal.type = this._specToLegacyFieldMapping[internal.type] || internal.type;

View File

@ -57,20 +57,20 @@ var statsExpectedByType = {
deprecated: [],
},
"local-candidate": {
expected: ["id", "timestamp", "type", "componentId", "ipAddress",
"transport", "mozLocalTransport", "portNumber",
expected: ["id", "timestamp", "type", "componentId", "address",
"ipAddress", "transport", "mozLocalTransport", "portNumber",
"candidateType"],
optional: [],
unimplemented: ["address", "port", "networkType", "protocol",
"relayProtocol", "priority", "url"],
unimplemented: ["port", "networkType", "protocol", "relayProtocol",
"priority", "url"],
deprecated: ["candidateId"],
},
"remote-candidate": {
expected: ["id", "timestamp", "type", "componentId", "ipAddress",
"transport", "portNumber", "candidateType"],
expected: ["id", "timestamp", "type", "componentId", "address",
"ipAddress", "transport", "portNumber", "candidateType"],
optional: [],
unimplemented: ["address", "port", "networkType", "protocol",
"relayProtocol", "priority", "url"],
unimplemented: ["port", "networkType", "protocol", "relayProtocol",
"priority", "url"],
deprecated: ["candidateId"],
},
"certificate": { skip: true },

View File

@ -211,7 +211,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats> {
WriteParam(aMsg, aParam.mCandidateId);
WriteParam(aMsg, aParam.mCandidateType);
WriteParam(aMsg, aParam.mComponentId);
WriteParam(aMsg, aParam.mIpAddress);
WriteParam(aMsg, aParam.mAddress);
WriteParam(aMsg, aParam.mMozLocalTransport);
WriteParam(aMsg, aParam.mRelayProtocol);
WriteParam(aMsg, aParam.mPortNumber);
@ -224,7 +224,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats> {
if (!ReadParam(aMsg, aIter, &(aResult->mCandidateId)) ||
!ReadParam(aMsg, aIter, &(aResult->mCandidateType)) ||
!ReadParam(aMsg, aIter, &(aResult->mComponentId)) ||
!ReadParam(aMsg, aIter, &(aResult->mIpAddress)) ||
!ReadParam(aMsg, aIter, &(aResult->mAddress)) ||
!ReadParam(aMsg, aIter, &(aResult->mMozLocalTransport)) ||
!ReadParam(aMsg, aIter, &(aResult->mRelayProtocol)) ||
!ReadParam(aMsg, aIter, &(aResult->mPortNumber)) ||

View File

@ -153,7 +153,7 @@ enum RTCStatsIceCandidateType {
dictionary RTCIceCandidateStats : RTCStats {
DOMString componentId;
DOMString candidateId;
DOMString ipAddress;
DOMString address;
DOMString transport;
DOMString mozLocalTransport; // obsoleted by relayProtocol
DOMString relayProtocol;

View File

@ -591,7 +591,7 @@ static void ToRTCIceCandidateStats(
cand.mTimestamp.Construct(now);
cand.mCandidateType.Construct(
dom::RTCStatsIceCandidateType(candidate.type));
cand.mIpAddress.Construct(
cand.mAddress.Construct(
NS_ConvertASCIItoUTF16(candidate.cand_addr.host.c_str()));
cand.mPortNumber.Construct(candidate.cand_addr.port);
cand.mTransport.Construct(

View File

@ -991,7 +991,7 @@ static uint32_t GetCandidateIpAndTransportMask(const RTCIceCandidateStats *cand)
res |= CANDIDATE_BITMASK_TCP;
}
if (cand->mIpAddress.Value().FindChar(':') != -1) {
if (cand->mAddress.Value().FindChar(':') != -1) {
res |= CANDIDATE_BITMASK_IPV6;
}
@ -1050,7 +1050,7 @@ static void StoreLongTermICEStatisticsImpl_m(
if (!cand.mType.WasPassed() ||
!cand.mCandidateType.WasPassed() ||
!cand.mTransport.WasPassed() ||
!cand.mIpAddress.WasPassed() ||
!cand.mAddress.WasPassed() ||
!cand.mComponentId.WasPassed()) {
// Crash on debug, ignore this candidate otherwise.
MOZ_CRASH();

View File

@ -853,7 +853,7 @@ ICEStats.prototype = {
type = `${c.candidateType}-${c.relayProtocol}`;
}
return `${c.ipAddress}:${c.portNumber}/${c.transport}(${type})`;
return `${c.address}:${c.portNumber}/${c.transport}(${type})`;
},
};