Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: inspector/InspectorBackend.cpp

Issue 542055: DevTools: injected script per context(WebCore part) (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « inspector/InspectorBackend.h ('k') | inspector/InspectorBackend.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 #if ENABLE(INSPECTOR) 33 #if ENABLE(INSPECTOR)
34 34
35 #if ENABLE(DATABASE) 35 #if ENABLE(DATABASE)
36 #include "Database.h" 36 #include "Database.h"
37 #endif 37 #endif
38 38
39 #include "Element.h" 39 #include "Element.h"
40 #include "Frame.h" 40 #include "Frame.h"
41 #include "FrameLoader.h" 41 #include "FrameLoader.h"
42 #include "HTMLFrameOwnerElement.h" 42 #include "HTMLFrameOwnerElement.h"
43 #include "InjectedScriptHost.h"
43 #include "InspectorClient.h" 44 #include "InspectorClient.h"
44 #include "InspectorController.h" 45 #include "InspectorController.h"
45 #include "InspectorDOMAgent.h" 46 #include "InspectorDOMAgent.h"
46 #include "InspectorFrontend.h" 47 #include "InspectorFrontend.h"
47 #include "InspectorResource.h" 48 #include "InspectorResource.h"
48 #include "Pasteboard.h" 49 #include "Pasteboard.h"
49 #include "ScriptArray.h" 50 #include "ScriptArray.h"
50 #include "ScriptFunctionCall.h" 51 #include "ScriptFunctionCall.h"
51 52
52 #if ENABLE(DOM_STORAGE) 53 #if ENABLE(DOM_STORAGE)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (m_inspectorController) 250 if (m_inspectorController)
250 m_inspectorController->getProfile(callId, uid); 251 m_inspectorController->getProfile(callId, uid);
251 } 252 }
252 253
253 JavaScriptCallFrame* InspectorBackend::currentCallFrame() const 254 JavaScriptCallFrame* InspectorBackend::currentCallFrame() const
254 { 255 {
255 return JavaScriptDebugServer::shared().currentCallFrame(); 256 return JavaScriptDebugServer::shared().currentCallFrame();
256 } 257 }
257 #endif 258 #endif
258 259
259 void InspectorBackend::dispatchOnInjectedScript(long callId, const String& metho dName, const String& arguments, bool async) 260 void InspectorBackend::setInjectedScriptSource(const String& source)
261 {
262 if (m_inspectorController)
263 m_inspectorController->injectedScriptHost()->setInjectedScriptSource(sou rce);
264 }
265
266 void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript Id, const String& methodName, const String& arguments, bool async)
260 { 267 {
261 InspectorFrontend* frontend = inspectorFrontend(); 268 InspectorFrontend* frontend = inspectorFrontend();
262 if (!frontend) 269 if (!frontend)
263 return; 270 return;
264 271
265 ScriptFunctionCall function(m_inspectorController->m_scriptState, m_inspecto rController->m_injectedScriptObj, "dispatch"); 272 // FIXME: explicitly pass injectedScriptId along with node id to the fronten d.
273 bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
274
275 ScriptObject injectedScript;
276 if (injectedScriptIdIsNodeId)
277 injectedScript = m_inspectorController->injectedScriptForNodeId(-injecte dScriptId);
278 else
279 injectedScript = m_inspectorController->injectedScriptHost()->injectedSc riptForId(injectedScriptId);
280
281 if (injectedScript.hasNoValue())
282 return;
283
284 ScriptFunctionCall function(injectedScript.scriptState(), injectedScript, "d ispatch");
266 function.appendArgument(methodName); 285 function.appendArgument(methodName);
267 function.appendArgument(arguments); 286 function.appendArgument(arguments);
268 if (async) 287 if (async)
269 function.appendArgument(callId); 288 function.appendArgument(callId);
270 bool hadException = false; 289 bool hadException = false;
271 ScriptValue result = function.call(hadException); 290 ScriptValue result = function.call(hadException);
272 if (async) 291 if (async)
273 return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript. 292 return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
274 if (hadException) 293 if (hadException)
275 frontend->didDispatchOnInjectedScript(callId, "", true); 294 frontend->didDispatchOnInjectedScript(callId, "", true);
276 else 295 else
277 frontend->didDispatchOnInjectedScript(callId, result.toString(m_inspecto rController->m_scriptState), false); 296 frontend->didDispatchOnInjectedScript(callId, result.toString(injectedSc ript.scriptState()), false);
278 } 297 }
279 298
280 void InspectorBackend::getChildNodes(long callId, long nodeId) 299 void InspectorBackend::getChildNodes(long callId, long nodeId)
281 { 300 {
282 if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) 301 if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
283 domAgent->getChildNodes(callId, nodeId); 302 domAgent->getChildNodes(callId, nodeId);
284 } 303 }
285 304
286 void InspectorBackend::setAttribute(long callId, long elementId, const String& n ame, const String& value) 305 void InspectorBackend::setAttribute(long callId, long elementId, const String& n ame, const String& value)
287 { 306 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 m_inspectorController->getCookies(callId); 383 m_inspectorController->getCookies(callId);
365 } 384 }
366 385
367 void InspectorBackend::deleteCookie(const String& cookieName, const String& doma in) 386 void InspectorBackend::deleteCookie(const String& cookieName, const String& doma in)
368 { 387 {
369 if (!m_inspectorController) 388 if (!m_inspectorController)
370 return; 389 return;
371 m_inspectorController->deleteCookie(cookieName, domain); 390 m_inspectorController->deleteCookie(cookieName, domain);
372 } 391 }
373 392
374 void InspectorBackend::releaseWrapperObjectGroup(const String& objectGroup) 393 void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const St ring& objectGroup)
375 { 394 {
376 if (m_inspectorController) 395 if (!m_inspectorController)
377 m_inspectorController->releaseWrapperObjectGroup(objectGroup); 396 return;
397 m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injec tedScriptId, objectGroup);
378 } 398 }
379 399
380 void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& j sonResult) 400 void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& j sonResult)
381 { 401 {
382 if (m_inspectorController) 402 if (m_inspectorController)
383 m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult); 403 m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult);
384 } 404 }
385 405
386 #if ENABLE(DATABASE) 406 #if ENABLE(DATABASE)
387 void InspectorBackend::getDatabaseTableNames(long callId, long databaseId) 407 void InspectorBackend::getDatabaseTableNames(long callId, long databaseId)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 Node* InspectorBackend::nodeForId(long nodeId) 457 Node* InspectorBackend::nodeForId(long nodeId)
438 { 458 {
439 if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) 459 if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
440 return domAgent->nodeForId(nodeId); 460 return domAgent->nodeForId(nodeId);
441 return 0; 461 return 0;
442 } 462 }
443 463
444 } // namespace WebCore 464 } // namespace WebCore
445 465
446 #endif // ENABLE(INSPECTOR) 466 #endif // ENABLE(INSPECTOR)
OLDNEW
« no previous file with comments | « inspector/InspectorBackend.h ('k') | inspector/InspectorBackend.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698