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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp

Issue 2135443002: DevTools: explicitly use debugger context when processing objects from DebuggerScript.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed Created 4 years, 5 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (result.IsEmpty() || !result->IsBoolean()) 88 if (result.IsEmpty() || !result->IsBoolean())
89 return false; 89 return false;
90 return result->BooleanValue(); 90 return result->BooleanValue();
91 } 91 }
92 92
93 v8::Local<v8::Object> JavaScriptCallFrame::details() const 93 v8::Local<v8::Object> JavaScriptCallFrame::details() const
94 { 94 {
95 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks); 95 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
96 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 96 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
97 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, "details"))); 97 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, "details")));
98 return v8::Local<v8::Object>::Cast(func->Call(m_isolate->GetCurrentContext() , callFrame, 0, nullptr).ToLocalChecked()); 98 return v8::Local<v8::Object>::Cast(func->Call(m_debuggerContext.Get(m_isolat e), callFrame, 0, nullptr).ToLocalChecked());
99 } 99 }
100 100
101 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate(v8::Local<v8::Value> exp ression) 101 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate(v8::Local<v8::Value> exp ression)
102 { 102 {
103 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kRunMicrotask s); 103 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kRunMicrotask s);
104 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 104 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
105 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra me->Get(toV8StringInternalized(m_isolate, "evaluate"))); 105 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra me->Get(toV8StringInternalized(m_isolate, "evaluate")));
106 return evalFunction->Call(m_isolate->GetCurrentContext(), callFrame, 1, &exp ression); 106 return evalFunction->Call(m_debuggerContext.Get(m_isolate), callFrame, 1, &e xpression);
107 } 107 }
108 108
109 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() 109 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart()
110 { 110 {
111 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks); 111 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
112 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 112 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
113 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call Frame->Get(toV8StringInternalized(m_isolate, "restart"))); 113 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call Frame->Get(toV8StringInternalized(m_isolate, "restart")));
114 v8::Debug::SetLiveEditEnabled(m_isolate, true); 114 v8::Debug::SetLiveEditEnabled(m_isolate, true);
115 v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_isolate->GetCurre ntContext(), callFrame, 0, nullptr); 115 v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_debuggerContext.G et(m_isolate), callFrame, 0, nullptr);
116 v8::Debug::SetLiveEditEnabled(m_isolate, false); 116 v8::Debug::SetLiveEditEnabled(m_isolate, false);
117 return result; 117 return result;
118 } 118 }
119 119
120 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber, v8::Local<v8::Value> variableName, v8::Local<v8::Value> newValue) 120 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber, v8::Local<v8::Value> variableName, v8::Local<v8::Value> newValue)
121 { 121 {
122 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks); 122 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
123 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 123 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
124 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>:: Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue"))); 124 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>:: Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue")));
125 v8::Local<v8::Value> argv[] = { 125 v8::Local<v8::Value> argv[] = {
126 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), 126 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)),
127 variableName, 127 variableName,
128 newValue 128 newValue
129 }; 129 };
130 return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFr ame, PROTOCOL_ARRAY_LENGTH(argv), argv); 130 return setVariableValueFunction->Call(m_debuggerContext.Get(m_isolate), call Frame, PROTOCOL_ARRAY_LENGTH(argv), argv);
131 } 131 }
132 132
133 } // namespace blink 133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698