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 17 matching lines...) Expand all Loading... | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 | 33 |
34 #include "core/inspector/InjectedScript.h" | 34 #include "core/inspector/InjectedScript.h" |
35 | 35 |
36 #include "bindings/core/v8/ScriptFunctionCall.h" | 36 #include "bindings/core/v8/ScriptFunctionCall.h" |
37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
38 #include "bindings/core/v8/V8Node.h" | |
yurys
2015/08/12 21:56:03
Please don't add dependencies on Blink concepts in
| |
38 #include "core/inspector/InjectedScriptHost.h" | 39 #include "core/inspector/InjectedScriptHost.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
40 #include "core/inspector/InspectorTraceEvents.h" | 41 #include "core/inspector/InspectorTraceEvents.h" |
41 #include "core/inspector/JSONParser.h" | 42 #include "core/inspector/JSONParser.h" |
42 #include "core/inspector/RemoteObjectId.h" | 43 #include "core/inspector/RemoteObjectId.h" |
43 #include "platform/JSONValues.h" | 44 #include "platform/JSONValues.h" |
44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
45 | 46 |
46 using blink::TypeBuilder::Array; | 47 using blink::TypeBuilder::Array; |
47 using blink::TypeBuilder::Debugger::CallFrame; | 48 using blink::TypeBuilder::Debugger::CallFrame; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 return; | 328 return; |
328 RefPtr<JSONObject> object; | 329 RefPtr<JSONObject> object; |
329 if (!parsedObjectId->asObject(&object)) | 330 if (!parsedObjectId->asObject(&object)) |
330 return; | 331 return; |
331 int boundId = 0; | 332 int boundId = 0; |
332 if (!object->getNumber("id", &boundId)) | 333 if (!object->getNumber("id", &boundId)) |
333 return; | 334 return; |
334 m_native->unbind(boundId); | 335 m_native->unbind(boundId); |
335 } | 336 } |
336 | 337 |
338 v8::MaybeLocal<v8::Array> InjectedScript::frameworkEventListeners(v8::Local<v8:: Value> object) | |
339 { | |
340 v8::Isolate* isolate = injectedScriptObject().isolate(); | |
341 if (!object.IsEmpty() && V8Node::hasInstance(object, isolate)) { | |
yurys
2015/08/12 21:56:03
prefer early return
| |
342 ScriptFunctionCall function(injectedScriptObject(), "frameworkEventListe ners"); | |
343 function.appendArgument(object); | |
344 bool hadException = false; | |
345 ScriptValue result = callFunctionWithEvalEnabled(function, hadException) ; | |
346 if (!hadException && !result.isEmpty()) | |
347 return result.v8Value().As<v8::Array>(); | |
348 } | |
349 return v8::MaybeLocal<v8::Array>(); | |
350 } | |
351 | |
352 | |
353 v8::MaybeLocal<v8::Set> InjectedScript::frameworkEventHandlers(v8::Local<v8::Val ue> object) | |
yurys
2015/08/12 21:56:03
Please use Local<> instead as the exception is not
| |
354 { | |
355 v8::Isolate* isolate = injectedScriptObject().isolate(); | |
356 if (!object.IsEmpty() && V8Node::hasInstance(object, isolate)) { | |
357 ScriptFunctionCall function(injectedScriptObject(), "frameworkEventHandl ers"); | |
yurys
2015/08/12 21:56:03
Please extract common code into a method.
| |
358 function.appendArgument(object); | |
359 bool hadException = false; | |
360 ScriptValue result = callFunctionWithEvalEnabled(function, hadException) ; | |
361 if (!hadException && !result.isEmpty()) | |
362 return result.v8Value().As<v8::Set>(); | |
363 } | |
364 return v8::MaybeLocal<v8::Set>(); | |
365 } | |
366 | |
367 | |
337 PassRefPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object > callFrames, int asyncOrdinal) | 368 PassRefPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object > callFrames, int asyncOrdinal) |
338 { | 369 { |
339 ASSERT(!isEmpty()); | 370 ASSERT(!isEmpty()); |
340 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); | 371 ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); |
341 function.appendArgument(callFrames); | 372 function.appendArgument(callFrames); |
342 function.appendArgument(asyncOrdinal); | 373 function.appendArgument(asyncOrdinal); |
343 bool hadException = false; | 374 bool hadException = false; |
344 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep tion); | 375 ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadExcep tion); |
345 ASSERT(!hadException); | 376 ASSERT(!hadException); |
346 RefPtr<JSONValue> result = toJSONValue(callFramesValue); | 377 RefPtr<JSONValue> result = toJSONValue(callFramesValue); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 *exceptionDetails = TypeBuilder::Debugger::ExceptionDetails::create().se tText(text); | 564 *exceptionDetails = TypeBuilder::Debugger::ExceptionDetails::create().se tText(text); |
534 } else { | 565 } else { |
535 *result = toJSONValue(resultValue); | 566 *result = toJSONValue(resultValue); |
536 if (!*result) | 567 if (!*result) |
537 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth)); | 568 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth)); |
538 } | 569 } |
539 } | 570 } |
540 | 571 |
541 } // namespace blink | 572 } // namespace blink |
542 | 573 |
OLD | NEW |