| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "bindings/core/dart/DartScriptPromise.h" |
| 7 |
| 8 #include "bindings/common/ExceptionMessages.h" |
| 9 #include "bindings/common/ExceptionState.h" |
| 10 #include "bindings/core/dart/DartUtilities.h" |
| 11 #include "bindings/core/v8/V8Binding.h" |
| 12 #include "bindings/core/v8/V8ThrowException.h" |
| 13 #include "core/dom/DOMException.h" |
| 14 #include <v8.h> |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 DartScriptPromise::DartScriptPromise(DartScriptState* scriptState, Dart_Handle f
uture) |
| 19 : m_scriptState(scriptState) |
| 20 , m_value(future) |
| 21 { |
| 22 if (!future) |
| 23 return; |
| 24 |
| 25 if (!Dart_IsFuture(future)) { |
| 26 m_value.clear(); |
| 27 // FIXMEDART: How do we do a sticky error? |
| 28 Dart_Handle coreLib = Dart_LookupLibrary(Dart_NewStringFromCString("dart
:core")); |
| 29 Dart_Handle errorClass = Dart_GetType(coreLib, DartUtilities::stringToDa
rt((String)"ArgumentError"), 0, 0); |
| 30 Dart_Handle dartMessage = DartUtilities::stringToDart((String)"the given
value is not a Future"); |
| 31 Dart_Handle error = Dart_New(errorClass, Dart_NewStringFromCString(""),
1, &dartMessage); |
| 32 Dart_ThrowException(error); |
| 33 ASSERT_NOT_REACHED(); |
| 34 return; |
| 35 } |
| 36 } |
| 37 |
| 38 PassRefPtr<AbstractScriptPromise> DartScriptPromise::then(PassOwnPtr<ScriptFunct
ion> onFulfilled, PassOwnPtr<ScriptFunction> onRejected) |
| 39 { |
| 40 // FIXMEDART: Implement. |
| 41 RELEASE_ASSERT_NOT_REACHED(); |
| 42 return nullptr; |
| 43 } |
| 44 |
| 45 } // namespace blink |
| OLD | NEW |