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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 | 273 |
274 PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames, int asyncOrdinal) | 274 PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames, int asyncOrdinal) |
275 { | 275 { |
276 ASSERT(!isEmpty()); | 276 ASSERT(!isEmpty()); |
277 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); | 277 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); |
278 function.appendArgument(callFrames); | 278 function.appendArgument(callFrames); |
279 function.appendArgument(asyncOrdinal); | 279 function.appendArgument(asyncOrdinal); |
280 bool hadException = false; | 280 bool hadException = false; |
281 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep tion); | 281 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep tion); |
282 ASSERT(!hadException); | 282 ASSERT(!hadException); |
283 RefPtr<JSONValue> result = callFramesValue.toJSONValue(scriptState()); | 283 RefPtr<JSONValue> result = toJSONValue(scriptState(), callFramesValue); |
haraken
2015/03/24 15:23:10
I think we are not in a ScriptState here. We need
| |
284 if (result && result->type() == JSONValue::TypeArray) | 284 if (result && result->type() == JSONValue::TypeArray) |
285 return Array<CallFrame>::runtimeCast(result); | 285 return Array<CallFrame>::runtimeCast(result); |
286 return Array<CallFrame>::create(); | 286 return Array<CallFrame>::create(); |
287 } | 287 } |
288 | 288 |
289 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) const | 289 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) const |
290 { | 290 { |
291 ASSERT(!isEmpty()); | 291 ASSERT(!isEmpty()); |
292 ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject"); | 292 ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject"); |
293 wrapFunction.appendArgument(value); | 293 wrapFunction.appendArgument(value); |
294 wrapFunction.appendArgument(groupName); | 294 wrapFunction.appendArgument(groupName); |
295 wrapFunction.appendArgument(canAccessInspectedWindow()); | 295 wrapFunction.appendArgument(canAccessInspectedWindow()); |
296 wrapFunction.appendArgument(generatePreview); | 296 wrapFunction.appendArgument(generatePreview); |
297 bool hadException = false; | 297 bool hadException = false; |
298 ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); | 298 ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); |
299 if (hadException) | 299 if (hadException) |
300 return nullptr; | 300 return nullptr; |
301 RefPtr<JSONObject> rawResult = r.toJSONValue(scriptState())->asObject(); | 301 RefPtr<JSONObject> rawResult = toJSONValue(scriptState(), r)->asObject(); |
haraken
2015/03/24 15:23:10
Ditto.
| |
302 return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); | 302 return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
303 } | 303 } |
304 | 304 |
305 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const S criptValue& table, const ScriptValue& columns) const | 305 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const S criptValue& table, const ScriptValue& columns) const |
306 { | 306 { |
307 ASSERT(!isEmpty()); | 307 ASSERT(!isEmpty()); |
308 ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapTable"); | 308 ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapTable"); |
309 wrapFunction.appendArgument(canAccessInspectedWindow()); | 309 wrapFunction.appendArgument(canAccessInspectedWindow()); |
310 wrapFunction.appendArgument(table); | 310 wrapFunction.appendArgument(table); |
311 if (columns.isEmpty()) | 311 if (columns.isEmpty()) |
312 wrapFunction.appendArgument(false); | 312 wrapFunction.appendArgument(false); |
313 else | 313 else |
314 wrapFunction.appendArgument(columns); | 314 wrapFunction.appendArgument(columns); |
315 bool hadException = false; | 315 bool hadException = false; |
316 ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); | 316 ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); |
317 if (hadException) | 317 if (hadException) |
318 return nullptr; | 318 return nullptr; |
319 RefPtr<JSONObject> rawResult = r.toJSONValue(scriptState())->asObject(); | 319 RefPtr<JSONObject> rawResult = toJSONValue(scriptState(), r)->asObject(); |
320 return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); | 320 return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
321 } | 321 } |
322 | 322 |
323 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapNode(Node* no de, const String& groupName) | 323 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapNode(Node* no de, const String& groupName) |
324 { | 324 { |
325 return wrapObject(nodeAsScriptValue(node), groupName); | 325 return wrapObject(nodeAsScriptValue(node), groupName); |
326 } | 326 } |
327 | 327 |
328 ScriptValue InjectedScript::findObjectById(const String& objectId) const | 328 ScriptValue InjectedScript::findObjectById(const String& objectId) const |
329 { | 329 { |
(...skipping 28 matching lines...) Expand all Loading... | |
358 { | 358 { |
359 ASSERT(!isEmpty()); | 359 ASSERT(!isEmpty()); |
360 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); | 360 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); |
361 function.appendArgument(enabled); | 361 function.appendArgument(enabled); |
362 RefPtr<JSONValue> result; | 362 RefPtr<JSONValue> result; |
363 makeCall(function, &result); | 363 makeCall(function, &result); |
364 } | 364 } |
365 | 365 |
366 } // namespace blink | 366 } // namespace blink |
367 | 367 |
OLD | NEW |