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

Unified Diff: Source/bindings/core/v8/custom/V8PromiseRejectionEventCustom.cpp

Issue 1181353005: Return null when no promise/reason is given in PromiseRejectionEvent (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
« no previous file with comments | « Source/bindings/core/v8/RejectedPromises.cpp ('k') | Source/bindings/core/v8/custom/custom.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8PromiseRejectionEventCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8PromiseRejectionEventCustom.cpp b/Source/bindings/core/v8/custom/V8PromiseRejectionEventCustom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e38f04cd07c2f28be04c6d9dc4b0f92057e3fdfb
--- /dev/null
+++ b/Source/bindings/core/v8/custom/V8PromiseRejectionEventCustom.cpp
@@ -0,0 +1,28 @@
+// 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.
+
+#include "config.h"
+#include "bindings/core/v8/V8PromiseRejectionEvent.h"
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8Binding.h"
+
+namespace blink {
+
+void V8PromiseRejectionEvent::promiseAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Isolate* isolate = info.GetIsolate();
+ PromiseRejectionEvent* event = V8PromiseRejectionEvent::toImpl(info.Holder());
+ ScriptPromise promise = event->promise(ScriptState::current(isolate));
+ if (promise.isEmpty()) {
+ v8SetReturnValue(info, v8::Null(isolate));
+ return;
+ }
+
+ v8SetReturnValue(info, promise.v8Value());
+}
+
+} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/RejectedPromises.cpp ('k') | Source/bindings/core/v8/custom/custom.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698