OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 v8::Local<v8::Object> callFrame = | 84 v8::Local<v8::Object> callFrame = |
85 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 85 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
86 v8::Local<v8::Value> result; | 86 v8::Local<v8::Value> result; |
87 if (!callFrame->Get(context, toV8StringInternalized(m_isolate, "isAtReturn")) | 87 if (!callFrame->Get(context, toV8StringInternalized(m_isolate, "isAtReturn")) |
88 .ToLocal(&result) || | 88 .ToLocal(&result) || |
89 !result->IsBoolean()) | 89 !result->IsBoolean()) |
90 return false; | 90 return false; |
91 return result.As<v8::Boolean>()->BooleanValue(context).FromMaybe(false); | 91 return result.As<v8::Boolean>()->BooleanValue(context).FromMaybe(false); |
92 } | 92 } |
93 | 93 |
94 v8::Local<v8::Object> JavaScriptCallFrame::details() const { | 94 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::details() const { |
kozy
2016/11/17 16:36:25
Can we return v8::MaybeLocal<v8::Object> and check
Yang
2016/12/12 12:23:20
Removed.
| |
95 v8::MicrotasksScope microtasks(m_isolate, | 95 v8::MicrotasksScope microtasks(m_isolate, |
96 v8::MicrotasksScope::kDoNotRunMicrotasks); | 96 v8::MicrotasksScope::kDoNotRunMicrotasks); |
97 v8::Local<v8::Context> context = | 97 v8::Local<v8::Context> context = |
98 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 98 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
99 v8::Local<v8::Object> callFrame = | 99 v8::Local<v8::Object> callFrame = |
100 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 100 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
101 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast( | 101 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast( |
102 callFrame->Get(context, toV8StringInternalized(m_isolate, "details")) | 102 callFrame->Get(context, toV8StringInternalized(m_isolate, "details")) |
103 .ToLocalChecked()); | 103 .ToLocalChecked()); |
104 return v8::Local<v8::Object>::Cast( | 104 v8::TryCatch try_catch; |
105 func->Call(context, callFrame, 0, nullptr).ToLocalChecked()); | 105 return func->Call(context, callFrame, 0, nullptr); |
106 } | 106 } |
107 | 107 |
108 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate( | 108 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate( |
109 v8::Local<v8::Value> expression) { | 109 v8::Local<v8::Value> expression) { |
110 v8::MicrotasksScope microtasks(m_isolate, | 110 v8::MicrotasksScope microtasks(m_isolate, |
111 v8::MicrotasksScope::kRunMicrotasks); | 111 v8::MicrotasksScope::kRunMicrotasks); |
112 v8::Local<v8::Context> context = | 112 v8::Local<v8::Context> context = |
113 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 113 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
114 v8::Local<v8::Object> callFrame = | 114 v8::Local<v8::Object> callFrame = |
115 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 115 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
116 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast( | 116 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast( |
117 callFrame->Get(context, toV8StringInternalized(m_isolate, "evaluate")) | 117 callFrame->Get(context, toV8StringInternalized(m_isolate, "evaluate")) |
118 .ToLocalChecked()); | 118 .ToLocalChecked()); |
119 v8::TryCatch try_catch; | |
kozy
2016/11/17 16:36:25
We have try_catch in V8DebuggerAgentImpl::evaluate
Yang
2016/12/12 12:23:20
Done.
| |
119 return evalFunction->Call(context, callFrame, 1, &expression); | 120 return evalFunction->Call(context, callFrame, 1, &expression); |
120 } | 121 } |
121 | 122 |
122 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { | 123 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { |
123 v8::MicrotasksScope microtasks(m_isolate, | 124 v8::MicrotasksScope microtasks(m_isolate, |
124 v8::MicrotasksScope::kDoNotRunMicrotasks); | 125 v8::MicrotasksScope::kDoNotRunMicrotasks); |
125 v8::Local<v8::Context> context = | 126 v8::Local<v8::Context> context = |
126 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 127 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
127 v8::Local<v8::Object> callFrame = | 128 v8::Local<v8::Object> callFrame = |
128 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 129 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
129 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( | 130 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( |
130 callFrame->Get(context, toV8StringInternalized(m_isolate, "restart")) | 131 callFrame->Get(context, toV8StringInternalized(m_isolate, "restart")) |
131 .ToLocalChecked()); | 132 .ToLocalChecked()); |
133 v8::TryCatch try_catch; | |
132 v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); | 134 v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); |
133 v8::MaybeLocal<v8::Value> result = restartFunction->Call( | 135 v8::MaybeLocal<v8::Value> result = restartFunction->Call( |
134 m_debuggerContext.Get(m_isolate), callFrame, 0, nullptr); | 136 m_debuggerContext.Get(m_isolate), callFrame, 0, nullptr); |
135 v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); | 137 v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); |
136 return result; | 138 return result; |
137 } | 139 } |
138 | 140 |
139 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue( | 141 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue( |
140 int scopeNumber, v8::Local<v8::Value> variableName, | 142 int scopeNumber, v8::Local<v8::Value> variableName, |
141 v8::Local<v8::Value> newValue) { | 143 v8::Local<v8::Value> newValue) { |
142 v8::MicrotasksScope microtasks(m_isolate, | 144 v8::MicrotasksScope microtasks(m_isolate, |
143 v8::MicrotasksScope::kDoNotRunMicrotasks); | 145 v8::MicrotasksScope::kDoNotRunMicrotasks); |
144 v8::Local<v8::Context> context = | 146 v8::Local<v8::Context> context = |
145 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 147 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
146 v8::Local<v8::Object> callFrame = | 148 v8::Local<v8::Object> callFrame = |
147 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 149 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
148 v8::Local<v8::Function> setVariableValueFunction = | 150 v8::Local<v8::Function> setVariableValueFunction = |
149 v8::Local<v8::Function>::Cast( | 151 v8::Local<v8::Function>::Cast( |
150 callFrame | 152 callFrame |
151 ->Get(context, | 153 ->Get(context, |
152 toV8StringInternalized(m_isolate, "setVariableValue")) | 154 toV8StringInternalized(m_isolate, "setVariableValue")) |
153 .ToLocalChecked()); | 155 .ToLocalChecked()); |
154 v8::Local<v8::Value> argv[] = { | 156 v8::Local<v8::Value> argv[] = { |
155 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 157 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
156 variableName, newValue}; | 158 variableName, newValue}; |
159 v8::TryCatch try_catch; | |
157 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), | 160 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), |
158 argv); | 161 argv); |
159 } | 162 } |
160 | 163 |
161 } // namespace v8_inspector | 164 } // namespace v8_inspector |
OLD | NEW |