OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bindings/core/v8/RejectedPromises.h" | 5 #include "bindings/core/v8/RejectedPromises.h" |
6 | 6 |
7 #include "bindings/core/v8/ScopedPersistent.h" | 7 #include "bindings/core/v8/ScopedPersistent.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 init.setReason(ScriptValue(m_scriptState, reason)); | 69 init.setReason(ScriptValue(m_scriptState, reason)); |
70 init.setCancelable(true); | 70 init.setCancelable(true); |
71 PromiseRejectionEvent* event = PromiseRejectionEvent::create(m_scrip
tState, EventTypeNames::unhandledrejection, init); | 71 PromiseRejectionEvent* event = PromiseRejectionEvent::create(m_scrip
tState, EventTypeNames::unhandledrejection, init); |
72 // Log to console if event was not canceled. | 72 // Log to console if event was not canceled. |
73 m_shouldLogToConsole = target->dispatchEvent(event) == DispatchEvent
Result::NotCanceled; | 73 m_shouldLogToConsole = target->dispatchEvent(event) == DispatchEvent
Result::NotCanceled; |
74 } | 74 } |
75 | 75 |
76 if (m_shouldLogToConsole) { | 76 if (m_shouldLogToConsole) { |
77 V8PerIsolateData* data = V8PerIsolateData::from(m_scriptState->isola
te()); | 77 V8PerIsolateData* data = V8PerIsolateData::from(m_scriptState->isola
te()); |
78 if (data->threadDebugger()) | 78 if (data->threadDebugger()) |
79 m_promiseRejectionId = data->threadDebugger()->debugger()->promi
seRejected(m_scriptState->context(), m_errorMessage, reason, m_location->url(),
m_location->lineNumber(), m_location->columnNumber(), m_location->cloneStackTrac
e(), m_location->scriptId()); | 79 m_promiseRejectionId = data->threadDebugger()->promiseRejected(m
_scriptState->context(), m_errorMessage, reason, std::move(m_location)); |
80 } | 80 } |
81 | 81 |
82 m_location.reset(); | 82 m_location.reset(); |
83 } | 83 } |
84 | 84 |
85 void revoke() | 85 void revoke() |
86 { | 86 { |
87 ExecutionContext* executionContext = m_scriptState->getExecutionContext(
); | 87 ExecutionContext* executionContext = m_scriptState->getExecutionContext(
); |
88 if (!executionContext) | 88 if (!executionContext) |
89 return; | 89 return; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) | 258 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) |
259 { | 259 { |
260 message->revoke(); | 260 message->revoke(); |
261 } | 261 } |
262 | 262 |
263 } // namespace blink | 263 } // namespace blink |
OLD | NEW |