| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #endif | 68 #endif |
| 69 } | 69 } |
| 70 | 70 |
| 71 void InspectorInspectorAgent::trace(Visitor* visitor) | 71 void InspectorInspectorAgent::trace(Visitor* visitor) |
| 72 { | 72 { |
| 73 visitor->trace(m_inspectorController); | 73 visitor->trace(m_inspectorController); |
| 74 visitor->trace(m_injectedScriptManager); | 74 visitor->trace(m_injectedScriptManager); |
| 75 InspectorBaseAgent::trace(visitor); | 75 InspectorBaseAgent::trace(visitor); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void InspectorInspectorAgent::didClearDocumentOfWindowObject(LocalFrame* frame) | |
| 79 { | |
| 80 if (m_injectedScriptForOrigin.isEmpty()) | |
| 81 return; | |
| 82 | |
| 83 String origin = frame->document()->securityOrigin()->toRawString(); | |
| 84 String script = m_injectedScriptForOrigin.get(origin); | |
| 85 if (script.isEmpty()) | |
| 86 return; | |
| 87 int injectedScriptId = m_injectedScriptManager->injectedScriptIdFor(ScriptSt
ate::forMainWorld(frame)); | |
| 88 StringBuilder scriptSource; | |
| 89 scriptSource.append(script); | |
| 90 scriptSource.append('('); | |
| 91 scriptSource.appendNumber(injectedScriptId); | |
| 92 scriptSource.append(')'); | |
| 93 frame->script().executeScriptInMainWorld(scriptSource.toString()); | |
| 94 } | |
| 95 | |
| 96 void InspectorInspectorAgent::init() | 78 void InspectorInspectorAgent::init() |
| 97 { | 79 { |
| 98 m_instrumentingAgents->setInspectorInspectorAgent(this); | 80 m_instrumentingAgents->setInspectorInspectorAgent(this); |
| 99 } | 81 } |
| 100 | 82 |
| 101 void InspectorInspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend) | 83 void InspectorInspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend) |
| 102 { | 84 { |
| 103 m_frontend = inspectorFrontend->inspector(); | 85 m_frontend = inspectorFrontend->inspector(); |
| 104 } | 86 } |
| 105 | 87 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin
g& script) | 127 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin
g& script) |
| 146 { | 128 { |
| 147 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) { | 129 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) { |
| 148 m_frontend->evaluateForTestInFrontend(static_cast<int>(callId), script); | 130 m_frontend->evaluateForTestInFrontend(static_cast<int>(callId), script); |
| 149 m_frontend->flush(); | 131 m_frontend->flush(); |
| 150 } else { | 132 } else { |
| 151 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script))
; | 133 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script))
; |
| 152 } | 134 } |
| 153 } | 135 } |
| 154 | 136 |
| 155 void InspectorInspectorAgent::setInjectedScriptForOrigin(const String& origin, c
onst String& source) | |
| 156 { | |
| 157 m_injectedScriptForOrigin.set(origin, source); | |
| 158 } | |
| 159 | |
| 160 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj
ect> objectToInspect, PassRefPtr<JSONObject> hints) | 137 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj
ect> objectToInspect, PassRefPtr<JSONObject> hints) |
| 161 { | 138 { |
| 162 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled) && m_fro
ntend) { | 139 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled) && m_fro
ntend) { |
| 163 m_frontend->inspect(objectToInspect, hints); | 140 m_frontend->inspect(objectToInspect, hints); |
| 164 m_pendingInspectData.first = nullptr; | 141 m_pendingInspectData.first = nullptr; |
| 165 m_pendingInspectData.second = nullptr; | 142 m_pendingInspectData.second = nullptr; |
| 166 return; | 143 return; |
| 167 } | 144 } |
| 168 m_pendingInspectData.first = objectToInspect; | 145 m_pendingInspectData.first = objectToInspect; |
| 169 m_pendingInspectData.second = hints; | 146 m_pendingInspectData.second = hints; |
| 170 } | 147 } |
| 171 | 148 |
| 172 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |