Sends a message to the comObj to invoke the action with the supplied data.
Expects that other side will callback with the response.
@param {String} actionName Action to call.
@param {JSON} data JSON data to send.
@param {Array} [transfers] Optional list of transfers/ArrayBuffers.
@returns {Promise} Promise to be resolved with response data.
function messageHandlerSendWithPromise(actionName, data, transfers) {
    var callbackId = this.callbackIndex++;
    var message = {
      action: actionName,
      data: data,
      callbackId: callbackId
    };
    var capability = createPromiseCapability();
    this.callbacksCapabilities[callbackId] = capability;
    try {
      this.postMessage(message, transfers);
    } catch (e) {
      capability.reject(e);
    }
    return capability.promise;
  }