dom/promise/PromiseNativeHandler.h
author Brian Smith <brian@briansmith.org>
Sun, 08 Jun 2014 19:00:58 -0700
changeset 199605 4dcb1ccdd2e116e0db11c46fa69da81b729da570
parent 171001 a6bb8146e7bcb174224fab5eccf34b819250e4ef
child 200267 b60249fb45ac98f99089b5e0baf709ffbee827f4
permissions -rw-r--r--
Bug 883339: Enable "mach gtest" on Windows, but leave GTest disabled for "make check", r=glandium, a=test-only

/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_dom_PromiseNativeHandler_h
#define mozilla_dom_PromiseNativeHandler_h

#include "nsISupports.h"

namespace mozilla {
namespace dom {

/*
 * PromiseNativeHandler allows C++ to react to a Promise being rejected/resolved.
 * A PromiseNativeHandler can be appended to a Promise using
 * Promise::AppendNativeHandler().
 */
class PromiseNativeHandler : public nsISupports
{
public:
  // NS_IMPL_ISUPPORTS0 in Promise.cpp.
  NS_DECL_ISUPPORTS

  virtual ~PromiseNativeHandler()
  { }

  virtual void
  ResolvedCallback(JS::Handle<JS::Value> aValue) = 0;

  virtual void
  RejectedCallback(JS::Handle<JS::Value> aValue) = 0;
};

} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_PromiseNativeHandler_h