| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 if (resultValue->type() == JSONValue::TypeObject) { | 110 if (resultValue->type() == JSONValue::TypeObject) { |
| 111 *result = resultValue->asObject(); | 111 *result = resultValue->asObject(); |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 *errorString = "Internal error"; | 115 *errorString = "Internal error"; |
| 116 } | 116 } |
| 117 | 117 |
| 118 void InjectedScript::getStepInPositions(ErrorString* errorString, const ScriptVa
lue& callFrames, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::
Location> >& positions) | 118 void InjectedScript::getStepInPositions(ErrorString* errorString, const ScriptVa
lue& callFrames, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::
Location>>& positions) |
| 119 { | 119 { |
| 120 ScriptFunctionCall function(injectedScriptObject(), "getStepInPositions"); | 120 ScriptFunctionCall function(injectedScriptObject(), "getStepInPositions"); |
| 121 function.appendArgument(callFrames); | 121 function.appendArgument(callFrames); |
| 122 function.appendArgument(callFrameId); | 122 function.appendArgument(callFrameId); |
| 123 RefPtr<JSONValue> resultValue; | 123 RefPtr<JSONValue> resultValue; |
| 124 makeCall(function, &resultValue); | 124 makeCall(function, &resultValue); |
| 125 if (resultValue) { | 125 if (resultValue) { |
| 126 if (resultValue->type() == JSONValue::TypeString) { | 126 if (resultValue->type() == JSONValue::TypeString) { |
| 127 resultValue->asString(errorString); | 127 resultValue->asString(errorString); |
| 128 return; | 128 return; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 RefPtr<JSONValue> resultValue; | 186 RefPtr<JSONValue> resultValue; |
| 187 makeCall(function, &resultValue); | 187 makeCall(function, &resultValue); |
| 188 if (!resultValue || resultValue->type() != JSONValue::TypeObject) { | 188 if (!resultValue || resultValue->type() != JSONValue::TypeObject) { |
| 189 if (!resultValue->asString(errorString)) | 189 if (!resultValue->asString(errorString)) |
| 190 *errorString = "Internal error"; | 190 *errorString = "Internal error"; |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 *result = GeneratorObjectDetails::runtimeCast(resultValue); | 193 *result = GeneratorObjectDetails::runtimeCast(resultValue); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void InjectedScript::getCollectionEntries(ErrorString* errorString, const String
& objectId, RefPtr<Array<CollectionEntry> >* result) | 196 void InjectedScript::getCollectionEntries(ErrorString* errorString, const String
& objectId, RefPtr<Array<CollectionEntry>>* result) |
| 197 { | 197 { |
| 198 ScriptFunctionCall function(injectedScriptObject(), "getCollectionEntries"); | 198 ScriptFunctionCall function(injectedScriptObject(), "getCollectionEntries"); |
| 199 function.appendArgument(objectId); | 199 function.appendArgument(objectId); |
| 200 RefPtr<JSONValue> resultValue; | 200 RefPtr<JSONValue> resultValue; |
| 201 makeCall(function, &resultValue); | 201 makeCall(function, &resultValue); |
| 202 if (!resultValue || resultValue->type() != JSONValue::TypeArray) { | 202 if (!resultValue || resultValue->type() != JSONValue::TypeArray) { |
| 203 if (!resultValue->asString(errorString)) | 203 if (!resultValue->asString(errorString)) |
| 204 *errorString = "Internal error"; | 204 *errorString = "Internal error"; |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 *result = Array<CollectionEntry>::runtimeCast(resultValue); | 207 *result = Array<CollectionEntry>::runtimeCast(resultValue); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void InjectedScript::getProperties(ErrorString* errorString, const String& objec
tId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyDescr
iptor> >* properties) | 210 void InjectedScript::getProperties(ErrorString* errorString, const String& objec
tId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyDescr
iptor>>* properties) |
| 211 { | 211 { |
| 212 ScriptFunctionCall function(injectedScriptObject(), "getProperties"); | 212 ScriptFunctionCall function(injectedScriptObject(), "getProperties"); |
| 213 function.appendArgument(objectId); | 213 function.appendArgument(objectId); |
| 214 function.appendArgument(ownProperties); | 214 function.appendArgument(ownProperties); |
| 215 function.appendArgument(accessorPropertiesOnly); | 215 function.appendArgument(accessorPropertiesOnly); |
| 216 | 216 |
| 217 RefPtr<JSONValue> result; | 217 RefPtr<JSONValue> result; |
| 218 makeCall(function, &result); | 218 makeCall(function, &result); |
| 219 if (!result || result->type() != JSONValue::TypeArray) { | 219 if (!result || result->type() != JSONValue::TypeArray) { |
| 220 *errorString = "Internal error"; | 220 *errorString = "Internal error"; |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 *properties = Array<PropertyDescriptor>::runtimeCast(result); | 223 *properties = Array<PropertyDescriptor>::runtimeCast(result); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void InjectedScript::getInternalProperties(ErrorString* errorString, const Strin
g& objectId, RefPtr<Array<InternalPropertyDescriptor> >* properties) | 226 void InjectedScript::getInternalProperties(ErrorString* errorString, const Strin
g& objectId, RefPtr<Array<InternalPropertyDescriptor>>* properties) |
| 227 { | 227 { |
| 228 ScriptFunctionCall function(injectedScriptObject(), "getInternalProperties")
; | 228 ScriptFunctionCall function(injectedScriptObject(), "getInternalProperties")
; |
| 229 function.appendArgument(objectId); | 229 function.appendArgument(objectId); |
| 230 | 230 |
| 231 RefPtr<JSONValue> result; | 231 RefPtr<JSONValue> result; |
| 232 makeCall(function, &result); | 232 makeCall(function, &result); |
| 233 if (!result || result->type() != JSONValue::TypeArray) { | 233 if (!result || result->type() != JSONValue::TypeArray) { |
| 234 *errorString = "Internal error"; | 234 *errorString = "Internal error"; |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 RefPtr<Array<InternalPropertyDescriptor> > array = Array<InternalPropertyDes
criptor>::runtimeCast(result); | 237 RefPtr<Array<InternalPropertyDescriptor>> array = Array<InternalPropertyDesc
riptor>::runtimeCast(result); |
| 238 if (array->length() > 0) | 238 if (array->length() > 0) |
| 239 *properties = array; | 239 *properties = array; |
| 240 } | 240 } |
| 241 | 241 |
| 242 Node* InjectedScript::nodeForObjectId(const String& objectId) | 242 Node* InjectedScript::nodeForObjectId(const String& objectId) |
| 243 { | 243 { |
| 244 if (isEmpty() || !canAccessInspectedWindow()) | 244 if (isEmpty() || !canAccessInspectedWindow()) |
| 245 return nullptr; | 245 return nullptr; |
| 246 | 246 |
| 247 ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId"); | 247 ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId"); |
| 248 function.appendArgument(objectId); | 248 function.appendArgument(objectId); |
| 249 | 249 |
| 250 bool hadException = false; | 250 bool hadException = false; |
| 251 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException
); | 251 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException
); |
| 252 ASSERT(!hadException); | 252 ASSERT(!hadException); |
| 253 | 253 |
| 254 return InjectedScriptHost::scriptValueAsNode(scriptState(), resultValue); | 254 return InjectedScriptHost::scriptValueAsNode(scriptState(), resultValue); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void InjectedScript::releaseObject(const String& objectId) | 257 void InjectedScript::releaseObject(const String& objectId) |
| 258 { | 258 { |
| 259 ScriptFunctionCall function(injectedScriptObject(), "releaseObject"); | 259 ScriptFunctionCall function(injectedScriptObject(), "releaseObject"); |
| 260 function.appendArgument(objectId); | 260 function.appendArgument(objectId); |
| 261 RefPtr<JSONValue> result; | 261 RefPtr<JSONValue> result; |
| 262 makeCall(function, &result); | 262 makeCall(function, &result); |
| 263 } | 263 } |
| 264 | 264 |
| 265 PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue&
callFrames, int asyncOrdinal) | 265 PassRefPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(const ScriptValue& c
allFrames, int asyncOrdinal) |
| 266 { | 266 { |
| 267 ASSERT(!isEmpty()); | 267 ASSERT(!isEmpty()); |
| 268 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); | 268 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); |
| 269 function.appendArgument(callFrames); | 269 function.appendArgument(callFrames); |
| 270 function.appendArgument(asyncOrdinal); | 270 function.appendArgument(asyncOrdinal); |
| 271 bool hadException = false; | 271 bool hadException = false; |
| 272 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep
tion); | 272 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep
tion); |
| 273 ASSERT(!hadException); | 273 ASSERT(!hadException); |
| 274 RefPtr<JSONValue> result = callFramesValue.toJSONValue(scriptState()); | 274 RefPtr<JSONValue> result = callFramesValue.toJSONValue(scriptState()); |
| 275 if (result && result->type() == JSONValue::TypeArray) | 275 if (result && result->type() == JSONValue::TypeArray) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 { | 365 { |
| 366 ASSERT(!isEmpty()); | 366 ASSERT(!isEmpty()); |
| 367 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte
rEnabled"); | 367 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte
rEnabled"); |
| 368 function.appendArgument(enabled); | 368 function.appendArgument(enabled); |
| 369 RefPtr<JSONValue> result; | 369 RefPtr<JSONValue> result; |
| 370 makeCall(function, &result); | 370 makeCall(function, &result); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace blink | 373 } // namespace blink |
| 374 | 374 |
| OLD | NEW |