summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools
diff options
context:
space:
mode:
authoryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 10:12:11 +0000
committeryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 10:12:11 +0000
commitd58e172826d246e93777ba10087f73b63f206724 (patch)
tree9bcbafe4d100c4ae5cd0a57e871ae97aee8447eb /webkit/glue/devtools
parent4ab8b525667ffa2fbf64c12a2993e9e98996b9ec (diff)
downloadchromium_src-d58e172826d246e93777ba10087f73b63f206724.zip
chromium_src-d58e172826d246e93777ba10087f73b63f206724.tar.gz
chromium_src-d58e172826d246e93777ba10087f73b63f206724.tar.bz2
DevTools: prepare to injectiong inspector script into the inspected context.
BUG=29068 Review URL: http://codereview.chromium.org/552033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools')
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js6
-rw-r--r--webkit/glue/devtools/js/devtools.js35
-rw-r--r--webkit/glue/devtools/js/inject_dispatch.js16
-rw-r--r--webkit/glue/devtools/js/inspector_controller_impl.js36
-rw-r--r--webkit/glue/devtools/js/tests.js15
-rw-r--r--webkit/glue/devtools/tools_agent.h5
6 files changed, 91 insertions, 22 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index 407bc8b..e836e12 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -1049,7 +1049,8 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) {
for (var i = 0; i < stackFrame.scopes.length; i++) {
var scope = stackFrame.scopes[i];
scope.frameNumber = stackFrame.index;
- var scopeObjectProxy = new WebInspector.ObjectProxy(scope, [], 0, '', true);
+ var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], 0, '',
+ true);
scopeObjectProxy.isScope = true;
switch(scope.type) {
case ScopeType.Global:
@@ -1150,7 +1151,8 @@ devtools.DebuggerAgent.formatObjectProxy_ = function(v) {
} else {
description = '<unresolved ref: ' + v.ref + ', type: ' + v.type + '>';
}
- var proxy = new WebInspector.ObjectProxy(v, [], 0, description, hasChildren);
+ var proxy = new WebInspector.ObjectProxy(0, v, [], 0, description,
+ hasChildren);
proxy.type = v.type;
proxy.isV8Ref = true;
return proxy;
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 5e57609..b562a2f4 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -400,8 +400,15 @@ WebInspector.UIString = function(string) {
(function () {
-var orig = InjectedScriptAccess.getProperties;
-InjectedScriptAccess.getProperties = function(
+// TODO(yurys): get rid of the if once WebKit change is rolled.
+var accessor;
+if (InjectedScriptAccess.getDefault)
+ accessor = InjectedScriptAccess.prototype;
+else
+ accessor = InjectedScriptAccess;
+
+var orig = accessor.getProperties;
+accessor.getProperties = function(
objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
if (objectProxy.isScope) {
devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId,
@@ -416,8 +423,16 @@ InjectedScriptAccess.getProperties = function(
})();
-InjectedScriptAccess.evaluateInCallFrame = function(callFrameId, code,
- objectGroup, callback)
+(function() {
+// TODO(yurys): get rid of the if once WebKit change is rolled.
+var accessor;
+if (InjectedScriptAccess.getDefault)
+ accessor = InjectedScriptAccess.prototype;
+else
+ accessor = InjectedScriptAccess;
+
+accessor.evaluateInCallFrame = function(callFrameId, code,
+ objectGroup, callback)
{
//TODO(pfeldman): remove once 49084 is rolled.
if (!callback) {
@@ -426,6 +441,7 @@ InjectedScriptAccess.evaluateInCallFrame = function(callFrameId, code,
devtools.tools.getDebuggerAgent().evaluateInCallFrame(
callFrameId, code, callback);
};
+})();
WebInspector.resourceTrackingWasEnabled = function()
@@ -454,8 +470,15 @@ WebInspector.ConsoleMessage.prototype.setMessageBody = function(args) {
(function() {
-var orig = InjectedScriptAccess.getCompletions;
-InjectedScriptAccess.getCompletions = function(expressionString,
+// TODO(yurys): get rid of the if once WebKit change is rolled.
+var accessor;
+if (InjectedScriptAccess.getDefault)
+ accessor = InjectedScriptAccess.prototype;
+else
+ accessor = InjectedScriptAccess;
+
+var orig = accessor.getCompletions;
+accessor.getCompletions = function(expressionString,
includeInspectorCommandLineAPI, callFrameId, reportCompletions) {
if (goog.isDef(callFrameId)) {
devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(
diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js
index 151ddb2..f327c5a 100644
--- a/webkit/glue/devtools/js/inject_dispatch.js
+++ b/webkit/glue/devtools/js/inject_dispatch.js
@@ -83,6 +83,9 @@ function dispatch(method, var_args) {
};
+// TODO(yurys): remove once injected script lives in the inspected context
+if (this.InjectedScript) {
+
// Plugging into upstreamed support.
InjectedScript._window = function() {
return contentWindow;
@@ -95,12 +98,6 @@ InjectedScript.evaluateOnSelf = function(funcBody) {
};
-// Plugging into upstreamed support.
-Object.className = function(obj) {
- return (obj == null) ? "null" : obj.constructor.name;
-};
-
-
// TODO(pfeldman): Remove once Object.getOwnPropertyNames is implemented.
InjectedScript._getPropertyNames = function(object, resultSet)
{
@@ -108,6 +105,13 @@ InjectedScript._getPropertyNames = function(object, resultSet)
resultSet[name] = true;
}
+}
+
+// Plugging into upstreamed support.
+Object.className = function(obj) {
+ return (obj == null) ? "null" : obj.constructor.name;
+};
+
/**
* A no-op function that is called by debugger agent just to trigger v8
diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js
index 464477e..2e41017 100644
--- a/webkit/glue/devtools/js/inspector_controller_impl.js
+++ b/webkit/glue/devtools/js/inspector_controller_impl.js
@@ -33,6 +33,7 @@ devtools.InspectorBackendImpl = function() {
this.installInspectorControllerDelegate_('saveFrontendSettings');
this.installInspectorControllerDelegate_('setAttribute');
this.installInspectorControllerDelegate_('setDOMStorageItem');
+ this.installInspectorControllerDelegate_('setInjectedScriptSource');
this.installInspectorControllerDelegate_('setTextNodeValue');
this.installInspectorControllerDelegate_('startTimelineProfiler');
this.installInspectorControllerDelegate_('stopTimelineProfiler');
@@ -190,12 +191,43 @@ devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function() {
};
+// TODO(yurys): remove the if once WebKit change is rolled.
+if (InjectedScriptAccess.getDefault) {
+
/**
* @override
*/
-devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript =
- RemoteToolsAgent.DispatchOnInjectedScript.bind(RemoteToolsAgent);
+devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(
+ callId, injectedScriptId, methodName, argsString, async) {
+ // Encode injectedScriptId into callId
+ if (typeof injectedScriptId != 'number') {
+ injectedScriptId = 0;
+ }
+ RemoteToolsAgent.DispatchOnInjectedScript(
+ callId,
+ injectedScriptId,
+ methodName,
+ argsString,
+ async);
+};
+
+} else {
+
+/**
+ * @override
+ */
+devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(
+ callId, methodName, argsString, async) {
+ var injectedScriptId = 0;
+ RemoteToolsAgent.DispatchOnInjectedScript(
+ callId,
+ injectedScriptId,
+ methodName,
+ argsString,
+ async);
+};
+}
/**
* Installs delegating handler into the inspector controller.
diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js
index 3186b1b..f3b5caf 100644
--- a/webkit/glue/devtools/js/tests.js
+++ b/webkit/glue/devtools/js/tests.js
@@ -1593,10 +1593,17 @@ TestSuite.prototype._findChildProperty = function(
* @param {Function} code A code snippet to be executed.
*/
TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) {
- var orig = InjectedScriptAccess.getProperties;
- InjectedScriptAccess.getProperties = function(objectProxy,
+ // TODO(yurys): get rid of the if once WebKit change is rolled.
+ var accessor;
+ if (InjectedScriptAccess.getDefault)
+ accessor = InjectedScriptAccess.prototype;
+ else
+ accessor = InjectedScriptAccess;
+
+ var orig = accessor.getProperties;
+ accessor.getProperties = function(objectProxy,
ignoreHasOwnProperty, abbreviate, callback) {
- orig.call(InjectedScriptAccess, objectProxy, ignoreHasOwnProperty, abbreviate,
+ orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
function() {
callback.apply(this, arguments);
hook();
@@ -1605,7 +1612,7 @@ TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) {
try {
code();
} finally {
- InjectedScriptAccess.getProperties = orig;
+ accessor.getProperties = orig;
}
};
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index 02c6f5b..3f9e4ed 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -19,8 +19,9 @@
String /* function_name */, String /* json_args */) \
\
/* Dispatches given function on the InjectedScript object */ \
- METHOD4(DispatchOnInjectedScript, int /* call_id */, \
- String /* function_name */, String /* json_args */, bool /* async */) \
+ METHOD5(DispatchOnInjectedScript, int /* call_id */, \
+ int /* injected_script_id */, String /* function_name */, \
+ String /* json_args */, bool /* async */) \
\
/* Requests that the agent sends content of the resource with given id to the
delegate. */ \