Bug 1626278: Ensure that pcid is unique. r=mjf

This fixes a failure in browser_WebrtcGlobalInformation.js on windows opt.

Differential Revision: https://phabricator.services.mozilla.com/D93261
This commit is contained in:
Byron Campen [:bwc] 2020-10-12 20:06:40 +00:00
Родитель 414ee0525d
Коммит 2409f9b07e
1 изменённых файлов: 6 добавлений и 17 удалений

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

@ -429,28 +429,17 @@ nsresult PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
CopyUTF16toUTF8(locationAStr, locationCStr);
SprintfLiteral(temp, "%" PRIu64 " (id=%" PRIu64 " url=%s)",
static_cast<uint64_t>(timestamp),
static_cast<uint64_t>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
mName = temp;
// Generate a random handle
unsigned char handle_bin[8];
SECStatus rv;
rv = PK11_GenerateRandom(handle_bin, sizeof(handle_bin));
if (rv != SECSuccess) {
if (!mUuidGen->Generate(&mHandle)) {
MOZ_CRASH();
return NS_ERROR_UNEXPECTED;
}
char hex[17];
SprintfLiteral(hex, "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", handle_bin[0],
handle_bin[1], handle_bin[2], handle_bin[3], handle_bin[4],
handle_bin[5], handle_bin[6], handle_bin[7]);
SprintfLiteral(temp, "%s %" PRIu64 " (id=%" PRIu64 " url=%s)",
mHandle.c_str(), static_cast<uint64_t>(timestamp),
static_cast<uint64_t>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
mHandle = hex;
mName = temp;
STAMP_TIMECARD(mTimeCard, "Initializing PC Ctx");
res = PeerConnectionCtx::InitializeGlobal(mThread, mSTSThread);