| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void InjectedScriptBase::initialize(ScriptValue injectedScriptObject, InspectedS
tateAccessCheck 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 ASSERT(!isEmpty()); |
| 67 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); | 68 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 const ScriptValue& InjectedScriptBase::injectedScriptObject() const | 71 const ScriptValue& InjectedScriptBase::injectedScriptObject() const |
| 71 { | 72 { |
| 72 return m_injectedScriptObject; | 73 return m_injectedScriptObject; |
| 73 } | 74 } |
| 74 | 75 |
| 75 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const | 76 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const |
| 76 { | 77 { |
| 78 ASSERT(!isEmpty()); |
| 77 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); | 79 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); |
| 78 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall",
"data", InspectorFunctionCallEvent::data(executionContext, 0, name(), 1)); | 80 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()); | 81 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. | 82 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 81 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu
nction(executionContext, 0, name(), 1); | 83 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu
nction(executionContext, 0, name(), 1); |
| 82 | 84 |
| 83 ScriptState* scriptState = m_injectedScriptObject.scriptState(); | 85 ScriptState* scriptState = m_injectedScriptObject.scriptState(); |
| 84 bool evalIsDisabled = false; | 86 bool evalIsDisabled = false; |
| 85 if (scriptState) { | 87 if (scriptState) { |
| 86 evalIsDisabled = !scriptState->evalEnabled(); | 88 evalIsDisabled = !scriptState->evalEnabled(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { | 144 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { |
| 143 *errorString = "Internal error: result is not a pair of value and wasThr
own flag"; | 145 *errorString = "Internal error: result is not a pair of value and wasThr
own flag"; |
| 144 return; | 146 return; |
| 145 } | 147 } |
| 146 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); | 148 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); |
| 147 *wasThrown = wasThrownVal; | 149 *wasThrown = wasThrownVal; |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace WebCore | 152 } // namespace WebCore |
| 151 | 153 |
| OLD | NEW |