| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 using WebCore::TypeBuilder::Runtime::RemoteObject; | 42 using WebCore::TypeBuilder::Runtime::RemoteObject; |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 InjectedScriptBase::InjectedScriptBase(const String& name) | 46 InjectedScriptBase::InjectedScriptBase(const String& name) |
| 47 : m_name(name) | 47 : m_name(name) |
| 48 , m_inspectedStateAccessCheck(0) | 48 , m_inspectedStateAccessCheck(0) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 InjectedScriptBase::InjectedScriptBase(const String& name, ScriptObject injected
ScriptObject, InspectedStateAccessCheck accessCheck) | 52 InjectedScriptBase::InjectedScriptBase(const String& name, ScriptValue injectedS
criptObject, InspectedStateAccessCheck accessCheck) |
| 53 : m_name(name) | 53 : m_name(name) |
| 54 , m_injectedScriptObject(injectedScriptObject) | 54 , m_injectedScriptObject(injectedScriptObject) |
| 55 , m_inspectedStateAccessCheck(accessCheck) | 55 , m_inspectedStateAccessCheck(accessCheck) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 void InjectedScriptBase::initialize(ScriptObject injectedScriptObject, Inspected
StateAccessCheck accessCheck) | 59 void InjectedScriptBase::initialize(ScriptValue injectedScriptObject, InspectedS
tateAccessCheck accessCheck) |
| 60 { | 60 { |
| 61 m_injectedScriptObject = injectedScriptObject; | 61 m_injectedScriptObject = injectedScriptObject; |
| 62 m_inspectedStateAccessCheck = accessCheck; | 62 m_inspectedStateAccessCheck = accessCheck; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool InjectedScriptBase::canAccessInspectedWindow() const | 65 bool InjectedScriptBase::canAccessInspectedWindow() const |
| 66 { | 66 { |
| 67 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); | 67 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 const ScriptObject& InjectedScriptBase::injectedScriptObject() const | 70 const ScriptValue& InjectedScriptBase::injectedScriptObject() const |
| 71 { | 71 { |
| 72 return m_injectedScriptObject; | 72 return m_injectedScriptObject; |
| 73 } | 73 } |
| 74 | 74 |
| 75 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const | 75 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const |
| 76 { | 76 { |
| 77 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); | 77 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); |
| 78 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall",
"data", InspectorFunctionCallEvent::data(executionContext, 0, name(), 1)); | 78 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall",
"data", InspectorFunctionCallEvent::data(executionContext, 0, name(), 1)); |
| 79 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 79 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
| 80 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 80 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { | 142 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { |
| 143 *errorString = "Internal error: result is not a pair of value and wasThr
own flag"; | 143 *errorString = "Internal error: result is not a pair of value and wasThr
own flag"; |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); | 146 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); |
| 147 *wasThrown = wasThrownVal; | 147 *wasThrown = wasThrownVal; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace WebCore | 150 } // namespace WebCore |
| 151 | 151 |
| OLD | NEW |