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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp

Issue 1811853002: [DevTools] Move evaluateOnCallFrame to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 32856de0f91046d11a1dbca22e41cffe71da5ea1..65c9a3affe31adabec4bba23794e6d643a87ad9a 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -155,20 +155,6 @@ void InjectedScript::callFunctionOn(ErrorString* errorString, const String16& ob
*result = makeEvalCall(errorString, function, wasThrown);
}
-void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, v8::Local<v8::Object> callFrames, const String16& callFrameId, const String16& expression, const String16& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, OwnPtr<RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
-{
- v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "evaluateOnCallFrame");
- function.appendArgument(callFrames);
- function.appendArgument(callFrameId);
- function.appendArgument(expression);
- function.appendArgument(objectGroup);
- function.appendArgument(includeCommandLineAPI);
- function.appendArgument(returnByValue);
- function.appendArgument(generatePreview);
- *result = makeEvalCall(errorString, function, wasThrown, exceptionDetails);
-}
-
void InjectedScript::getFunctionDetails(ErrorString* errorString, const String16& functionId, OwnPtr<FunctionDetails>* result)
{
v8::HandleScope handles(m_isolate);
@@ -237,25 +223,6 @@ void InjectedScript::releaseObject(const String16& objectId)
m_native->unbind(boundId);
}
-v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script> script, bool includeCommandLineAPI)
-{
- v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPISymbol(m_isolate);
- v8::Local<v8::Object> global = context()->Global();
- if (includeCommandLineAPI) {
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "commandLineAPI");
- bool hadException = false;
- v8::Local<v8::Value> commandLineAPI = function.call(hadException, false);
- if (!hadException)
- global->Set(commandLineAPISymbolValue, commandLineAPI);
- }
-
- v8::MaybeLocal<v8::Value> maybeValue = m_manager->debugger()->runCompiledScript(context(), script);
- if (includeCommandLineAPI)
- global->Delete(context(), commandLineAPISymbolValue);
-
- return maybeValue;
-}
-
PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object> callFrames)
{
v8::HandleScope handles(m_isolate);
@@ -271,19 +238,23 @@ PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object
return Array<CallFrame>::create();
}
-PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local<v8::Value> value, const String16& groupName, bool generatePreview) const
+PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(ErrorString* errorString, v8::Local<v8::Value> value, const String16& groupName, bool forceValueType, bool generatePreview) const
{
v8::HandleScope handles(m_isolate);
V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
v8::Local<v8::Value> wrappedObject;
- ErrorString errorString;
- if (!wrapValue(&errorString, value, groupName, generatePreview).ToLocal(&wrappedObject))
+ if (!wrapValue(errorString, value, groupName, forceValueType, generatePreview).ToLocal(&wrappedObject)) {
+ *errorString = "Internal error";
dgozman 2016/03/17 19:16:11 wrapValue takes care of errorString.
kozy 2016/03/17 20:48:55 Done.
return nullptr;
+ }
protocol::ErrorSupport errors;
- return protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), wrappedObject).get(), &errors);
+ OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::RemoteObject::parse(toProtocolValue(context(), wrappedObject).get(), &errors);
+ if (!remoteObject)
+ *errorString = "Object has too long reference chain";
+ return remoteObject.release();
}
-bool InjectedScript::wrapObjectProperty(ErrorString* error, v8::Local<v8::Object> object, v8::Local<v8::Value> key, const String16& groupName, bool generatePreview) const
+bool InjectedScript::wrapObjectProperty(ErrorString* error, v8::Local<v8::Object> object, v8::Local<v8::Value> key, const String16& groupName, bool forceValueType, bool generatePreview) const
{
v8::Local<v8::Value> property;
if (!object->Get(context(), key).ToLocal(&property)) {
@@ -291,7 +262,7 @@ bool InjectedScript::wrapObjectProperty(ErrorString* error, v8::Local<v8::Object
return false;
}
v8::Local<v8::Value> wrappedProperty;
- if (!wrapValue(error, property, groupName, generatePreview).ToLocal(&wrappedProperty))
+ if (!wrapValue(error, property, groupName, forceValueType, generatePreview).ToLocal(&wrappedProperty))
return false;
v8::Maybe<bool> success = object->Set(context(), key, wrappedProperty);
if (success.IsNothing() || !success.FromJust()) {
@@ -301,12 +272,13 @@ bool InjectedScript::wrapObjectProperty(ErrorString* error, v8::Local<v8::Object
return true;
}
-v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* error, v8::Local<v8::Value> value, const String16& groupName, bool generatePreview) const
+v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* error, v8::Local<v8::Value> value, const String16& groupName, bool forceValueType, bool generatePreview) const
{
V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
function.appendArgument(value);
function.appendArgument(groupName);
function.appendArgument(canAccessInspectedWindow());
+ function.appendArgument(forceValueType);
function.appendArgument(generatePreview);
bool hadException = false;
v8::Local<v8::Value> r = callFunctionWithEvalEnabled(function, hadException);
@@ -476,6 +448,17 @@ void InjectedScript::dispose()
m_manager->discardInjectedScript(m_contextId);
}
+bool InjectedScript::setLastEvaluationResult(ErrorString* errorString, v8::Local<v8::Value> value)
+{
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setLastEvaluationResult");
+ function.appendArgument(value);
+ bool hadException = false;
+ function.call(hadException, false);
+ if (hadException)
+ *errorString = "Internal error";
+ return !hadException;
+}
+
v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument(ErrorString* errorString, protocol::Runtime::CallArgument* callArgument)
{
if (callArgument->hasObjectId()) {
@@ -507,4 +490,17 @@ v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument(ErrorString* error
return v8::Undefined(m_isolate);
}
+v8::MaybeLocal<v8::Object> InjectedScript::scopeExtensionByName(ErrorString* errorString, const String16& name)
+{
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), name);
+ bool hadException = false;
+ v8::Local<v8::Value> scopeExtensionValue = function.call(hadException, false);
+ v8::Local<v8::Object> scopeExtensionObject;
+ if (hadException || scopeExtensionValue.IsEmpty() || !scopeExtensionValue->ToObject(context()).ToLocal(&scopeExtensionObject)) {
+ *errorString = "Internal error";
+ return v8::MaybeLocal<v8::Object>();
+ }
+ return scopeExtensionObject;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698