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()); | |
68 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); | 67 return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState()); |
69 } | 68 } |
70 | 69 |
71 const ScriptValue& InjectedScriptBase::injectedScriptObject() const | 70 const ScriptValue& InjectedScriptBase::injectedScriptObject() const |
72 { | 71 { |
73 return m_injectedScriptObject; | 72 return m_injectedScriptObject; |
74 } | 73 } |
75 | 74 |
76 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const | 75 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall&
function, bool& hadException) const |
77 { | 76 { |
78 ASSERT(!isEmpty()); | |
79 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); | 77 ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->e
xecutionContext(); |
80 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)); |
81 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()); |
82 // 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. |
83 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu
nction(executionContext, 0, name(), 1); | 81 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFu
nction(executionContext, 0, name(), 1); |
84 | 82 |
85 ScriptState* scriptState = m_injectedScriptObject.scriptState(); | 83 ScriptState* scriptState = m_injectedScriptObject.scriptState(); |
86 bool evalIsDisabled = false; | 84 bool evalIsDisabled = false; |
87 if (scriptState) { | 85 if (scriptState) { |
88 evalIsDisabled = !scriptState->evalEnabled(); | 86 evalIsDisabled = !scriptState->evalEnabled(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { | 142 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { |
145 *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"; |
146 return; | 144 return; |
147 } | 145 } |
148 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); | 146 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); |
149 *wasThrown = wasThrownVal; | 147 *wasThrown = wasThrownVal; |
150 } | 148 } |
151 | 149 |
152 } // namespace WebCore | 150 } // namespace WebCore |
153 | 151 |
OLD | NEW |