Chromium Code Reviews| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 | 417 | 
| 418 void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) | 418 void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) | 
| 419 { | 419 { | 
| 420 ASSERT(!isEmpty()); | 420 ASSERT(!isEmpty()); | 
| 421 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); | 421 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); | 
| 422 function.appendArgument(enabled); | 422 function.appendArgument(enabled); | 
| 423 RefPtr<JSONValue> result; | 423 RefPtr<JSONValue> result; | 
| 424 makeCall(function, &result); | 424 makeCall(function, &result); | 
| 425 } | 425 } | 
| 426 | 426 | 
| 427 v8::Local<v8::Array> InjectedScript::frameworkUserEventListeners(v8::Local<v8::V alue> object) | |
| 428 { | |
| 429 ScriptValue result = callMethod("frameworkUserEventListeners", object); | |
| 430 return !result.isEmpty() ? result.v8Value().As<v8::Array>() : v8::Local<v8:: Array>(); | |
| 431 } | |
| 432 | |
| 433 v8::Local<v8::Set> InjectedScript::frameworkInternalEventHandlers(v8::Local<v8:: Value> object) | |
| 434 { | |
| 435 ScriptValue result = callMethod("frameworkInternalEventHandlers", object); | |
| 436 return !result.isEmpty() ? result.v8Value().As<v8::Set>() : v8::Local<v8::Se t>(); | |
| 437 } | |
| 438 | |
| 427 void InjectedScript::initialize(ScriptValue injectedScriptObject, InspectedState AccessCheck accessCheck) | 439 void InjectedScript::initialize(ScriptValue injectedScriptObject, InspectedState AccessCheck accessCheck) | 
| 428 { | 440 { | 
| 429 m_injectedScriptObject = injectedScriptObject; | 441 m_injectedScriptObject = injectedScriptObject; | 
| 430 m_inspectedStateAccessCheck = accessCheck; | 442 m_inspectedStateAccessCheck = accessCheck; | 
| 431 } | 443 } | 
| 432 | 444 | 
| 433 bool InjectedScript::canAccessInspectedWindow() const | 445 bool InjectedScript::canAccessInspectedWindow() const | 
| 434 { | 446 { | 
| 435 ASSERT(!isEmpty()); | 447 ASSERT(!isEmpty()); | 
| 436 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); | 448 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 v8::Local<v8::Message> message = tryCatch.Message(); | 543 v8::Local<v8::Message> message = tryCatch.Message(); | 
| 532 String text = !message.IsEmpty() ? toCoreStringWithUndefinedOrNullCheck( message->Get()) : "Internal error"; | 544 String text = !message.IsEmpty() ? toCoreStringWithUndefinedOrNullCheck( message->Get()) : "Internal error"; | 
| 533 *exceptionDetails = TypeBuilder::Debugger::ExceptionDetails::create().se tText(text); | 545 *exceptionDetails = TypeBuilder::Debugger::ExceptionDetails::create().se tText(text); | 
| 534 } else { | 546 } else { | 
| 535 *result = toJSONValue(resultValue); | 547 *result = toJSONValue(resultValue); | 
| 536 if (!*result) | 548 if (!*result) | 
| 537 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth)); | 549 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth)); | 
| 538 } | 550 } | 
| 539 } | 551 } | 
| 540 | 552 | 
| 553 ScriptValue InjectedScript::callMethod(String methodName, v8::Local<v8::Value> a rgument) | |
| 554 { | |
| 555 ScriptFunctionCall function(injectedScriptObject(), methodName); | |
| 556 function.appendArgument(argument); | |
| 557 bool hadException = false; | |
| 558 ScriptValue result = callFunctionWithEvalEnabled(function, hadException); | |
| 559 if (!hadException && !result.isEmpty()) | |
| 
 
yurys
2015/08/14 17:24:20
Can we simply return result.v8Value()?
 
kozy
2015/08/14 18:15:45
Done.
 
 | |
| 560 return result; | |
| 561 return ScriptValue(); | |
| 562 } | |
| 563 | |
| 541 } // namespace blink | 564 } // namespace blink | 
| 542 | 565 | 
| OLD | NEW |