Skip to content

Commit 41dced2

Browse files
committed
Bug 1974444: Use UTF8String for these. r=emilio,webrtc-reviewers,mjf
Differential Revision: https://phabricator.services.mozilla.com/D255533
1 parent 40642ac commit 41dced2

File tree

10 files changed

+35
-36
lines changed

10 files changed

+35
-36
lines changed

dom/media/webrtc/jsapi/PeerConnectionImpl.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ nsresult PeerConnectionImpl::MaybeInitializeDataChannel() {
993993
}
994994

995995
already_AddRefed<RTCDataChannel> PeerConnectionImpl::CreateDataChannel(
996-
const nsAString& aLabel, const nsAString& aProtocol, uint16_t aType,
996+
const nsACString& aLabel, const nsACString& aProtocol, uint16_t aType,
997997
bool ordered, uint16_t aMaxTime, uint16_t aMaxNum, bool aExternalNegotiated,
998998
uint16_t aStream, ErrorResult& rv) {
999999
RefPtr<RTCDataChannel> result;
@@ -1004,7 +1004,7 @@ already_AddRefed<RTCDataChannel> PeerConnectionImpl::CreateDataChannel(
10041004

10051005
NS_IMETHODIMP
10061006
PeerConnectionImpl::CreateDataChannel(
1007-
const nsAString& aLabel, const nsAString& aProtocol, uint16_t aType,
1007+
const nsACString& aLabel, const nsACString& aProtocol, uint16_t aType,
10081008
bool ordered, uint16_t aMaxTime, uint16_t aMaxNum, bool aExternalNegotiated,
10091009
uint16_t aStream, RTCDataChannel** aRetval) {
10101010
PC_AUTO_ENTER_API_CALL(false);
@@ -1043,8 +1043,7 @@ PeerConnectionImpl::CreateDataChannel(
10431043
return rv;
10441044
}
10451045
dataChannel = mDataConnection->Open(
1046-
NS_ConvertUTF16toUTF8(aLabel), NS_ConvertUTF16toUTF8(aProtocol), prPolicy,
1047-
ordered,
1046+
aLabel, aProtocol, prPolicy, ordered,
10481047
prPolicy == DataChannelReliabilityPolicy::LimitedRetransmissions
10491048
? aMaxNum
10501049
: (prPolicy == DataChannelReliabilityPolicy::LimitedLifetime
@@ -1355,10 +1354,10 @@ RefPtr<dom::RTCRtpTransceiver> PeerConnectionImpl::GetTransceiver(
13551354
}
13561355

13571356
void PeerConnectionImpl::NotifyDataChannel(
1358-
already_AddRefed<DataChannel> aChannel, const nsAString& aLabel,
1357+
already_AddRefed<DataChannel> aChannel, const nsACString& aLabel,
13591358
bool aOrdered, mozilla::dom::Nullable<uint16_t> aMaxLifeTime,
13601359
mozilla::dom::Nullable<uint16_t> aMaxRetransmits,
1361-
const nsAString& aProtocol, bool aNegotiated) {
1360+
const nsACString& aProtocol, bool aNegotiated) {
13621361
PC_AUTO_ENTER_API_CALL_NO_CHECK();
13631362

13641363
RefPtr<DataChannel> channel(aChannel);

dom/media/webrtc/jsapi/PeerConnectionImpl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ class PeerConnectionImpl final
200200
}
201201
// DataConnection observers
202202
void NotifyDataChannel(already_AddRefed<DataChannel> aChannel,
203-
const nsAString& aLabel, bool aOrdered,
203+
const nsACString& aLabel, bool aOrdered,
204204
dom::Nullable<uint16_t> aMaxLifeTime,
205205
dom::Nullable<uint16_t> aMaxRetransmits,
206-
const nsAString& aProtocol, bool aNegotiated)
206+
const nsACString& aProtocol, bool aNegotiated)
207207
// PeerConnectionImpl only inherits from DataChannelConnection
208208
// inside libxul.
209209
override;
@@ -426,8 +426,8 @@ class PeerConnectionImpl final
426426
nsresult MaybeInitializeDataChannel();
427427

428428
NS_IMETHODIMP_TO_ERRORRESULT_RETREF(RTCDataChannel, CreateDataChannel,
429-
ErrorResult& rv, const nsAString& aLabel,
430-
const nsAString& aProtocol,
429+
ErrorResult& rv, const nsACString& aLabel,
430+
const nsACString& aProtocol,
431431
uint16_t aType, bool outOfOrderAllowed,
432432
uint16_t aMaxTime, uint16_t aMaxNum,
433433
bool aExternalNegotiated,

dom/media/webrtc/jsapi/RTCDataChannel.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ NS_IMPL_RELEASE_INHERITED(RTCDataChannel, DOMEventTargetHelper)
7070
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RTCDataChannel)
7171
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
7272

73-
RTCDataChannel::RTCDataChannel(const nsAString& aLabel, bool aOrdered,
73+
RTCDataChannel::RTCDataChannel(const nsACString& aLabel, bool aOrdered,
7474
Nullable<uint16_t> aMaxLifeTime,
7575
Nullable<uint16_t> aMaxRetransmits,
76-
const nsAString& aProtocol, bool aNegotiated,
76+
const nsACString& aProtocol, bool aNegotiated,
7777
already_AddRefed<DataChannel>& aDataChannel,
7878
nsPIDOMWindowInner* aWindow)
7979
: DOMEventTargetHelper(aWindow),
@@ -120,9 +120,9 @@ nsresult RTCDataChannel::Init(nsPIDOMWindowInner* aDOMWindow) {
120120

121121
// Most of the GetFoo()/SetFoo()s don't need to touch shared resources and
122122
// are safe after Close()
123-
void RTCDataChannel::GetLabel(nsAString& aLabel) const { aLabel = mLabel; }
123+
void RTCDataChannel::GetLabel(nsACString& aLabel) const { aLabel = mLabel; }
124124

125-
void RTCDataChannel::GetProtocol(nsAString& aProtocol) const {
125+
void RTCDataChannel::GetProtocol(nsACString& aProtocol) const {
126126
aProtocol = mProtocol;
127127
}
128128

@@ -490,10 +490,10 @@ void RTCDataChannel::EventListenerRemoved(nsAtom* aType) {
490490

491491
/* static */
492492
nsresult NS_NewDOMDataChannel(already_AddRefed<DataChannel>&& aDataChannel,
493-
const nsAString& aLabel, bool aOrdered,
493+
const nsACString& aLabel, bool aOrdered,
494494
Nullable<uint16_t> aMaxLifeTime,
495495
Nullable<uint16_t> aMaxRetransmits,
496-
const nsAString& aProtocol, bool aNegotiated,
496+
const nsACString& aProtocol, bool aNegotiated,
497497
nsPIDOMWindowInner* aWindow,
498498
RTCDataChannel** aDomDataChannel) {
499499
RefPtr<RTCDataChannel> domdc =

dom/media/webrtc/jsapi/RTCDataChannel.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ class Blob;
2323
class RTCDataChannel final : public DOMEventTargetHelper,
2424
public DataChannelListener {
2525
public:
26-
RTCDataChannel(const nsAString& aLabel, bool aOrdered,
26+
RTCDataChannel(const nsACString& aLabel, bool aOrdered,
2727
Nullable<uint16_t> aMaxLifeTime,
28-
Nullable<uint16_t> aMaxRetransmits, const nsAString& aProtocol,
29-
bool aNegotiated, already_AddRefed<DataChannel>& aDataChannel,
28+
Nullable<uint16_t> aMaxRetransmits,
29+
const nsACString& aProtocol, bool aNegotiated,
30+
already_AddRefed<DataChannel>& aDataChannel,
3031
nsPIDOMWindowInner* aWindow);
3132

3233
nsresult Init(nsPIDOMWindowInner* aDOMWindow);
@@ -46,8 +47,8 @@ class RTCDataChannel final : public DOMEventTargetHelper,
4647
nsIGlobalObject* GetParentObject() const { return GetOwnerGlobal(); }
4748

4849
// WebIDL
49-
void GetLabel(nsAString& aLabel) const;
50-
void GetProtocol(nsAString& aProtocol) const;
50+
void GetLabel(nsACString& aLabel) const;
51+
void GetProtocol(nsACString& aProtocol) const;
5152
Nullable<uint16_t> GetMaxPacketLifeTime() const;
5253
Nullable<uint16_t> GetMaxRetransmits() const;
5354
RTCDataChannelState ReadyState() const;
@@ -122,11 +123,11 @@ class RTCDataChannel final : public DOMEventTargetHelper,
122123
bool mCheckMustKeepAlive;
123124
bool mSentClose;
124125

125-
const nsString mLabel;
126+
const nsCString mLabel;
126127
const bool mOrdered;
127128
const Nullable<uint16_t> mMaxPacketLifeTime;
128129
const Nullable<uint16_t> mMaxRetransmits;
129-
const nsString mProtocol;
130+
const nsCString mProtocol;
130131
const bool mNegotiated;
131132
};
132133

dom/media/webrtc/jsapi/RTCDataChannelDeclarations.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ namespace dom {
2323
class RTCDataChannel;
2424

2525
nsresult NS_NewDOMDataChannel(already_AddRefed<DataChannel>&& aDataChannel,
26-
const nsAString& aLabel, bool aOrdered,
26+
const nsACString& aLabel, bool aOrdered,
2727
Nullable<uint16_t> aMaxLifeTime,
2828
Nullable<uint16_t> aMaxRetransmits,
29-
const nsAString& aProtocol, bool aNegotiated,
29+
const nsACString& aProtocol, bool aNegotiated,
3030
nsPIDOMWindowInner* aWindow,
3131
RTCDataChannel** aDomDataChannel);
3232

dom/webidl/PeerConnectionImpl.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ interface PeerConnectionImpl {
123123

124124
/* Data channels */
125125
[Throws]
126-
RTCDataChannel createDataChannel(DOMString label, DOMString protocol,
126+
RTCDataChannel createDataChannel(UTF8String label, UTF8String protocol,
127127
unsigned short type, boolean ordered,
128128
unsigned short maxTime, unsigned short maxNum,
129129
boolean externalNegotiated, unsigned short stream);

dom/webidl/RTCDataChannel.webidl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ enum RTCDataChannelType {
1717
[Exposed=Window]
1818
interface RTCDataChannel : EventTarget
1919
{
20-
readonly attribute USVString label;
20+
readonly attribute UTF8String label;
2121
readonly attribute boolean negotiated;
2222
readonly attribute boolean ordered;
2323
readonly attribute unsigned short? maxPacketLifeTime;
2424
readonly attribute unsigned short? maxRetransmits;
25-
readonly attribute USVString protocol;
25+
readonly attribute UTF8String protocol;
2626
readonly attribute unsigned short? id;
2727
readonly attribute RTCDataChannelState readyState;
2828
readonly attribute unsigned long bufferedAmount;

dom/webidl/RTCPeerConnection.webidl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dictionary RTCDataChannelInit {
6363
unsigned short maxPacketLifeTime;
6464
[EnforceRange]
6565
unsigned short maxRetransmits;
66-
USVString protocol = "";
66+
UTF8String protocol = "";
6767
boolean negotiated = false;
6868
[EnforceRange]
6969
unsigned short id;
@@ -168,7 +168,7 @@ interface RTCPeerConnection : EventTarget {
168168

169169
readonly attribute RTCSctpTransport? sctp;
170170
// Data channel.
171-
RTCDataChannel createDataChannel (USVString label,
171+
RTCDataChannel createDataChannel (UTF8String label,
172172
optional RTCDataChannelInit dataChannelDict = {});
173173
attribute EventHandler ondatachannel;
174174
};

netwerk/sctp/datachannel/DataChannel.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,9 @@ void DataChannelConnection::HandleOpenRequestMessage(
641641
// TODO(bug 1974443): Have nsDOMDataChannel create the DataChannel
642642
// object, or have DataChannel take an nsDOMDataChannel, to avoid
643643
// passing this param list more than once?
644-
mListener->NotifyDataChannel(do_AddRef(channel),
645-
NS_ConvertUTF8toUTF16(label), ordered,
646-
maxLifeTime, maxRetransmits,
647-
NS_ConvertUTF8toUTF16(protocol), false);
644+
mListener->NotifyDataChannel(do_AddRef(channel), label, ordered,
645+
maxLifeTime, maxRetransmits, protocol,
646+
false);
648647
// Spec says to queue this in the queued task for ondatachannel
649648
channel->AnnounceOpen();
650649
}

netwerk/sctp/datachannel/DataChannel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ class DataChannelConnection : public net::NeckoTargetHolder {
146146

147147
// Called when a new DataChannel has been opened by the other side.
148148
virtual void NotifyDataChannel(
149-
already_AddRefed<DataChannel> aChannel, const nsAString& aLabel,
149+
already_AddRefed<DataChannel> aChannel, const nsACString& aLabel,
150150
bool aOrdered, mozilla::dom::Nullable<uint16_t> aMaxLifeTime,
151151
mozilla::dom::Nullable<uint16_t> aMaxRetransmits,
152-
const nsAString& aProtocol, bool aNegotiated) = 0;
152+
const nsACString& aProtocol, bool aNegotiated) = 0;
153153

154154
// Called when a DataChannel transitions to state open
155155
virtual void NotifyDataChannelOpen(DataChannel* aChannel) = 0;

0 commit comments

Comments
 (0)