Commit Graph
14 Commits
Author SHA1 Message Date
Aaron Klotz f9d4c14477 Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde
MozReview-Commit-ID: GTQF3x1pBtX

A general outline of the COM handler (a.k.a. the "smart proxy"):

COM handlers are pieces of code that are loaded by the COM runtime along with
a proxy and are layered above that proxy. This enables the COM handler to
interpose itself between the caller and the proxy, thus providing the
opportunity for the handler to manipulate an interface's method calls before
those calls reach the proxy.

Handlers are regular COM components that live in DLLs and are declared in the
Windows registry. In order to allow for the specifying of a handler (and an
optional payload to be sent with the proxy), the mscom library allows its
clients to specify an implementation of the IHandlerProvider interface.

IHandlerProvider consists of 5 functions:

* GetHandler returns the CLSID of the component that should be loaded into
  the COM client's process. If GetHandler returns a failure code, then no
  handler is loaded.
* GetHandlerPayloadSize and WriteHandlerPayload are for obtaining the payload
  data. These calls are made on a background thread but need to do their work
  on the main thread. We declare the payload struct in IDL. MIDL generates two
  functions, IA2Payload_Encode and IA2Payload_Decode, which are used by
  mscom::StructToStream to read and write that struct to and from buffers.
* The a11y payload struct also includes an interface, IGeckoBackChannel, that
  allows the handler to communicate directly with Gecko. IGeckoBackChannel
  currently provides two methods: one to allow the handler to request fresh
  cache information, and the other to provide Gecko with its IHandlerControl
  interface.
* MarshalAs accepts an IID that specifies the interface that is about to be
  proxied. We may want to send a more sophisticated proxy than the one that
  is requested. The desired IID is returned by this function. In the case of
  a11y interfaces, we should always return IAccessible2_3 if we are asked for
  one of its parent interfaces. This allows us to eliminate round trips to
  resolve more sophisticated interfaces later on.
* NewInstance, which is needed to ensure that all descendent proxies are also
  imbued with the same handler code.

The main focus of this patch is as follows:

1. Provide an implementation of the IHandlerProvider interface;
2. Populate the handler payload (ie, the cache) with data;
3. Modify CreateHolderFromAccessible to specify the HandlerPayload object;
4. Receive the IHandlerControl interface from the handler DLL and move it
   into the chrome process.

Some more information about IHandlerControl:

There is one IHandlerControl per handler DLL instance. It is the interface that
we call in Gecko when we need to dispatch an event to the handler. In order to
ensure that events are dispatched in the correct order, we need to dispatch
those events from the chrome main thread so that they occur in sequential order
with calls to NotifyWinEvent.
2017-04-04 15:23:55 -06:00
Aaron Klotz 5f967c1deb Bug 1303060: Simplifications to mscom handler code; r=jimm
MozReview-Commit-ID: 5YEVtL8gw6S
2017-03-27 18:41:06 -06:00
Aaron Klotz 7abd45dd4f Bug 1344965: Clean up mscom interfaces to improve separation of concerns; r=jimm
MozReview-Commit-ID: C96y3i8hjWs
2017-03-06 17:22:43 -07:00
Aaron Klotz 09a0d81c31 Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm
MozReview-Commit-ID: 13NFW1pgxix
2017-02-17 17:30:03 -07:00
Phil Ringnalda 1f8ff08ac3 Backed out 2 changesets (bug 1303060) for Windows static-analysis bustage
CLOSED TREE

Backed out changeset 729a1b8c7e47 (bug 1303060)
Backed out changeset 604605ca738c (bug 1303060)
2017-02-22 21:55:15 -08:00
Aaron Klotz 2a74be65f3 Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm
MozReview-Commit-ID: 13NFW1pgxix
2017-02-17 17:30:03 -07:00
Aaron Klotz 49eba1cb0c Bug 1339951: Refactor mscom weak reference support and establish lock hierarchy within; r=jimm
MozReview-Commit-ID: BJJpSj44alY
2017-02-17 17:35:01 -07:00
Ting-Yu Chou 5fab2a878b Bug 1322460 - Don't addref/release on the return value of prohibited functions. r=aklotz,Ehsan
MozReview-Commit-ID: B0mAMZp5sll
2016-12-14 14:34:26 +08:00
Aaron Klotz 53d662331b Bug 1298412: Fix Interceptor construction to use Move semantics for STAUniquePtr instead of pass-by-reference; r=jimm
MozReview-Commit-ID: 8DzeT35Ao4O
2016-08-26 10:03:17 -06:00
Nathan Froyd 67a116465c Bug 1298882 - ensure mozilla/mscom/Utils.h is included with uniform casing; r=aklotz
We install mozilla/mscom/Utils.h, but include it with an all-lowercased
path in some places.  clang-cl warns about this, and even though this is
Windows-only code and will therefore work, it's better to make
everything consistent.
2016-08-29 21:55:37 -04:00
Wes Kocher c15c8be958 Merge m-c to inbound, a=merge 2016-08-18 16:32:58 -07:00
Aaron Klotz 1f97576a1f Bug 1293486: Add tearoff IDispatch handler to mscom interceptor; r=jimm
MozReview-Commit-ID: 9PSbpkNcOOh
2016-08-12 12:12:48 -06:00
Aaron Klotz e5e1d44094 Bug 1296333: Ensure better handling of nullptr and IUnknown in ipc::mscom; r=jimm
MozReview-Commit-ID: H1PvH3PIWdK
2016-08-18 09:48:48 -06:00
Aaron Klotz 518ff712c5 Bug 1263224: Adds COM interception that allows us to proxy COM invocations; r=jimm
MozReview-Commit-ID: 7dp0Jokg0X3
2016-07-27 11:44:56 -06:00