Bug 973315 - Make code that sets PeerConnectionImpl::mName more tolerant of weird scenarios. r=jib

This commit is contained in:
Byron Campen [:bwc] 2014-02-19 16:39:07 -08:00
parent 525296f898
commit 2ee54456bb

View File

@ -728,22 +728,26 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
char temp[128];
#ifdef MOZILLA_INTERNAL_API
nsIDOMLocation* location = nullptr;
mWindow->GetLocation(&location);
MOZ_ASSERT(location);
nsString locationAStr;
nsAutoCString locationCStr;
nsIDOMLocation* location;
res = mWindow->GetLocation(&location);
if (location && NS_SUCCEEDED(res)) {
nsAutoString locationAStr;
location->ToString(locationAStr);
location->Release();
nsCString locationCStr;
CopyUTF16toUTF8(locationAStr, locationCStr);
MOZ_ASSERT(mWindow);
PR_snprintf(temp,
}
PR_snprintf(
temp,
sizeof(temp),
"%llu (id=%u url=%s)",
(unsigned long long)timestamp,
(unsigned)mWindow->WindowID(),
"%llu (id=%llu url=%s)",
static_cast<unsigned long long>(timestamp),
static_cast<unsigned long long>(mWindow ? mWindow->WindowID() : 0),
locationCStr.get() ? locationCStr.get() : "NULL");
#else
PR_snprintf(temp, sizeof(temp), "%llu", (unsigned long long)timestamp);
#endif // MOZILLA_INTERNAL_API