Bug 1514093 part 1: A11y HandlerProvider: Don't write any payload at all (even an empty one) if the handler isn't used for the target interface. r=aklotz
authorJames Teh <jteh@mozilla.com>
Wed, 16 Jan 2019 08:08:05 +0000
changeset 514048 bdc982dd78300d5f3ef14101440a415289d6be71
parent 514047 e56368888bd4d684992e58ba4c67b4c75b262712
child 514049 ce47b0935c9f67b00787f450ff226fbc64f7ee04
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1514093
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1514093 part 1: A11y HandlerProvider: Don't write any payload at all (even an empty one) if the handler isn't used for the target interface. r=aklotz We only use the handler for specific interfaces such as IAccessible* and IAccessibleHyperlink. For interfaces which don't use the handler, we currently write an empty payload, but this still adds bytes to the stream. This seems to break marshaling such an interface in a VT_UNKNOWN in a VARIANT. To fix this, just don't write any payload at all when we aren't using the handler for the target interface. Differential Revision: https://phabricator.services.mozilla.com/D16662
accessible/ipc/win/HandlerProvider.cpp
--- a/accessible/ipc/win/HandlerProvider.cpp
+++ b/accessible/ipc/win/HandlerProvider.cpp
@@ -130,18 +130,18 @@ void HandlerProvider::GetAndSerializePay
 
 HRESULT
 HandlerProvider::GetHandlerPayloadSize(
     NotNull<mscom::IInterceptor*> aInterceptor,
     NotNull<DWORD*> aOutPayloadSize) {
   MOZ_ASSERT(mscom::IsCurrentThreadMTA());
 
   if (!IsTargetInterfaceCacheable()) {
-    *aOutPayloadSize = mscom::StructToStream::GetEmptySize();
-    return S_OK;
+    // No handler, so no payload for this instance.
+    return E_NOTIMPL;
   }
 
   MutexAutoLock lock(mMutex);
 
   GetAndSerializePayload(lock, aInterceptor);
 
   if (!mSerializer || !(*mSerializer)) {
     // Failed payload serialization is non-fatal
@@ -373,16 +373,21 @@ void HandlerProvider::BuildInitialIA2Dat
 bool HandlerProvider::IsTargetInterfaceCacheable() {
   return MarshalAs(mTargetUnkIid) == NEWEST_IA2_IID ||
          mTargetUnkIid == IID_IAccessibleHyperlink;
 }
 
 HRESULT
 HandlerProvider::WriteHandlerPayload(NotNull<mscom::IInterceptor*> aInterceptor,
                                      NotNull<IStream*> aStream) {
+  if (!IsTargetInterfaceCacheable()) {
+    // No handler, so no payload for this instance.
+    return E_NOTIMPL;
+  }
+
   MutexAutoLock lock(mMutex);
 
   if (!mSerializer || !(*mSerializer)) {
     // Failed payload serialization is non-fatal
     mscom::StructToStream emptyStruct;
     return emptyStruct.Write(aStream);
   }