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

Unified Diff: Source/modules/webmidi/NavigatorWebMIDI.cpp

Issue 622733002: ScriptPromiseResolver leaked resource when constructed on stopped context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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/modules/battery/BatteryManager.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/NavigatorWebMIDI.cpp
diff --git a/Source/modules/webmidi/NavigatorWebMIDI.cpp b/Source/modules/webmidi/NavigatorWebMIDI.cpp
index 4139e3b30e47fe2478b048ced31a51d7d5891097..9bff3d7c69ca786f01e8eb4b92815ddf90b5e47a 100644
--- a/Source/modules/webmidi/NavigatorWebMIDI.cpp
+++ b/Source/modules/webmidi/NavigatorWebMIDI.cpp
@@ -33,6 +33,7 @@
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "bindings/core/v8/V8DOMError.h"
#include "core/dom/DOMError.h"
#include "core/dom/Document.h"
#include "core/frame/LocalFrame.h"
@@ -78,11 +79,7 @@ ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, Navi
ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, const MIDIOptions& options)
{
if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) {
- RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
- ScriptPromise promise = resolver->promise();
- // FIXME: Currently this rejection does not work because the context is stopped.
- resolver->reject(DOMError::create("AbortError"));
- return promise;
+ return ScriptPromise::reject(scriptState, toV8(DOMError::create("AbortError"), scriptState->context()->Global(), scriptState->isolate()));
}
return MIDIAccessInitializer::start(scriptState, options);
« no previous file with comments | « Source/modules/battery/BatteryManager.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698