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

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

Issue 2318853002: [DevTools] Handle navigation in console.log (Closed)
Patch Set: addressed comments Created 4 years, 3 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 1a106c8af2d152f2d8242e59e91748d96c7367ef..b43eaa599347cab7e3586c2c93f3cd5e8cd525e1 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -108,6 +108,7 @@ InjectedScript::~InjectedScript()
void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Object> object, const String16& groupName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, std::unique_ptr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_context->isolate());
+ v8::Local<v8::Context> context = m_context->context();
V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "getProperties");
function.appendArgument(object);
function.appendArgument(groupName);
@@ -124,7 +125,7 @@ void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Objec
return;
}
- std::unique_ptr<protocol::Value> protocolValue = toProtocolValue(m_context->context(), resultValue);
+ std::unique_ptr<protocol::Value> protocolValue = toProtocolValue(context, resultValue);
if (hasInternalError(errorString, !protocolValue))
return;
protocol::ErrorSupport errors(errorString);
@@ -151,10 +152,11 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(Erro
{
v8::HandleScope handles(m_context->isolate());
v8::Local<v8::Value> wrappedObject;
+ v8::Local<v8::Context> context = m_context->context();
if (!wrapValue(errorString, value, groupName, forceValueType, generatePreview).ToLocal(&wrappedObject))
return nullptr;
protocol::ErrorSupport errors;
- std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::RemoteObject::parse(toProtocolValue(m_context->context(), wrappedObject).get(), &errors);
+ std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::RemoteObject::parse(toProtocolValue(context, wrappedObject).get(), &errors);
if (!remoteObject)
*errorString = "Object has too long reference chain";
return remoteObject;
@@ -163,12 +165,13 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(Erro
bool InjectedScript::wrapObjectProperty(ErrorString* errorString, v8::Local<v8::Object> object, v8::Local<v8::Name> key, const String16& groupName, bool forceValueType, bool generatePreview) const
{
v8::Local<v8::Value> property;
- if (hasInternalError(errorString, !object->Get(m_context->context(), key).ToLocal(&property)))
+ v8::Local<v8::Context> context = m_context->context();
+ if (hasInternalError(errorString, !object->Get(context, key).ToLocal(&property)))
return false;
v8::Local<v8::Value> wrappedProperty;
if (!wrapValue(errorString, property, groupName, forceValueType, generatePreview).ToLocal(&wrappedProperty))
return false;
- v8::Maybe<bool> success = createDataProperty(m_context->context(), object, key, wrappedProperty);
+ v8::Maybe<bool> success = createDataProperty(context, object, key, wrappedProperty);
if (hasInternalError(errorString, success.IsNothing() || !success.FromJust()))
return false;
return true;
@@ -216,7 +219,8 @@ v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* errorString, v8
std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const
{
v8::HandleScope handles(m_context->isolate());
- V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "wrapTable");
+ v8::Local<v8::Context> context = m_context->context();
+ V8FunctionCall function(m_context->inspector(), context, v8Value(), "wrapTable");
function.appendArgument(table);
if (columns.IsEmpty())
function.appendArgument(false);
@@ -227,7 +231,7 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::L
if (hadException)
return nullptr;
protocol::ErrorSupport errors;
- return protocol::Runtime::RemoteObject::parse(toProtocolValue(m_context->context(), r).get(), &errors);
+ return protocol::Runtime::RemoteObject::parse(toProtocolValue(context, r).get(), &errors);
}
bool InjectedScript::findObject(ErrorString* errorString, const RemoteObjectId& objectId, v8::Local<v8::Value>* outObject) const

Powered by Google App Engine
This is Rietveld 408576698