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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 .ToLocalChecked()); | 91 .ToLocalChecked()); |
92 v8::TryCatch try_catch(m_isolate); | 92 v8::TryCatch try_catch(m_isolate); |
93 v8::Local<v8::Value> details; | 93 v8::Local<v8::Value> details; |
94 if (func->Call(context, callFrame, 0, nullptr).ToLocal(&details)) { | 94 if (func->Call(context, callFrame, 0, nullptr).ToLocal(&details)) { |
95 return v8::Local<v8::Object>::Cast(details); | 95 return v8::Local<v8::Object>::Cast(details); |
96 } | 96 } |
97 return v8::MaybeLocal<v8::Object>(); | 97 return v8::MaybeLocal<v8::Object>(); |
98 } | 98 } |
99 | 99 |
100 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate( | 100 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate( |
101 v8::Local<v8::Value> expression, bool throwOnSideEffect) { | 101 v8::Local<v8::Value> expression) { |
102 v8::MicrotasksScope microtasks(m_isolate, | 102 v8::MicrotasksScope microtasks(m_isolate, |
103 v8::MicrotasksScope::kRunMicrotasks); | 103 v8::MicrotasksScope::kRunMicrotasks); |
104 v8::Local<v8::Context> context = | 104 v8::Local<v8::Context> context = |
105 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 105 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
106 v8::Local<v8::Object> callFrame = | 106 v8::Local<v8::Object> callFrame = |
107 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 107 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
108 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast( | 108 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast( |
109 callFrame->Get(context, toV8StringInternalized(m_isolate, "evaluate")) | 109 callFrame->Get(context, toV8StringInternalized(m_isolate, "evaluate")) |
110 .ToLocalChecked()); | 110 .ToLocalChecked()); |
111 v8::Local<v8::Value> argv[] = { | 111 return evalFunction->Call(context, callFrame, 1, &expression); |
112 expression, v8::Boolean::New(m_isolate, throwOnSideEffect)}; | |
113 return evalFunction->Call(context, callFrame, arraysize(argv), argv); | |
114 } | 112 } |
115 | 113 |
116 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { | 114 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { |
117 v8::MicrotasksScope microtasks(m_isolate, | 115 v8::MicrotasksScope microtasks(m_isolate, |
118 v8::MicrotasksScope::kDoNotRunMicrotasks); | 116 v8::MicrotasksScope::kDoNotRunMicrotasks); |
119 v8::Local<v8::Context> context = | 117 v8::Local<v8::Context> context = |
120 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); | 118 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); |
121 v8::Local<v8::Object> callFrame = | 119 v8::Local<v8::Object> callFrame = |
122 v8::Local<v8::Object>::New(m_isolate, m_callFrame); | 120 v8::Local<v8::Object>::New(m_isolate, m_callFrame); |
123 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( | 121 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( |
(...skipping 24 matching lines...) Expand all Loading... |
148 .ToLocalChecked()); | 146 .ToLocalChecked()); |
149 v8::Local<v8::Value> argv[] = { | 147 v8::Local<v8::Value> argv[] = { |
150 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 148 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
151 variableName, newValue}; | 149 variableName, newValue}; |
152 v8::TryCatch try_catch(m_isolate); | 150 v8::TryCatch try_catch(m_isolate); |
153 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), | 151 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), |
154 argv); | 152 argv); |
155 } | 153 } |
156 | 154 |
157 } // namespace v8_inspector | 155 } // namespace v8_inspector |
OLD | NEW |