зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1641901 - Check the type of OutboundMessage::mMsg before using r=michal,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D77546
This commit is contained in:
Родитель
08683e3116
Коммит
555823e361
|
@ -942,14 +942,21 @@ class OutboundMessage {
|
|||
|
||||
WsMsgType GetMsgType() const { return mMsgType; }
|
||||
int32_t Length() {
|
||||
pString& ref = mMsg.as<pString>();
|
||||
return ref.mValue.Length();
|
||||
if (mMsg.is<pString>()) {
|
||||
return mMsg.as<pString>().mValue.Length();
|
||||
}
|
||||
|
||||
return mMsg.as<StreamWithLength>().mLength;
|
||||
}
|
||||
int32_t OrigLength() {
|
||||
if (mMsg.is<pString>()) {
|
||||
pString& ref = mMsg.as<pString>();
|
||||
return mDeflated ? ref.mOrigValue.Length() : ref.mValue.Length();
|
||||
}
|
||||
|
||||
return mMsg.as<StreamWithLength>().mLength;
|
||||
}
|
||||
|
||||
uint8_t* BeginWriting() {
|
||||
MOZ_ASSERT(mMsgType != kMsgTypeStream,
|
||||
"Stream should have been converted to string by now");
|
||||
|
|
Загрузка…
Ссылка в новой задаче