OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 24 matching lines...) Expand all Loading... |
35 #include "platform/v8_inspector/InspectedContext.h" | 35 #include "platform/v8_inspector/InspectedContext.h" |
36 #include "platform/v8_inspector/RemoteObjectId.h" | 36 #include "platform/v8_inspector/RemoteObjectId.h" |
37 #include "platform/v8_inspector/V8Compat.h" | 37 #include "platform/v8_inspector/V8Compat.h" |
38 #include "platform/v8_inspector/V8Console.h" | 38 #include "platform/v8_inspector/V8Console.h" |
39 #include "platform/v8_inspector/V8FunctionCall.h" | 39 #include "platform/v8_inspector/V8FunctionCall.h" |
40 #include "platform/v8_inspector/V8InjectedScriptHost.h" | 40 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
41 #include "platform/v8_inspector/V8InspectorImpl.h" | 41 #include "platform/v8_inspector/V8InspectorImpl.h" |
42 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 42 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
43 #include "platform/v8_inspector/V8StackTraceImpl.h" | 43 #include "platform/v8_inspector/V8StackTraceImpl.h" |
44 #include "platform/v8_inspector/V8StringUtil.h" | 44 #include "platform/v8_inspector/V8StringUtil.h" |
| 45 #include "platform/v8_inspector/V8ValueCopier.h" |
45 #include "platform/v8_inspector/public/V8InspectorClient.h" | 46 #include "platform/v8_inspector/public/V8InspectorClient.h" |
46 | 47 |
47 using blink::protocol::Array; | 48 using blink::protocol::Array; |
48 using blink::protocol::Debugger::CallFrame; | 49 using blink::protocol::Debugger::CallFrame; |
49 using blink::protocol::Runtime::PropertyDescriptor; | 50 using blink::protocol::Runtime::PropertyDescriptor; |
50 using blink::protocol::Runtime::InternalPropertyDescriptor; | 51 using blink::protocol::Runtime::InternalPropertyDescriptor; |
51 using blink::protocol::Runtime::RemoteObject; | 52 using blink::protocol::Runtime::RemoteObject; |
52 using blink::protocol::Maybe; | 53 using blink::protocol::Maybe; |
53 | 54 |
54 namespace v8_inspector { | 55 namespace v8_inspector { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 v8::Local<v8::Value> wrappedObject; | 153 v8::Local<v8::Value> wrappedObject; |
153 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) | 154 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) |
154 return nullptr; | 155 return nullptr; |
155 protocol::ErrorSupport errors; | 156 protocol::ErrorSupport errors; |
156 std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = protocol::Ru
ntime::RemoteObject::parse(toProtocolValue(m_context->context(), wrappedObject).
get(), &errors); | 157 std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = protocol::Ru
ntime::RemoteObject::parse(toProtocolValue(m_context->context(), wrappedObject).
get(), &errors); |
157 if (!remoteObject) | 158 if (!remoteObject) |
158 *errorString = "Object has too long reference chain"; | 159 *errorString = "Object has too long reference chain"; |
159 return remoteObject; | 160 return remoteObject; |
160 } | 161 } |
161 | 162 |
162 bool InjectedScript::wrapObjectProperty(ErrorString* errorString, v8::Local<v8::
Object> object, v8::Local<v8::Value> key, const String16& groupName, bool forceV
alueType, bool generatePreview) const | 163 bool InjectedScript::wrapObjectProperty(ErrorString* errorString, v8::Local<v8::
Object> object, v8::Local<v8::Name> key, const String16& groupName, bool forceVa
lueType, bool generatePreview) const |
163 { | 164 { |
164 v8::Local<v8::Value> property; | 165 v8::Local<v8::Value> property; |
165 if (hasInternalError(errorString, !object->Get(m_context->context(), key).To
Local(&property))) | 166 if (hasInternalError(errorString, !object->Get(m_context->context(), key).To
Local(&property))) |
166 return false; | 167 return false; |
167 v8::Local<v8::Value> wrappedProperty; | 168 v8::Local<v8::Value> wrappedProperty; |
168 if (!wrapValue(errorString, property, groupName, forceValueType, generatePre
view).ToLocal(&wrappedProperty)) | 169 if (!wrapValue(errorString, property, groupName, forceValueType, generatePre
view).ToLocal(&wrappedProperty)) |
169 return false; | 170 return false; |
170 v8::Maybe<bool> success = object->Set(m_context->context(), key, wrappedProp
erty); | 171 v8::Maybe<bool> success = createDataProperty(m_context->context(), object, k
ey, wrappedProperty); |
171 if (hasInternalError(errorString, success.IsNothing() || !success.FromJust()
)) | 172 if (hasInternalError(errorString, success.IsNothing() || !success.FromJust()
)) |
172 return false; | 173 return false; |
173 return true; | 174 return true; |
174 } | 175 } |
175 | 176 |
176 bool InjectedScript::wrapPropertyInArray(ErrorString* errorString, v8::Local<v8:
:Array> array, v8::Local<v8::String> property, const String16& groupName, bool f
orceValueType, bool generatePreview) const | 177 bool InjectedScript::wrapPropertyInArray(ErrorString* errorString, v8::Local<v8:
:Array> array, v8::Local<v8::String> property, const String16& groupName, bool f
orceValueType, bool generatePreview) const |
177 { | 178 { |
178 V8FunctionCall function(m_context->inspector(), m_context->context(), v8Valu
e(), "wrapPropertyInArray"); | 179 V8FunctionCall function(m_context->inspector(), m_context->context(), v8Valu
e(), "wrapPropertyInArray"); |
179 function.appendArgument(array); | 180 function.appendArgument(array); |
180 function.appendArgument(property); | 181 function.appendArgument(property); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 495 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
495 { | 496 { |
496 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 497 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
497 if (!remoteId) | 498 if (!remoteId) |
498 return; | 499 return; |
499 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 500 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
500 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 501 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
501 } | 502 } |
502 | 503 |
503 } // namespace v8_inspector | 504 } // namespace v8_inspector |
OLD | NEW |