Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: src/inspector/java-script-call-frame.cc

Issue 2685483002: [debugger] expose side-effect free evaluate to inspector. (Closed)
Patch Set: add inspector test Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/java-script-call-frame.h ('k') | src/inspector/js_protocol.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) { 101 v8::Local<v8::Value> expression, bool throwOnSideEffect) {
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 return evalFunction->Call(context, callFrame, 1, &expression); 111 v8::Local<v8::Value> argv[] = {
112 expression, v8::Boolean::New(m_isolate, throwOnSideEffect)};
113 return evalFunction->Call(context, callFrame, arraysize(argv), argv);
112 } 114 }
113 115
114 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() { 116 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() {
115 v8::MicrotasksScope microtasks(m_isolate, 117 v8::MicrotasksScope microtasks(m_isolate,
116 v8::MicrotasksScope::kDoNotRunMicrotasks); 118 v8::MicrotasksScope::kDoNotRunMicrotasks);
117 v8::Local<v8::Context> context = 119 v8::Local<v8::Context> context =
118 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); 120 v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
119 v8::Local<v8::Object> callFrame = 121 v8::Local<v8::Object> callFrame =
120 v8::Local<v8::Object>::New(m_isolate, m_callFrame); 122 v8::Local<v8::Object>::New(m_isolate, m_callFrame);
121 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast( 123 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(
(...skipping 24 matching lines...) Expand all
146 .ToLocalChecked()); 148 .ToLocalChecked());
147 v8::Local<v8::Value> argv[] = { 149 v8::Local<v8::Value> argv[] = {
148 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), 150 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)),
149 variableName, newValue}; 151 variableName, newValue};
150 v8::TryCatch try_catch(m_isolate); 152 v8::TryCatch try_catch(m_isolate);
151 return setVariableValueFunction->Call(context, callFrame, arraysize(argv), 153 return setVariableValueFunction->Call(context, callFrame, arraysize(argv),
152 argv); 154 argv);
153 } 155 }
154 156
155 } // namespace v8_inspector 157 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/java-script-call-frame.h ('k') | src/inspector/js_protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698