OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool returnByValue, bool generatePreview, | 71 bool returnByValue, bool generatePreview, |
72 std::unique_ptr<Callback> callback) { | 72 std::unique_ptr<Callback> callback) { |
73 if (value.IsEmpty()) { | 73 if (value.IsEmpty()) { |
74 callback->sendFailure("Internal error"); | 74 callback->sendFailure("Internal error"); |
75 return; | 75 return; |
76 } | 76 } |
77 if (!value.ToLocalChecked()->IsPromise()) { | 77 if (!value.ToLocalChecked()->IsPromise()) { |
78 callback->sendFailure(notPromiseError); | 78 callback->sendFailure(notPromiseError); |
79 return; | 79 return; |
80 } | 80 } |
| 81 v8::MicrotasksScope microtasks_scope(inspector->isolate(), |
| 82 v8::MicrotasksScope::kRunMicrotasks); |
81 v8::Local<v8::Promise> promise = | 83 v8::Local<v8::Promise> promise = |
82 v8::Local<v8::Promise>::Cast(value.ToLocalChecked()); | 84 v8::Local<v8::Promise>::Cast(value.ToLocalChecked()); |
83 Callback* rawCallback = callback.get(); | 85 Callback* rawCallback = callback.get(); |
84 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler( | 86 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler( |
85 inspector, contextGroupId, executionContextId, objectGroup, | 87 inspector, contextGroupId, executionContextId, objectGroup, |
86 returnByValue, generatePreview, std::move(callback)); | 88 returnByValue, generatePreview, std::move(callback)); |
87 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate()); | 89 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate()); |
88 | 90 |
89 v8::Local<v8::Function> thenCallbackFunction = | 91 v8::Local<v8::Function> thenCallbackFunction = |
90 v8::Function::New(context, thenCallback, wrapper, 0, | 92 v8::Function::New(context, thenCallback, wrapper, 0, |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 } | 723 } |
722 | 724 |
723 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, | 725 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, |
724 bool generatePreview) { | 726 bool generatePreview) { |
725 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 727 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
726 m_frontend.flush(); | 728 m_frontend.flush(); |
727 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); | 729 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); |
728 } | 730 } |
729 | 731 |
730 } // namespace v8_inspector | 732 } // namespace v8_inspector |
OLD | NEW |