OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (!remoteId) | 232 if (!remoteId) |
233 return; | 233 return; |
234 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(errorString, remoteId.get()); | 234 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(errorString, remoteId.get()); |
235 if (!injectedScript) | 235 if (!injectedScript) |
236 return; | 236 return; |
237 | 237 |
238 IgnoreExceptionsScope ignoreExceptionsScope(m_debugger); | 238 IgnoreExceptionsScope ignoreExceptionsScope(m_debugger); |
239 | 239 |
240 v8::HandleScope handles(injectedScript->isolate()); | 240 v8::HandleScope handles(injectedScript->isolate()); |
241 v8::Context::Scope scope(injectedScript->context()); | 241 v8::Context::Scope scope(injectedScript->context()); |
242 v8::Local<v8::Value> object; | 242 v8::Local<v8::Value> objectValue; |
243 if (!injectedScript->findObject(errorString, *remoteId, &object)) | 243 if (!injectedScript->findObject(errorString, *remoteId, &objectValue)) |
244 return; | 244 return; |
| 245 if (!objectValue->IsObject()) { |
| 246 *errorString = "Value with given id is not an object"; |
| 247 return; |
| 248 } |
| 249 |
| 250 v8::Local<v8::Object> object = objectValue.As<v8::Object>(); |
245 String16 objectGroupName = injectedScript->objectGroupName(*remoteId); | 251 String16 objectGroupName = injectedScript->objectGroupName(*remoteId); |
246 | 252 injectedScript->getProperties(errorString, object, objectGroupName, ownPrope
rties.fromMaybe(false), accessorPropertiesOnly.fromMaybe(false), generatePreview
.fromMaybe(false), result, exceptionDetails); |
247 injectedScript->getProperties(errorString, objectId, ownProperties.fromMaybe
(false), accessorPropertiesOnly.fromMaybe(false), generatePreview.fromMaybe(fals
e), result, exceptionDetails); | |
248 if (!errorString->isEmpty() || exceptionDetails->isJust() || accessorPropert
iesOnly.fromMaybe(false)) | 253 if (!errorString->isEmpty() || exceptionDetails->isJust() || accessorPropert
iesOnly.fromMaybe(false)) |
249 return; | 254 return; |
250 if (object->IsSymbol()) | |
251 return; | |
252 v8::Local<v8::Array> propertiesArray; | 255 v8::Local<v8::Array> propertiesArray; |
253 if (hasInternalError(errorString, !v8::Debug::GetInternalProperties(injected
Script->isolate(), object).ToLocal(&propertiesArray))) | 256 if (hasInternalError(errorString, !v8::Debug::GetInternalProperties(injected
Script->isolate(), objectValue).ToLocal(&propertiesArray))) |
254 return; | 257 return; |
255 OwnPtr<protocol::Array<InternalPropertyDescriptor>> propertiesProtocolArray
= protocol::Array<InternalPropertyDescriptor>::create(); | 258 OwnPtr<protocol::Array<InternalPropertyDescriptor>> propertiesProtocolArray
= protocol::Array<InternalPropertyDescriptor>::create(); |
256 for (uint32_t i = 0; i < propertiesArray->Length(); i += 2) { | 259 for (uint32_t i = 0; i < propertiesArray->Length(); i += 2) { |
257 v8::Local<v8::Value> name; | 260 v8::Local<v8::Value> name; |
258 if (hasInternalError(errorString, !propertiesArray->Get(injectedScript->
context(), i).ToLocal(&name)) || !name->IsString()) | 261 if (hasInternalError(errorString, !propertiesArray->Get(injectedScript->
context(), i).ToLocal(&name)) || !name->IsString()) |
259 return; | 262 return; |
260 v8::Local<v8::Value> value; | 263 v8::Local<v8::Value> value; |
261 if (hasInternalError(errorString, !propertiesArray->Get(injectedScript->
context(), i + 1).ToLocal(&value))) | 264 if (hasInternalError(errorString, !propertiesArray->Get(injectedScript->
context(), i + 1).ToLocal(&value))) |
262 return; | 265 return; |
263 OwnPtr<RemoteObject> wrappedValue = injectedScript->wrapObject(errorStri
ng, value, objectGroupName); | 266 OwnPtr<RemoteObject> wrappedValue = injectedScript->wrapObject(errorStri
ng, value, objectGroupName); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 538 } |
536 | 539 |
537 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(v8::Local<v8::Context>
context) | 540 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(v8::Local<v8::Context>
context) |
538 { | 541 { |
539 int contextId = m_injectedScriptManager->discardInjectedScriptFor(context); | 542 int contextId = m_injectedScriptManager->discardInjectedScriptFor(context); |
540 if (m_enabled && contextId) | 543 if (m_enabled && contextId) |
541 m_frontend->executionContextDestroyed(contextId); | 544 m_frontend->executionContextDestroyed(contextId); |
542 } | 545 } |
543 | 546 |
544 } // namespace blink | 547 } // namespace blink |
OLD | NEW |