| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ScriptState.h" | 5 #include "bindings/core/v8/ScriptState.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ASSERT(frame); | 96 ASSERT(frame); |
| 97 v8::HandleScope handleScope(toIsolate(frame)); | 97 v8::HandleScope handleScope(toIsolate(frame)); |
| 98 v8::Local<v8::Context> context = toV8Context(frame, world); | 98 v8::Local<v8::Context> context = toV8Context(frame, world); |
| 99 if (context.IsEmpty()) | 99 if (context.IsEmpty()) |
| 100 return nullptr; | 100 return nullptr; |
| 101 ScriptState* scriptState = ScriptState::from(context); | 101 ScriptState* scriptState = ScriptState::from(context); |
| 102 ASSERT(scriptState->contextIsValid()); | 102 ASSERT(scriptState->contextIsValid()); |
| 103 return scriptState; | 103 return scriptState; |
| 104 } | 104 } |
| 105 | 105 |
| 106 ScriptStateForErrorEvent::Scope::Scope(ScriptState* scriptState, |
| 107 v8::Local<v8::Context> context) |
| 108 : m_scriptState(scriptState) { |
| 109 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 110 RefPtr<ScriptStateForErrorEvent> scriptStateForErrorEvent = |
| 111 ScriptStateForErrorEvent::create(context); |
| 112 executionContext->setErrorEventScriptState(scriptStateForErrorEvent); |
| 113 } |
| 114 |
| 115 ScriptStateForErrorEvent::Scope::~Scope() { |
| 116 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 117 executionContext->clearErrorEventScriptState(); |
| 118 } |
| 119 |
| 120 PassRefPtr<ScriptStateForErrorEvent> ScriptStateForErrorEvent::create( |
| 121 v8::Local<v8::Context> context) { |
| 122 RefPtr<ScriptStateForErrorEvent> scriptState = |
| 123 adoptRef(new ScriptStateForErrorEvent(context)); |
| 124 return scriptState; |
| 125 } |
| 126 |
| 106 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |