Index: Source/modules/webmidi/NavigatorWebMIDI.cpp |
diff --git a/Source/modules/webmidi/NavigatorWebMIDI.cpp b/Source/modules/webmidi/NavigatorWebMIDI.cpp |
index 278986bea50a555b2da94945df82376a028aea27..03263b3aff62219a9da539caf24106408038ca54 100644 |
--- a/Source/modules/webmidi/NavigatorWebMIDI.cpp |
+++ b/Source/modules/webmidi/NavigatorWebMIDI.cpp |
@@ -31,14 +31,11 @@ |
#include "config.h" |
#include "modules/webmidi/NavigatorWebMIDI.h" |
-#include "bindings/v8/ScriptPromise.h" |
-#include "bindings/v8/ScriptPromiseResolver.h" |
-#include "core/dom/DOMError.h" |
#include "core/dom/Document.h" |
+#include "core/dom/ExecutionContext.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Navigator.h" |
-#include "modules/webmidi/MIDIAccess.h" |
-#include "modules/webmidi/MIDIOptions.h" |
+#include "modules/webmidi/MIDIAccessPromise.h" |
namespace WebCore { |
@@ -66,22 +63,20 @@ |
return *supplement; |
} |
-ScriptPromise NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Dictionary& options) |
+PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Dictionary& options) |
{ |
return NavigatorWebMIDI::from(navigator).requestMIDIAccess(options); |
} |
-ScriptPromise NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options) |
+PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options) |
{ |
- if (!frame()) { |
- RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(v8::Isolate::GetCurrent()); |
- ScriptPromise promise = resolver->promise(); |
- // FIXME: Currently this rejection does not work because the context is stopped. |
- resolver->reject(DOMError::create("AbortError")); |
- return promise; |
- } |
+ if (!frame()) |
+ return nullptr; |
- return MIDIAccess::request(MIDIOptions(options), frame()->document()); |
+ ExecutionContext* context = frame()->document(); |
+ ASSERT(context); |
+ |
+ return MIDIAccessPromise::create(context, options); |
} |
} // namespace WebCore |