Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp |
| diff --git a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp |
| index 90a04e6c29b2033c88b1c55d1f48758c014ab764..2fb589694c2b765b49ed74d6d8fb50cbc576e41b 100644 |
| --- a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp |
| +++ b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp |
| @@ -42,11 +42,11 @@ |
| namespace blink { |
| -NavigatorWebMIDI::NavigatorWebMIDI(LocalFrame* frame) : ContextClient(frame) {} |
| +NavigatorWebMIDI::NavigatorWebMIDI(Navigator& navigator) |
| + : Supplement<Navigator>(navigator) {} |
| DEFINE_TRACE(NavigatorWebMIDI) { |
| Supplement<Navigator>::trace(visitor); |
| - ContextClient::trace(visitor); |
| } |
| const char* NavigatorWebMIDI::supplementName() { |
| @@ -57,7 +57,7 @@ NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) { |
| NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>( |
| Supplement<Navigator>::from(navigator, supplementName())); |
| if (!supplement) { |
| - supplement = new NavigatorWebMIDI(navigator.frame()); |
| + supplement = new NavigatorWebMIDI(navigator); |
| provideTo(navigator, supplementName(), supplement); |
| } |
| return *supplement; |
| @@ -72,14 +72,15 @@ ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, |
| ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, |
| const MIDIOptions& options) { |
| - if (!frame() || frame()->document()->isContextDestroyed()) { |
| + if (!scriptState->contextIsValid()) { |
|
haraken
2017/01/06 01:11:19
This is "mostly" equivalent to the previous check
sof
2017/01/06 07:33:33
If |scriptState| represents the script state of th
haraken
2017/01/06 08:13:35
I think the two frames should match. The user scri
sof
2017/01/06 10:21:20
agreed, thanks for clarifying.
|
| return ScriptPromise::rejectWithDOMException( |
| scriptState, |
| DOMException::create(AbortError, "The frame is not working.")); |
| } |
| - UseCounter::countCrossOriginIframe(*frame()->document(), |
| - UseCounter::RequestMIDIAccessIframe); |
| + UseCounter::countCrossOriginIframe( |
| + *toDocument(scriptState->getExecutionContext()), |
| + UseCounter::RequestMIDIAccessIframe); |
| return MIDIAccessInitializer::start(scriptState, options); |
| } |