Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: Source/core/events/PromiseRejectionEvent.h

Issue 1179113007: Implement onunhandledrejection / onrejectionhandled events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/events/PromiseRejectionEvent.h
diff --git a/Source/core/events/PromiseRejectionEvent.h b/Source/core/events/PromiseRejectionEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..82bf35d2a32380107140aaa94bc1af6933e29177
--- /dev/null
+++ b/Source/core/events/PromiseRejectionEvent.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PromiseRejectionEvent_h
+#define PromiseRejectionEvent_h
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "core/CoreExport.h"
+#include "core/events/Event.h"
+#include "core/events/PromiseRejectionEventInit.h"
+
+namespace blink {
+
+class CORE_EXPORT PromiseRejectionEvent : public Event {
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create()
+ {
+ return adoptRefWillBeNoop(new PromiseRejectionEvent);
+ }
+ static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(const AtomicString& type, ScriptPromise promise, ScriptValue reason)
+ {
+ return adoptRefWillBeNoop(new PromiseRejectionEvent(type, promise, reason));
+ }
+ static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(const AtomicString& type, PromiseRejectionEventInit& initializer)
+ {
+ initializer.setCancelable(true);
philipj_slow 2015/06/16 14:58:03 https://github.com/domenic/unhandled-rejections-br
jochen (gone - plz use gerrit) 2015/06/17 07:57:53 spec was updated
+ return adoptRefWillBeNoop(new PromiseRejectionEvent(type, initializer));
+ }
+
+ ScriptValue reason() const { return m_reason; }
+ ScriptPromise promise() const { return m_promise; }
+
+ virtual const AtomicString& interfaceName() const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ PromiseRejectionEvent();
+ PromiseRejectionEvent(const AtomicString& type, ScriptPromise, ScriptValue reason);
+ PromiseRejectionEvent(const AtomicString&, const PromiseRejectionEventInit&);
+ ~PromiseRejectionEvent() override;
+
+ ScriptPromise m_promise;
+ ScriptValue m_reason;
+};
+
+} // namespace blink
+
+#endif // PromiseRejectionEvent_h

Powered by Google App Engine
This is Rietveld 408576698