| 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/ScriptCallStack.h" | 8 #include "bindings/core/v8/ScriptCallStack.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return promise == m_promise.newLocal(m_scriptState->isolate()); | 43 return promise == m_promise.newLocal(m_scriptState->isolate()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void report() | 46 void report() |
| 47 { | 47 { |
| 48 if (!m_scriptState->contextIsValid()) | 48 if (!m_scriptState->contextIsValid()) |
| 49 return; | 49 return; |
| 50 // If execution termination has been triggered, quietly bail out. | 50 // If execution termination has been triggered, quietly bail out. |
| 51 if (m_scriptState->isolate()->IsExecutionTerminating()) | 51 if (m_scriptState->isolate()->IsExecutionTerminating()) |
| 52 return; | 52 return; |
| 53 ExecutionContext* executionContext = m_scriptState->executionContext(); | 53 ExecutionContext* executionContext = m_scriptState->getExecutionContext(
); |
| 54 if (!executionContext) | 54 if (!executionContext) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 ScriptState::Scope scope(m_scriptState); | 57 ScriptState::Scope scope(m_scriptState); |
| 58 v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()
); | 58 v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()
); |
| 59 v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolat
e()); | 59 v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolat
e()); |
| 60 // Either collected or https://crbug.com/450330 | 60 // Either collected or https://crbug.com/450330 |
| 61 if (value.IsEmpty() || !value->IsPromise()) | 61 if (value.IsEmpty() || !value->IsPromise()) |
| 62 return; | 62 return; |
| 63 ASSERT(!hasHandler()); | 63 ASSERT(!hasHandler()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 92 consoleMessage->setScriptId(m_scriptId); | 92 consoleMessage->setScriptId(m_scriptId); |
| 93 m_consoleMessageId = consoleMessage->assignMessageId(); | 93 m_consoleMessageId = consoleMessage->assignMessageId(); |
| 94 executionContext->addConsoleMessage(consoleMessage.release()); | 94 executionContext->addConsoleMessage(consoleMessage.release()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 m_callStack.clear(); | 97 m_callStack.clear(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void revoke() | 100 void revoke() |
| 101 { | 101 { |
| 102 ExecutionContext* executionContext = m_scriptState->executionContext(); | 102 ExecutionContext* executionContext = m_scriptState->getExecutionContext(
); |
| 103 if (!executionContext) | 103 if (!executionContext) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 ScriptState::Scope scope(m_scriptState); | 106 ScriptState::Scope scope(m_scriptState); |
| 107 v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()
); | 107 v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()
); |
| 108 v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolat
e()); | 108 v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolat
e()); |
| 109 // Either collected or https://crbug.com/450330 | 109 // Either collected or https://crbug.com/450330 |
| 110 if (value.IsEmpty() || !value->IsPromise()) | 110 if (value.IsEmpty() || !value->IsPromise()) |
| 111 return; | 111 return; |
| 112 | 112 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 void RejectedPromises::revokeNow(PassOwnPtr<Message> message) | 279 void RejectedPromises::revokeNow(PassOwnPtr<Message> message) |
| 280 { | 280 { |
| 281 message->revoke(); | 281 message->revoke(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |