Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 | 965 |
| 966 void DartInjectedScript::getProperties(ErrorString* errorString, const String& o bjectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyD escriptor> >* properties) | 966 void DartInjectedScript::getProperties(ErrorString* errorString, const String& o bjectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyD escriptor> >* properties) |
| 967 { | 967 { |
| 968 Dart_Handle exception = 0; | 968 Dart_Handle exception = 0; |
| 969 if (!m_scriptState) { | 969 if (!m_scriptState) { |
| 970 *errorString = "Invalid DartInjectedScript"; | 970 *errorString = "Invalid DartInjectedScript"; |
| 971 return; | 971 return; |
| 972 } | 972 } |
| 973 DartIsolateScope scope(m_scriptState->isolate()); | 973 DartIsolateScope scope(m_scriptState->isolate()); |
| 974 DartApiScope apiScope; | 974 DartApiScope apiScope; |
| 975 DartDOMData* domData = DartDOMData::current(); | |
| 976 V8Scope v8scope(domData); | |
|
Jacob
2015/06/18 22:22:44
Not sure why this ever worked without a V8Scope
| |
| 975 | 977 |
| 976 DartDebuggerObject* object = lookupObject(objectId); | 978 DartDebuggerObject* object = lookupObject(objectId); |
| 977 if (!object) { | 979 if (!object) { |
| 978 *errorString = "Unknown objectId"; | 980 *errorString = "Unknown objectId"; |
| 979 return; | 981 return; |
| 980 } | 982 } |
| 981 Dart_Handle handle = object->handle(); | 983 Dart_Handle handle = object->handle(); |
| 982 String objectGroup = object->group(); | 984 String objectGroup = object->group(); |
| 983 | 985 |
| 984 *properties = Array<PropertyDescriptor>::create(); | 986 *properties = Array<PropertyDescriptor>::create(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1102 | 1104 |
| 1103 if (object->kind() == DartDebuggerObject::Object && !accessorPropertiesOnly && !Dart_IsNull(handle)) { | 1105 if (object->kind() == DartDebuggerObject::Object && !accessorPropertiesOnly && !Dart_IsNull(handle)) { |
| 1104 RefPtr<PropertyDescriptor> descriptor = PropertyDescriptor::create().set Name("[[class]]").setConfigurable(false).setEnumerable(true).release(); | 1106 RefPtr<PropertyDescriptor> descriptor = PropertyDescriptor::create().set Name("[[class]]").setConfigurable(false).setEnumerable(true).release(); |
| 1105 descriptor->setValue(wrapDartHandle(handle, DartDebuggerObject::ObjectCl ass, objectGroup, false)); | 1107 descriptor->setValue(wrapDartHandle(handle, DartDebuggerObject::ObjectCl ass, objectGroup, false)); |
| 1106 descriptor->setWritable(false); | 1108 descriptor->setWritable(false); |
| 1107 descriptor->setWasThrown(false); | 1109 descriptor->setWasThrown(false); |
| 1108 descriptor->setIsOwn(true); | 1110 descriptor->setIsOwn(true); |
| 1109 (*properties)->addItem(descriptor); | 1111 (*properties)->addItem(descriptor); |
| 1110 | 1112 |
| 1111 if (DartDOMWrapper::subtypeOf(handle, JsObject::dartClassId)) { | 1113 if (DartDOMWrapper::subtypeOf(handle, JsObject::dartClassId)) { |
| 1112 DartDOMData* domData = DartDOMData::current(); | |
| 1113 JsObject* object = DartDOMWrapper::unwrapDartWrapper<JsObject>(domDa ta, handle, exception); | 1114 JsObject* object = DartDOMWrapper::unwrapDartWrapper<JsObject>(domDa ta, handle, exception); |
| 1114 if (!exception) { | 1115 if (!exception) { |
| 1115 descriptor = PropertyDescriptor::create().setName("[[JavaScript View]]").setConfigurable(false).setEnumerable(true).release(); | 1116 descriptor = PropertyDescriptor::create().setName("[[JavaScript View]]").setConfigurable(false).setEnumerable(true).release(); |
| 1116 | 1117 |
| 1117 V8ScriptState* v8ScriptState = DartUtilities::v8ScriptStateForCu rrentIsolate(); | 1118 V8ScriptState* v8ScriptState = DartUtilities::v8ScriptStateForCu rrentIsolate(); |
| 1118 InjectedScript v8InjectedScript = m_injectedScriptManager->injec tedScriptFor(v8ScriptState); | 1119 InjectedScript v8InjectedScript = m_injectedScriptManager->injec tedScriptFor(v8ScriptState); |
| 1119 ScriptValue v8ScriptValue(v8ScriptState, object->localV8Object() ); | 1120 ScriptValue v8ScriptValue(v8ScriptState, object->localV8Object() ); |
| 1120 descriptor->setValue(v8InjectedScript.wrapObject(v8ScriptValue, objectGroup, false)); | 1121 descriptor->setValue(v8InjectedScript.wrapObject(v8ScriptValue, objectGroup, false)); |
| 1121 descriptor->setWritable(false); | 1122 descriptor->setWritable(false); |
| 1122 descriptor->setWasThrown(false); | 1123 descriptor->setWasThrown(false); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1137 *properties = Array<InternalPropertyDescriptor>::create(); | 1138 *properties = Array<InternalPropertyDescriptor>::create(); |
| 1138 } | 1139 } |
| 1139 | 1140 |
| 1140 void DartInjectedScript::getProperty(ErrorString* errorString, const String& obj ectId, const RefPtr<JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::Remot eObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) | 1141 void DartInjectedScript::getProperty(ErrorString* errorString, const String& obj ectId, const RefPtr<JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::Remot eObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
| 1141 { | 1142 { |
| 1142 if (!m_scriptState) { | 1143 if (!m_scriptState) { |
| 1143 *errorString = "Invalid DartInjectedScript"; | 1144 *errorString = "Invalid DartInjectedScript"; |
| 1144 return; | 1145 return; |
| 1145 } | 1146 } |
| 1146 DartIsolateScope scope(m_scriptState->isolate()); | 1147 DartIsolateScope scope(m_scriptState->isolate()); |
| 1148 DartDOMData* domData = DartDOMData::current(); | |
| 1149 V8Scope v8scope(domData); | |
| 1147 DartApiScope apiScope; | 1150 DartApiScope apiScope; |
| 1148 | 1151 |
| 1149 DartDebuggerObject* object = lookupObject(objectId); | 1152 DartDebuggerObject* object = lookupObject(objectId); |
| 1150 if (!object) { | 1153 if (!object) { |
| 1151 *errorString = "Unknown objectId"; | 1154 *errorString = "Unknown objectId"; |
| 1152 return; | 1155 return; |
| 1153 } | 1156 } |
| 1154 Dart_Handle handle = object->handle(); | 1157 Dart_Handle handle = object->handle(); |
| 1155 const String& objectGroup = object->group(); | 1158 const String& objectGroup = object->group(); |
| 1156 | 1159 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1440 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); | 1443 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); |
| 1441 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { | 1444 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { |
| 1442 bool isDart = false; | 1445 bool isDart = false; |
| 1443 bool success = parsedObjectId->asObject()-> getBoolean("isDart", &isDart ); | 1446 bool success = parsedObjectId->asObject()-> getBoolean("isDart", &isDart ); |
| 1444 return success && isDart; | 1447 return success && isDart; |
| 1445 } | 1448 } |
| 1446 return false; | 1449 return false; |
| 1447 } | 1450 } |
| 1448 | 1451 |
| 1449 } // namespace blink | 1452 } // namespace blink |
| OLD | NEW |