OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 28 matching lines...) Expand all Loading... |
39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
40 #include "core/inspector/InjectedScript.h" | 40 #include "core/inspector/InjectedScript.h" |
41 #include "core/inspector/InjectedScriptManager.h" | 41 #include "core/inspector/InjectedScriptManager.h" |
42 #include "core/inspector/InspectorPageAgent.h" | 42 #include "core/inspector/InspectorPageAgent.h" |
43 #include "core/inspector/InstrumentingAgents.h" | 43 #include "core/inspector/InstrumentingAgents.h" |
44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
45 #include "platform/weborigin/SecurityOrigin.h" | 45 #include "platform/weborigin/SecurityOrigin.h" |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 PageRuntimeAgent::PageRuntimeAgent(InjectedScriptManager* injectedScriptManager,
ScriptDebugServer* scriptDebugServer, Page* page, InspectorPageAgent* pageAgent
) | 49 PageRuntimeAgent::PageRuntimeAgent(InjectedScriptManager* injectedScriptManager,
ScriptDebugServerBase* scriptDebugServer, Page* page, InspectorPageAgent* pageA
gent) |
50 : InspectorRuntimeAgent(injectedScriptManager, scriptDebugServer) | 50 : InspectorRuntimeAgent(injectedScriptManager, scriptDebugServer) |
51 , m_inspectedPage(page) | 51 , m_inspectedPage(page) |
52 , m_pageAgent(pageAgent) | 52 , m_pageAgent(pageAgent) |
53 , m_mainWorldContextCreated(false) | 53 , m_mainWorldContextCreated(false) |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 PageRuntimeAgent::~PageRuntimeAgent() | 57 PageRuntimeAgent::~PageRuntimeAgent() |
58 { | 58 { |
59 m_instrumentingAgents->setPageRuntimeAgent(0); | 59 m_instrumentingAgents->setPageRuntimeAgent(0); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 void PageRuntimeAgent::didCreateIsolatedContext(LocalFrame* frame, ScriptState*
scriptState, SecurityOrigin* origin) | 97 void PageRuntimeAgent::didCreateIsolatedContext(LocalFrame* frame, ScriptState*
scriptState, SecurityOrigin* origin) |
98 { | 98 { |
99 if (!m_enabled) | 99 if (!m_enabled) |
100 return; | 100 return; |
101 ASSERT(m_frontend); | 101 ASSERT(m_frontend); |
102 String frameId = m_pageAgent->frameId(frame); | 102 String frameId = m_pageAgent->frameId(frame); |
103 addExecutionContextToFrontend(scriptState, false, origin ? origin->toRawStri
ng() : "", frameId); | 103 addExecutionContextToFrontend(scriptState, false, origin ? origin->toRawStri
ng() : "", frameId); |
104 } | 104 } |
105 | 105 |
106 InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString* errorString,
const int* executionContextId) | 106 InjectedScript& PageRuntimeAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) |
107 { | 107 { |
108 if (!executionContextId) { | 108 if (!executionContextId) { |
109 ScriptState* scriptState = V8ScriptState::forMainWorld(m_inspectedPage->
mainFrame()); | 109 ScriptState* scriptState = V8ScriptState::forMainWorld(m_inspectedPage->
mainFrame()); |
110 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip
tState); | 110 InjectedScript& result = injectedScriptManager()->injectedScriptFor(scri
ptState); |
111 if (result.isEmpty()) | 111 if (result.isEmpty()) |
112 *errorString = "Internal error: main world execution context not fou
nd."; | 112 *errorString = "Internal error: main world execution context not fou
nd."; |
113 return result; | 113 return result; |
114 } | 114 } |
115 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); | 115 InjectedScript& injectedScript = injectedScriptManager()->injectedScriptForI
d(*executionContextId); |
116 if (injectedScript.isEmpty()) | 116 if (injectedScript.isEmpty()) |
117 *errorString = "Execution context with given id not found."; | 117 *errorString = "Execution context with given id not found."; |
118 return injectedScript; | 118 return injectedScript; |
119 } | 119 } |
120 | 120 |
121 void PageRuntimeAgent::muteConsole() | 121 void PageRuntimeAgent::muteConsole() |
122 { | 122 { |
123 FrameConsole::mute(); | 123 FrameConsole::mute(); |
124 } | 124 } |
125 | 125 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (scriptState->contextIsEmpty() || window == scriptState->domWindow())
{ | 180 if (scriptState->contextIsEmpty() || window == scriptState->domWindow())
{ |
181 scriptStatesToRemove.append(scriptState); | 181 scriptStatesToRemove.append(scriptState); |
182 m_frontend->executionContextDestroyed(it->value); | 182 m_frontend->executionContextDestroyed(it->value); |
183 } | 183 } |
184 } | 184 } |
185 m_scriptStateToId.removeAll(scriptStatesToRemove); | 185 m_scriptStateToId.removeAll(scriptStatesToRemove); |
186 } | 186 } |
187 | 187 |
188 } // namespace WebCore | 188 } // namespace WebCore |
189 | 189 |
OLD | NEW |