summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/js
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/devtools/js')
-rw-r--r--webkit/glue/devtools/js/devtools.js2
-rw-r--r--webkit/glue/devtools/js/devtools_host_stub.js81
-rw-r--r--webkit/glue/devtools/js/inject.js50
-rw-r--r--webkit/glue/devtools/js/inject_dispatch.js56
-rw-r--r--webkit/glue/devtools/js/inspector_controller_impl.js25
-rw-r--r--webkit/glue/devtools/js/profiler_processor.js11
6 files changed, 33 insertions, 192 deletions
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 5086f80..8e1cd80 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -35,7 +35,7 @@ devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) {
devtools.ToolsAgent = function() {
- RemoteToolsAgent.DidExecuteUtilityFunction =
+ RemoteToolsAgent.DidDispatchOn =
devtools.Callback.processCallback;
RemoteToolsAgent.FrameNavigate =
goog.bind(this.frameNavigate_, this);
diff --git a/webkit/glue/devtools/js/devtools_host_stub.js b/webkit/glue/devtools/js/devtools_host_stub.js
index 2f3da60..9a3c634 100644
--- a/webkit/glue/devtools/js/devtools_host_stub.js
+++ b/webkit/glue/devtools/js/devtools_host_stub.js
@@ -97,76 +97,11 @@ RemoteToolsAgentStub = function() {
};
-RemoteToolsAgentStub.prototype.HideDOMNodeHighlight = function() {
+RemoteToolsAgentStub.prototype.DispatchOnInjectedScript = function() {
};
-RemoteToolsAgentStub.prototype.HighlightDOMNode = function() {
-};
-
-
-RemoteToolsAgentStub.prototype.evaluate = function(expr) {
- window.eval(expr);
-};
-
-RemoteToolsAgentStub.prototype.EvaluateJavaScript = function(callId, script) {
- setTimeout(function() {
- var result = eval(script);
- RemoteToolsAgent.DidEvaluateJavaScript(callId, result);
- }, 0);
-};
-
-
-RemoteToolsAgentStub.prototype.ExecuteUtilityFunction = function(callId,
- functionName, args) {
- setTimeout(function() {
- var result = [];
- if (functionName == 'getProperties') {
- result = [
- 'undefined', 'undefined_key', undefined,
- 'string', 'string_key', 'value',
- 'function', 'func', undefined,
- 'array', 'array_key', [10],
- 'object', 'object_key', undefined,
- 'boolean', 'boolean_key', true,
- 'number', 'num_key', 911,
- 'date', 'date_key', new Date() ];
- } else if (functionName == 'getPrototypes') {
- result = ['Proto1', 'Proto2', 'Proto3'];
- } else if (functionName == 'getStyles') {
- result = {
- 'computedStyle' : [0, '0px', '0px', null, null, null, ['display', false, false, '', 'none']],
- 'inlineStyle' : [1, '0px', '0px', null, null, null, ['display', false, false, '', 'none']],
- 'styleAttributes' : {
- attr: [2, '0px', '0px', null, null, null, ['display', false, false, '', 'none']]
- },
- 'matchedCSSRules' : [
- { 'selector' : 'S',
- 'style' : [3, '0px', '0px', null, null, null, ['display', false, false, '', 'none']],
- 'parentStyleSheet' : { 'href' : 'http://localhost',
- 'ownerNodeName' : 'DIV' }
- }
- ]
- };
- } else if (functionName == 'toggleNodeStyle' ||
- functionName == 'applyStyleText' ||
- functionName == 'setStyleProperty') {
- alert(functionName + '(' + args + ')');
- } else if (functionName == 'evaluate') {
- try {
- result = [ window.eval(JSON.parse(args)[0]), false ];
- } catch (e) {
- result = [ e.toString(), true ];
- }
- } else if (functionName == 'InspectorController' ||
- functionName == 'InjectedScript') {
- // do nothing;
- } else {
- alert('Unexpected utility function:' + functionName);
- }
- RemoteToolsAgent.DidExecuteUtilityFunction(callId,
- JSON.stringify(result), '');
- }, 0);
+RemoteToolsAgentStub.prototype.DispatchOnInspectorController = function() {
};
@@ -174,17 +109,6 @@ RemoteToolsAgentStub.prototype.ExecuteVoidJavaScript = function() {
};
-RemoteToolsAgentStub.prototype.SetResourceTrackingEnabled = function(enabled, always) {
- RemoteToolsAgent.SetResourcesPanelEnabled(enabled);
- if (enabled) {
- WebInspector.resourceTrackingWasEnabled();
- } else {
- WebInspector.resourceTrackingWasDisabled();
- }
- addDummyResource();
-};
-
-
RemoteDebuggerAgentStub.ProfilerLogBuffer =
'profiler,begin,1\n' +
'profiler,resume\n' +
@@ -298,7 +222,6 @@ function addDummyResource() {
DevToolsHostStub.prototype.loaded = function() {
addDummyResource();
- uiTests.runAllTests();
};
diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js
deleted file mode 100644
index 8a9b199..0000000
--- a/webkit/glue/devtools/js/inject.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Javascript that is being injected into the inspectable page
- * while debugging.
- */
-goog.provide('devtools.Injected');
-
-
-/**
- * Main injected object.
- * @constructor.
- */
-devtools.Injected = function() {
-};
-
-
-/**
- * Dispatches given method with given args on the host object.
- * @param {string} method Method name.
- */
-devtools.Injected.prototype.InspectorController = function(method, var_args) {
- var args = Array.prototype.slice.call(arguments, 1);
- return InspectorController[method].apply(InspectorController, args);
-};
-
-
-/**
- * Dispatches given method with given args on the InjectedScript.
- * @param {string} method Method name.
- */
-devtools.Injected.prototype.InjectedScript = function(method, var_args) {
- var args = Array.prototype.slice.call(arguments, 1);
- var result = InjectedScript[method].apply(InjectedScript, args);
- return result;
-};
-
-
-// Plugging into upstreamed support.
-InjectedScript._window = function() {
- return contentWindow;
-};
-
-
-// Plugging into upstreamed support.
-Object.className = function(obj) {
- return (obj == null) ? "null" : obj.constructor.name;
-};
diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js
index 08f5ffb..16dd56f 100644
--- a/webkit/glue/devtools/js/inject_dispatch.js
+++ b/webkit/glue/devtools/js/inject_dispatch.js
@@ -6,47 +6,21 @@
* @fileoverview Injects 'injected' object into the inspectable page.
*/
-/**
- * Dispatches host calls into the injected function calls.
- */
-goog.require('devtools.Injected');
-
-/**
- * Injected singleton.
- */
-var devtools$$obj = new devtools.Injected();
+var InspectorControllerDispatcher = {};
/**
- * Main dispatch method, all calls from the host go through this one.
+ * Main dispatch method, all calls from the host to InspectorController go
+ * through this one.
* @param {string} functionName Function to call
* @param {string} json_args JSON-serialized call parameters.
* @return {string} JSON-serialized result of the dispatched call.
*/
-function devtools$$dispatch(functionName, json_args) {
+InspectorControllerDispatcher.dispatch = function(functionName, json_args) {
var params = JSON.parse(json_args);
- var result = devtools$$obj[functionName].apply(devtools$$obj, params);
- return JSON.stringify(result);
-}
-
-
-/**
- * Removes malicious functions from the objects so that the pure JSON.stringify
- * was used.
- */
-function sanitizeJson(obj) {
- for (var name in obj) {
- var property = obj[name];
- var type = typeof property;
- if (type === "function") {
- obj[name] = null;
- } else if (obj !== null && type === "object") {
- sanitizeJson(property);
- }
- }
- return obj;
-}
+ InspectorController[functionName].apply(InspectorController, params);
+};
/**
@@ -54,7 +28,7 @@ function sanitizeJson(obj) {
* We serialize the call and send it to the client over the IPC
* using dispatchOut bound method.
*/
-var dispatch = function(method, var_args) {
+function dispatch(method, var_args) {
// Handle all messages with non-primitieve arguments here.
var args = Array.prototype.slice.call(arguments);
@@ -67,14 +41,26 @@ var dispatch = function(method, var_args) {
return;
}
- var call = JSON.stringify(sanitizeJson(args));
+ var call = JSON.stringify(args);
DevToolsAgentHost.dispatch(call);
};
+// Plugging into upstreamed support.
+InjectedScript._window = function() {
+ return contentWindow;
+};
+
+
+// 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
* execution.
*/
function devtools$$void() {
-} \ No newline at end of file
+}
diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js
index 5bf19b7..f642194 100644
--- a/webkit/glue/devtools/js/inspector_controller_impl.js
+++ b/webkit/glue/devtools/js/inspector_controller_impl.js
@@ -240,14 +240,12 @@ devtools.InspectorControllerImpl.prototype.evaluateInCallFrame =
devtools.InspectorControllerImpl.prototype.dispatchOnInjectedScript = function(
callId, methodName, argsString) {
var callback = function(result, isException) {
- WebInspector.didDispatchOnInjectedScript(callId,
- isException ? result : JSON.parse(result),
- isException);
+ WebInspector.didDispatchOnInjectedScript(callId, result, isException);
};
- RemoteToolsAgent.ExecuteUtilityFunction(
+ RemoteToolsAgent.DispatchOnInjectedScript(
devtools.Callback.wrap(callback),
- 'InjectedScript',
- JSON.stringify(['dispatch', methodName, argsString]));
+ methodName,
+ argsString);
};
@@ -268,18 +266,11 @@ devtools.InspectorControllerImpl.prototype.installInspectorControllerDelegate_
*/
devtools.InspectorControllerImpl.prototype.callInspectorController_ =
function(methodName, var_arg) {
- var args = Array.prototype.slice.call(arguments);
- RemoteToolsAgent.ExecuteUtilityFunction(
+ var args = Array.prototype.slice.call(arguments, 1);
+ RemoteToolsAgent.DispatchOnInspectorController(
devtools.Callback.wrap(function(){}),
- 'InspectorController', JSON.stringify(args));
-};
-
-
-devtools.InspectorControllerImpl.parseWrap_ = function(callback) {
- return devtools.Callback.wrap(
- function(data) {
- callback.call(this, JSON.parse(data));
- });
+ methodName,
+ JSON.stringify(args));
};
diff --git a/webkit/glue/devtools/js/profiler_processor.js b/webkit/glue/devtools/js/profiler_processor.js
index 13aeee7..16b5d95 100644
--- a/webkit/glue/devtools/js/profiler_processor.js
+++ b/webkit/glue/devtools/js/profiler_processor.js
@@ -127,14 +127,6 @@ devtools.profiler.JsProfile.JS_NATIVE_FUNC_RE = /\ native\ \w+\.js:\d+$/;
*/
devtools.profiler.JsProfile.JS_NATIVE_SCRIPT_RE = /^Script:\ native/;
-/**
- * RegExp that filters out devtools functions. See inject.js and
- * inject_dispatch.js.
- * @type {RegExp}
- */
-devtools.profiler.JsProfile.JS_DEVTOOLS_FUNC_RE =
- /^\w+:\ devtools(\$\$|\.Injected)/;
-
/**
* @override
@@ -143,8 +135,7 @@ devtools.profiler.JsProfile.prototype.skipThisFunction = function(name) {
return !devtools.profiler.JsProfile.JS_FUNC_RE.test(name) ||
// To profile V8's natives comment out two lines below and '||' above.
devtools.profiler.JsProfile.JS_NATIVE_FUNC_RE.test(name) ||
- devtools.profiler.JsProfile.JS_NATIVE_SCRIPT_RE.test(name) ||
- devtools.profiler.JsProfile.JS_DEVTOOLS_FUNC_RE.test(name);
+ devtools.profiler.JsProfile.JS_NATIVE_SCRIPT_RE.test(name);
};