| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/V8PromiseRejectionEvent.h" | 6 #include "bindings/core/v8/V8PromiseRejectionEvent.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| 11 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "bindings/core/v8/V8Binding.h" | 12 #include "bindings/core/v8/V8Binding.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 void V8PromiseRejectionEvent::promiseAttributeGetterCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) | 16 void V8PromiseRejectionEvent::promiseAttributeGetterCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) |
| 16 { | 17 { |
| 17 v8::Isolate* isolate = info.GetIsolate(); | 18 v8::Isolate* isolate = info.GetIsolate(); |
| 18 PromiseRejectionEvent* event = V8PromiseRejectionEvent::toImpl(info.Holder()
); | 19 PromiseRejectionEvent* event = V8PromiseRejectionEvent::toImpl(info.Holder()
); |
| 19 ScriptPromise promise = event->promise(ScriptState::current(isolate)); | 20 ScriptPromise promise = event->promise(ScriptState::current(isolate)); |
| 20 if (promise.isEmpty()) { | 21 if (promise.isEmpty()) { |
| 21 v8SetReturnValue(info, v8::Null(isolate)); | 22 v8SetReturnValue(info, v8::Null(isolate)); |
| 22 return; | 23 return; |
| 23 } | 24 } |
| 24 | 25 |
| 25 v8SetReturnValue(info, promise.v8Value()); | 26 v8SetReturnValue(info, promise.v8Value()); |
| 26 } | 27 } |
| 27 | 28 |
| 29 void V8PromiseRejectionEvent::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappa
ble* scriptWrappable, const v8::Persistent<v8::Object>& wrapper) |
| 30 { |
| 31 PromiseRejectionEvent* event = scriptWrappable->toImpl<PromiseRejectionEvent
>(); |
| 32 event->setWrapperReference(isolate, wrapper); |
| 33 } |
| 34 |
| 28 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |