mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1354077: Fix missing interface registration annotations for CoGetInterfaceAndReleaseStream failures; r=jimm
MozReview-Commit-ID: b7R8yGDe44 --HG-- extra : rebase_source : 1994776a889602f8ea4ac380098a38b37e1c6a2b
This commit is contained in:
parent
7884e531f3
commit
b1cd01ad50
@ -126,7 +126,7 @@ struct ParamTraits<mozilla::mscom::COMPtrHolder<Interface, _IID>>
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::mscom::ProxyStream proxyStream(buf.get(), length);
|
||||
mozilla::mscom::ProxyStream proxyStream(_IID, buf.get(), length);
|
||||
if (!proxyStream.IsValid()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include <oleauto.h>
|
||||
|
||||
@ -354,7 +355,14 @@ AnnotateInterfaceRegistration(REFIID aIid)
|
||||
|
||||
json.End();
|
||||
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("InterfaceRegistrationInfo"),
|
||||
nsAutoCString annotationKey;
|
||||
annotationKey.AppendLiteral("InterfaceRegistrationInfo");
|
||||
if (XRE_IsParentProcess()) {
|
||||
annotationKey.AppendLiteral("Parent");
|
||||
} else {
|
||||
annotationKey.AppendLiteral("Child");
|
||||
}
|
||||
CrashReporter::AnnotateCrashReport(annotationKey,
|
||||
static_cast<CStringWriter*>(json.WriteFunc())->Get());
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ ProxyStream::ProxyStream()
|
||||
|
||||
// GetBuffer() fails with this variant, but that's okay because we're just
|
||||
// reconstructing the stream from a buffer anyway.
|
||||
ProxyStream::ProxyStream(const BYTE* aInitBuf, const int aInitBufSize)
|
||||
ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
|
||||
const int aInitBufSize)
|
||||
: mStream(InitStream(aInitBuf, static_cast<const UINT>(aInitBufSize)))
|
||||
, mGlobalLockedBuf(nullptr)
|
||||
, mHGlobal(nullptr)
|
||||
, mBufSize(aInitBufSize)
|
||||
, mUnmarshalResult(E_UNEXPECTED)
|
||||
{
|
||||
if (!aInitBufSize) {
|
||||
// We marshaled a nullptr. Nothing else to do here.
|
||||
@ -51,6 +51,8 @@ ProxyStream::ProxyStream(const BYTE* aInitBuf, const int aInitBufSize)
|
||||
return;
|
||||
}
|
||||
|
||||
HRESULT unmarshalResult = S_OK;
|
||||
|
||||
// We need to convert to an interface here otherwise we mess up const
|
||||
// correctness with IPDL. We'll request an IUnknown and then QI the
|
||||
// actual interface later.
|
||||
@ -59,10 +61,10 @@ ProxyStream::ProxyStream(const BYTE* aInitBuf, const int aInitBufSize)
|
||||
{
|
||||
// OK to forget mStream when calling into this function because the stream
|
||||
// gets released even if the unmarshaling part fails.
|
||||
mUnmarshalResult =
|
||||
unmarshalResult =
|
||||
::CoGetInterfaceAndReleaseStream(mStream.forget().take(), IID_IUnknown,
|
||||
getter_AddRefs(mUnmarshaledProxy));
|
||||
MOZ_ASSERT(SUCCEEDED(mUnmarshalResult));
|
||||
MOZ_ASSERT(SUCCEEDED(unmarshalResult));
|
||||
};
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
@ -75,10 +77,11 @@ ProxyStream::ProxyStream(const BYTE* aInitBuf, const int aInitBufSize)
|
||||
}
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (FAILED(mUnmarshalResult)) {
|
||||
nsPrintfCString hrAsStr("0x%08X", mUnmarshalResult);
|
||||
if (FAILED(unmarshalResult)) {
|
||||
nsPrintfCString hrAsStr("0x%08X", unmarshalResult);
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
NS_LITERAL_CSTRING("CoGetInterfaceAndReleaseStreamFailure"), hrAsStr);
|
||||
AnnotateInterfaceRegistration(aIID);
|
||||
}
|
||||
#endif // defined(MOZ_CRASHREPORTER)
|
||||
}
|
||||
@ -197,12 +200,6 @@ ProxyStream::GetInterface(REFIID aIID, void** aOutInterface) const
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
if (FAILED(mUnmarshalResult)) {
|
||||
AnnotateInterfaceRegistration(aIID);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mUnmarshaledProxy) {
|
||||
*aOutInterface = nullptr;
|
||||
return true;
|
||||
|
@ -21,7 +21,7 @@ class ProxyStream final
|
||||
public:
|
||||
ProxyStream();
|
||||
ProxyStream(REFIID aIID, IUnknown* aObject);
|
||||
ProxyStream(const BYTE* aInitBuf, const int aInitBufSize);
|
||||
ProxyStream(REFIID aIID, const BYTE* aInitBuf, const int aInitBufSize);
|
||||
|
||||
~ProxyStream();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user