2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-11-19 22:43:51 +04:00
|
|
|
/* 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"
|
2015-03-16 17:10:36 +03:00
|
|
|
#include "js/TypeDecls.h"
|
2013-11-19 22:43:51 +04:00
|
|
|
|
|
|
|
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 {
|
2014-06-23 23:56:07 +04:00
|
|
|
protected:
|
|
|
|
virtual ~PromiseNativeHandler() {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-11-19 22:43:51 +04:00
|
|
|
public:
|
2019-03-19 18:53:43 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2014-02-24 17:56:54 +04:00
|
|
|
virtual void ResolvedCallback(JSContext* aCx,
|
|
|
|
JS::Handle<JS::Value> aValue) = 0;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-03-19 18:53:43 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2014-02-24 17:56:54 +04:00
|
|
|
virtual void RejectedCallback(JSContext* aCx,
|
|
|
|
JS::Handle<JS::Value> aValue) = 0;
|
2013-11-19 22:43:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PromiseNativeHandler_h
|