summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/js
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-06-28 16:42:48 +0100
committerKristian Monsen <kristianm@google.com>2010-07-02 10:29:56 +0100
commit06ea8e899e48f1f2f396b70e63fae369f2f23232 (patch)
tree20c1428cd05c76f32394ab354ea35ed99acd86d8 /WebKit/chromium/src/js
parent72aad67af14193199e29cdd5c4ddc095a8b9a8a8 (diff)
downloadexternal_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.zip
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.gz
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.bz2
Merge WebKit at r61871: Initial merge by git.
Change-Id: I6cff43abca9cc4782e088a469ad4f03f166a65d5
Diffstat (limited to 'WebKit/chromium/src/js')
-rw-r--r--WebKit/chromium/src/js/DebuggerAgent.js2
-rw-r--r--WebKit/chromium/src/js/DebuggerScript.js2
-rw-r--r--WebKit/chromium/src/js/DevTools.js71
-rw-r--r--WebKit/chromium/src/js/DevToolsHostStub.js277
-rw-r--r--WebKit/chromium/src/js/HeapProfilerPanel.js2
-rw-r--r--WebKit/chromium/src/js/InjectDispatch.js48
-rw-r--r--WebKit/chromium/src/js/InspectorControllerImpl.js39
-rw-r--r--WebKit/chromium/src/js/ProfilerAgent.js19
-rw-r--r--WebKit/chromium/src/js/Tests.js191
9 files changed, 148 insertions, 503 deletions
diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js
index 8d2457f..01d7627 100644
--- a/WebKit/chromium/src/js/DebuggerAgent.js
+++ b/WebKit/chromium/src/js/DebuggerAgent.js
@@ -1075,7 +1075,7 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame)
WebInspector.parsedScriptSource(sourceId, null, null, 0, WebInspector.Script.WorldType.MAIN_WORLD);
}
- var funcName = func.name || func.inferredName || "(anonymous function)";
+ var funcName = func.name || func.inferredName;
var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(stackFrame.line);
// Add basic scope chain info with scope variables.
diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js
index 3ff3eb7..baddb7d 100644
--- a/WebKit/chromium/src/js/DebuggerScript.js
+++ b/WebKit/chromium/src/js/DebuggerScript.js
@@ -219,8 +219,6 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
var functionName;
if (func)
functionName = func.name() || func.inferredName();
- if (!functionName)
- functionName = "[anonymous]";
// Get script ID.
var script = func.script();
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js
index 398d358..851c934 100644
--- a/WebKit/chromium/src/js/DevTools.js
+++ b/WebKit/chromium/src/js/DevTools.js
@@ -61,7 +61,6 @@ devtools$$dispatch = function(remoteName, methodName, param1, param2, param3)
devtools.ToolsAgent = function()
{
RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback;
- RemoteToolsAgent.frameNavigate = this.frameNavigate_.bind(this);
RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this);
this.debuggerAgent_ = new devtools.DebuggerAgent();
this.profilerAgent_ = new devtools.ProfilerAgent();
@@ -107,24 +106,14 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function()
};
-/**
- * @param {string} url Url frame navigated to.
- * @see tools_agent.h
- * @private
- */
-devtools.ToolsAgent.prototype.frameNavigate_ = function(url)
+(function () {
+var orig = WebInspector.reset;
+WebInspector.reset = function()
{
- this.reset();
- // Do not reset Profiles panel.
- var profiles = null;
- if ("profiles" in WebInspector.panels) {
- profiles = WebInspector.panels["profiles"];
- delete WebInspector.panels["profiles"];
- }
- WebInspector.reset();
- if (profiles !== null)
- WebInspector.panels["profiles"] = profiles;
+ devtools.tools.reset();
+ orig.call(this);
};
+})();
/**
@@ -302,31 +291,6 @@ WebInspector.UIString = function(string)
return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
};
-// Activate window upon node search complete. This will go away once InspectorFrontendClient is landed.
-(function() {
- var original = WebInspector.searchingForNodeWasDisabled;
- WebInspector.searchingForNodeWasDisabled = function()
- {
- if (this.panels.elements._nodeSearchButton.toggled)
- InspectorFrontendHost.bringToFront();
- original.apply(this, arguments);
- }
-})();
-
-
-// There is no clear way of setting frame title yet. So sniffing main resource
-// load.
-(function OverrideUpdateResource() {
- var originalUpdateResource = WebInspector.updateResource;
- WebInspector.updateResource = function(identifier, payload)
- {
- originalUpdateResource.call(this, identifier, payload);
- var resource = this.resources[identifier];
- if (resource && resource.mainResource && resource.finished)
- document.title = WebInspector.UIString("Developer Tools - %s", resource.url);
- };
-})();
-
/** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */
(function()
@@ -356,9 +320,10 @@ WebInspector.UIString = function(string)
})();
-// We need to have a place for postponed tasks
-// which should be executed when all the messages between agent and frontend
-// are processed.
+
+///////////////////////////////////////////
+// Chromium layout test harness support. //
+///////////////////////////////////////////
WebInspector.runAfterPendingDispatchesQueue = [];
@@ -375,19 +340,11 @@ WebInspector.queuesAreEmpty = function()
copy[i].call(this);
};
-(function()
-{
-var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame;
-InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element)
-{
- var resource = WebInspector.resources[identifier];
- if (!resource)
- return;
- originalAddToFrame.call(this, identifier, resource.mimeType, element);
-};
-})();
-// Chromium theme support.
+/////////////////////////////
+// Chromium theme support. //
+/////////////////////////////
+
WebInspector.setToolbarColors = function(backgroundColor, color)
{
if (!WebInspector._themeStyleElement) {
diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js
index da5929a..806bf6a 100644
--- a/WebKit/chromium/src/js/DevToolsHostStub.js
+++ b/WebKit/chromium/src/js/DevToolsHostStub.js
@@ -34,277 +34,8 @@
*/
if (!window["RemoteDebuggerAgent"]) {
-
-/**
- * FIXME: change field naming style to use trailing underscore.
- * @constructor
- */
-RemoteDebuggerAgentStub = function()
-{
-};
-
-
-RemoteDebuggerAgentStub.prototype.getContextId = function()
-{
- RemoteDebuggerAgent.setContextId(3);
-};
-
-
-RemoteDebuggerAgentStub.prototype.processDebugCommands = function()
-{
-};
-
-
-
-/**
- * @constructor
- */
-RemoteProfilerAgentStub = function()
-{
-};
-
-
-RemoteProfilerAgentStub.prototype.getActiveProfilerModules = function()
-{
- ProfilerStubHelper.GetInstance().getActiveProfilerModules();
-};
-
-
-RemoteProfilerAgentStub.prototype.getLogLines = function(pos)
-{
- ProfilerStubHelper.GetInstance().getLogLines(pos);
-};
-
-
-/**
- * @constructor
- */
-RemoteToolsAgentStub = function()
-{
-};
-
-
-RemoteToolsAgentStub.prototype.dispatchOnInjectedScript = function()
-{
-};
-
-
-RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function()
-{
-};
-
-
-/**
- * @constructor
- */
-ProfilerStubHelper = function()
-{
- this.activeProfilerModules_ = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
- this.heapProfSample_ = 0;
- this.log_ = '';
-};
-
-
-ProfilerStubHelper.GetInstance = function()
-{
- if (!ProfilerStubHelper.instance_)
- ProfilerStubHelper.instance_ = new ProfilerStubHelper();
- return ProfilerStubHelper.instance_;
-};
-
-
-ProfilerStubHelper.prototype.StopProfiling = function(modules)
-{
- this.activeProfilerModules_ &= ~modules;
-};
-
-
-ProfilerStubHelper.prototype.StartProfiling = function(modules)
-{
- var profModules = devtools.ProfilerAgent.ProfilerModules;
- if (modules & profModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
- if (modules & profModules.PROFILER_MODULE_HEAP_STATS) {
- this.log_ +=
- 'heap-sample-begin,"Heap","allocated",' +
- (new Date()).getTime() + '\n' +
- 'heap-sample-stats,"Heap","allocated",10000,1000\n';
- this.log_ +=
- 'heap-sample-item,STRING_TYPE,100,1000\n' +
- 'heap-sample-item,CODE_TYPE,10,200\n' +
- 'heap-sample-item,MAP_TYPE,20,350\n';
- this.log_ += ProfilerStubHelper.HeapSamples[this.heapProfSample_++];
- this.heapProfSample_ %= ProfilerStubHelper.HeapSamples.length;
- this.log_ += 'heap-sample-end,"Heap","allocated"\n';
- }
- } else {
- if (modules & profModules.PROFILER_MODULE_CPU)
- this.log_ += ProfilerStubHelper.ProfilerLogBuffer;
- this.activeProfilerModules_ |= modules;
- }
-};
-
-
-ProfilerStubHelper.prototype.getActiveProfilerModules = function()
-{
- var self = this;
- setTimeout(function() {
- RemoteProfilerAgent.didGetActiveProfilerModules(self.activeProfilerModules_);
- }, 100);
-};
-
-
-ProfilerStubHelper.prototype.getLogLines = function(pos)
-{
- var profModules = devtools.ProfilerAgent.ProfilerModules;
- var logLines = this.log_.substr(pos);
- setTimeout(function() {
- RemoteProfilerAgent.didGetLogLines(pos + logLines.length, logLines);
- }, 100);
-};
-
-
-ProfilerStubHelper.ProfilerLogBuffer =
- 'profiler,begin,1\n' +
- 'profiler,resume\n' +
- 'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' +
- 'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' +
- 'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' +
- 'tick,0x1010,0x0,3\n' +
- 'tick,0x2020,0x0,3,0x1010\n' +
- 'tick,0x2020,0x0,3,0x1010\n' +
- 'tick,0x3010,0x0,3,0x2020, 0x1010\n' +
- 'tick,0x2020,0x0,3,0x1010\n' +
- 'tick,0x2030,0x0,3,0x2020, 0x1010\n' +
- 'tick,0x2020,0x0,3,0x1010\n' +
- 'tick,0x1010,0x0,3\n' +
- 'profiler,pause\n';
-
-
-ProfilerStubHelper.HeapSamples = [
- 'heap-js-cons-item,foo,1,100\n' +
- 'heap-js-cons-item,bar,20,2000\n' +
- 'heap-js-cons-item,Object,5,100\n' +
- 'heap-js-ret-item,foo,bar;3\n' +
- 'heap-js-ret-item,bar,foo;5\n' +
- 'heap-js-ret-item,Object:0x1234,(roots);1\n',
-
- 'heap-js-cons-item,foo,2000,200000\n' +
- 'heap-js-cons-item,bar,10,1000\n' +
- 'heap-js-cons-item,Object,6,120\n' +
- 'heap-js-ret-item,foo,bar;7,Object:0x1234;10\n' +
- 'heap-js-ret-item,bar,foo;10,Object:0x1234;10\n' +
- 'heap-js-ret-item,Object:0x1234,(roots);1\n',
-
- 'heap-js-cons-item,foo,15,1500\n' +
- 'heap-js-cons-item,bar,15,1500\n' +
- 'heap-js-cons-item,Object,5,100\n' +
- 'heap-js-cons-item,Array,3,1000\n' +
- 'heap-js-ret-item,foo,bar;3,Array:0x5678;1\n' +
- 'heap-js-ret-item,bar,foo;5,Object:0x1234;8,Object:0x5678;2\n' +
- 'heap-js-ret-item,Object:0x1234,(roots);1,Object:0x5678;2\n' +
- 'heap-js-ret-item,Object:0x5678,(global property);3,Object:0x1234;5\n' +
- 'heap-js-ret-item,Array:0x5678,(global property);3,Array:0x5678;2\n',
-
- 'heap-js-cons-item,bar,20,2000\n' +
- 'heap-js-cons-item,Object,6,120\n' +
- 'heap-js-ret-item,bar,foo;5,Object:0x1234;1,Object:0x1235;3\n' +
- 'heap-js-ret-item,Object:0x1234,(global property);3\n' +
- 'heap-js-ret-item,Object:0x1235,(global property);5\n',
-
- 'heap-js-cons-item,foo,15,1500\n' +
- 'heap-js-cons-item,bar,15,1500\n' +
- 'heap-js-cons-item,Array,10,1000\n' +
- 'heap-js-ret-item,foo,bar;1,Array:0x5678;1\n' +
- 'heap-js-ret-item,bar,foo;5\n' +
- 'heap-js-ret-item,Array:0x5678,(roots);3\n',
-
- 'heap-js-cons-item,bar,20,2000\n' +
- 'heap-js-cons-item,baz,15,1500\n' +
- 'heap-js-ret-item,bar,baz;3\n' +
- 'heap-js-ret-item,baz,bar;3\n'
-];
-
-
-/**
- * @constructor
- */
-RemoteDebuggerCommandExecutorStub = function()
-{
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd)
-{
- if ('{"seq":2,"type":"request","command":"scripts","arguments":{"includeSource":false}}' === cmd) {
- var response1 =
- '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' +
- 'success":true,"body":[{"handle":61,"type":"script","name":"' +
- 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
- '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' +
- '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' +
- '"handle":60,"type":"context","data":"page,3"}],"running":false}';
- this.sendResponse_(response1);
- } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{"ids":[59],"includeSource":true}}' === cmd) {
- this.sendResponse_(
- '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' +
- '"success":true,"body":[{"handle":1,"type":"script","name":' +
- '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
- '"lineCount":1,"source":"function fib(n) {return n+1;}",' +
- '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' +
- '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' +
- '"running":false}');
- } else if (cmd.indexOf('"command":"profile"') !== -1) {
- var cmdObj = JSON.parse(cmd);
- if (cmdObj.arguments.command === "resume")
- ProfilerStubHelper.GetInstance().StartProfiling(parseInt(cmdObj.arguments.modules));
- else if (cmdObj.arguments.command === "pause")
- ProfilerStubHelper.GetInstance().StopProfiling(parseInt(cmdObj.arguments.modules));
- else
- debugPrint("Unexpected profile command: " + cmdObj.arguments.command);
- } else
- debugPrint("Unexpected command: " + cmd);
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript = function()
-{
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response)
-{
- setTimeout(function() {
- RemoteDebuggerAgent.debuggerOutput(response);
- }, 0);
-};
-
-
-DevToolsHostStub = function()
-{
- this.isStub = true;
-};
-DevToolsHostStub.prototype.__proto__ = WebInspector.InspectorFrontendHostStub.prototype;
-
-
-DevToolsHostStub.prototype.reset = function()
-{
-};
-
-
-DevToolsHostStub.prototype.setting = function()
-{
-};
-
-
-DevToolsHostStub.prototype.setSetting = function()
-{
-};
-
-
-window["RemoteDebuggerAgent"] = new RemoteDebuggerAgentStub();
-window["RemoteDebuggerCommandExecutor"] = new RemoteDebuggerCommandExecutorStub();
-window["RemoteProfilerAgent"] = new RemoteProfilerAgentStub();
-window["RemoteToolsAgent"] = new RemoteToolsAgentStub();
-InspectorFrontendHost = new DevToolsHostStub();
-
+ window["RemoteDebuggerAgent"] = { setDebuggerScriptSource: function() {} };
+ window["RemoteDebuggerCommandExecutor"] = {};
+ window["RemoteProfilerAgent"] = {};
+ window["RemoteToolsAgent"] = { dispatchOnInjectedScript: function() {} };
}
diff --git a/WebKit/chromium/src/js/HeapProfilerPanel.js b/WebKit/chromium/src/js/HeapProfilerPanel.js
index 0fc4418..bcb008f 100644
--- a/WebKit/chromium/src/js/HeapProfilerPanel.js
+++ b/WebKit/chromium/src/js/HeapProfilerPanel.js
@@ -932,7 +932,7 @@ WebInspector.HeapSnapshotProfileType.prototype = {
buttonClicked: function()
{
- InspectorBackend.takeHeapSnapshot();
+ devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT);
},
get welcomeMessage()
diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js
index 30caaf2..cda84e5 100644
--- a/WebKit/chromium/src/js/InjectDispatch.js
+++ b/WebKit/chromium/src/js/InjectDispatch.js
@@ -49,60 +49,14 @@ InspectorControllerDispatcher.dispatch = function(functionName, json_args)
};
/**
- * Special controller object for APU related messages. Outgoing messages
- * are sent to this object if the ApuAgentDispatcher is enabled.
- **/
-var ApuAgentDispatcher = { enabled : false };
-
-/**
- * Dispatches messages to APU. This filters and transforms
- * outgoing messages that are used by APU.
- * @param {string} method name of the dispatch method.
- **/
-ApuAgentDispatcher.dispatchToApu = function(method, args)
-{
- if (method !== "addRecordToTimeline" && method !== "updateResource" && method !== "addResource")
- return;
- // TODO(knorton): Transform args so they can be used
- // by APU.
- DevToolsAgentHost.dispatchToApu(JSON.stringify(args));
-};
-
-/**
* This is called by the InspectorFrontend for serialization.
* We serialize the call and send it to the client over the IPC
* using dispatchOut bound method.
*/
function dispatch(method, var_args) {
- // Handle all messages with non-primitieve arguments here.
var args = Array.prototype.slice.call(arguments);
-
- if (method === "inspectedWindowCleared" || method === "reset" || method === "setAttachedWindow") {
- // Filter out messages we don't need here.
- // We do it on the sender side since they may have non-serializable
- // parameters.
- return;
- }
-
- // Sniff some inspector controller state changes in order to support
- // cross-navigation instrumentation. Keep names in sync with
- // webdevtoolsagent_impl.
- if (method === "timelineProfilerWasStarted")
- DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", true);
- else if (method === "timelineProfilerWasStopped")
- DevToolsAgentHost.runtimeFeatureStateChanged("timeline-profiler", false);
- else if (method === "resourceTrackingWasEnabled")
- DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", true);
- else if (method === "resourceTrackingWasDisabled")
- DevToolsAgentHost.runtimeFeatureStateChanged("resource-tracking", false);
-
- if (ApuAgentDispatcher.enabled) {
- ApuAgentDispatcher.dispatchToApu(method, args);
- return;
- }
-
var call = JSON.stringify(args);
- DevToolsAgentHost.dispatch(call);
+ DevToolsAgentHost.dispatch(call, method);
};
function close() {
diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js
index 327ca8f..cbe607d 100644
--- a/WebKit/chromium/src/js/InspectorControllerImpl.js
+++ b/WebKit/chromium/src/js/InspectorControllerImpl.js
@@ -38,14 +38,18 @@ if (!this.devtools)
devtools.InspectorBackendImpl = function()
{
WebInspector.InspectorBackendStub.call(this);
+ this.installInspectorControllerDelegate_("addInspectedNode");
this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad");
- this.installInspectorControllerDelegate_("clearMessages");
+ this.installInspectorControllerDelegate_("changeTagName");
+ this.installInspectorControllerDelegate_("clearConsoleMessages");
this.installInspectorControllerDelegate_("copyNode");
this.installInspectorControllerDelegate_("deleteCookie");
this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend");
+ this.installInspectorControllerDelegate_("disableMonitoringXHR");
this.installInspectorControllerDelegate_("disableResourceTracking");
this.installInspectorControllerDelegate_("disableSearchingForNode");
this.installInspectorControllerDelegate_("disableTimeline");
+ this.installInspectorControllerDelegate_("enableMonitoringXHR");
this.installInspectorControllerDelegate_("enableResourceTracking");
this.installInspectorControllerDelegate_("enableSearchingForNode");
this.installInspectorControllerDelegate_("enableTimeline");
@@ -54,6 +58,7 @@ devtools.InspectorBackendImpl = function()
this.installInspectorControllerDelegate_("getDatabaseTableNames");
this.installInspectorControllerDelegate_("getDOMStorageEntries");
this.installInspectorControllerDelegate_("getEventListenersForNode");
+ this.installInspectorControllerDelegate_("getOuterHTML");
this.installInspectorControllerDelegate_("getProfile");
this.installInspectorControllerDelegate_("getProfileHeaders");
this.installInspectorControllerDelegate_("removeProfile");
@@ -62,6 +67,7 @@ devtools.InspectorBackendImpl = function()
this.installInspectorControllerDelegate_("highlightDOMNode");
this.installInspectorControllerDelegate_("hideDOMNodeHighlight");
this.installInspectorControllerDelegate_("performSearch");
+ this.installInspectorControllerDelegate_("pushNodeByPathToFrontend");
this.installInspectorControllerDelegate_("releaseWrapperObjectGroup");
this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad");
this.installInspectorControllerDelegate_("reloadPage");
@@ -74,12 +80,14 @@ devtools.InspectorBackendImpl = function()
this.installInspectorControllerDelegate_("setAttribute");
this.installInspectorControllerDelegate_("setDOMStorageItem");
this.installInspectorControllerDelegate_("setInjectedScriptSource");
+ this.installInspectorControllerDelegate_("setOuterHTML");
this.installInspectorControllerDelegate_("setTextNodeValue");
this.installInspectorControllerDelegate_("startProfiling");
this.installInspectorControllerDelegate_("startTimelineProfiler");
this.installInspectorControllerDelegate_("stopProfiling");
this.installInspectorControllerDelegate_("stopTimelineProfiler");
this.installInspectorControllerDelegate_("storeLastActivePanel");
+ this.installInspectorControllerDelegate_("takeHeapSnapshot");
this.installInspectorControllerDelegate_("getAllStyles");
this.installInspectorControllerDelegate_("getStyles");
@@ -113,24 +121,6 @@ devtools.InspectorBackendImpl = function()
devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype;
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.debuggerEnabled = function()
-{
- return true;
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.profilerEnabled = function()
-{
- return true;
-};
-
-
if (!window.v8ScriptDebugServerEnabled) {
devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition)
@@ -248,17 +238,6 @@ devtools.InspectorBackendImpl.prototype.pauseInDebugger = function()
/**
* @override
*/
-devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function()
-{
- devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT
- | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_STATS
- | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_JS_CONSTRUCTORS);
-};
-
-
-/**
- * @override
- */
devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(callId, injectedScriptId, methodName, argsString, async)
{
// Encode injectedScriptId into callId
diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js
index 29de4a3..0b65ace 100644
--- a/WebKit/chromium/src/js/ProfilerAgent.js
+++ b/WebKit/chromium/src/js/ProfilerAgent.js
@@ -105,12 +105,8 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately)
*/
devtools.ProfilerAgent.prototype.startProfiling = function(modules)
{
- var cmd = new devtools.DebugCommand("profile", {
- "modules": modules,
- "command": "resume"});
- devtools.DebuggerAgent.sendCommand_(cmd);
- RemoteDebuggerAgent.processDebugCommands();
if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
+ InspectorBackend.takeHeapSnapshot();
// Active modules will not change, instead, a snapshot will be logged.
this._getNextLogLines();
}
@@ -118,19 +114,6 @@ devtools.ProfilerAgent.prototype.startProfiling = function(modules)
/**
- * Stops profiling.
- */
-devtools.ProfilerAgent.prototype.stopProfiling = function(modules)
-{
- var cmd = new devtools.DebugCommand("profile", {
- "modules": modules,
- "command": "pause"});
- devtools.DebuggerAgent.sendCommand_(cmd);
- RemoteDebuggerAgent.processDebugCommands();
-};
-
-
-/**
* Handles current profiler status.
* @param {number} modules List of active (started) modules.
*/
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js
index fa910ab..893bc56 100644
--- a/WebKit/chromium/src/js/Tests.js
+++ b/WebKit/chromium/src/js/Tests.js
@@ -453,7 +453,7 @@ TestSuite.prototype.testProfilerTab = function()
setTimeout(findVisibleView, 0);
return;
}
- setTimeout(findDisplayedNode, 0);
+ setTimeout(findDisplayedNode, 0);
}
findVisibleView();
@@ -462,6 +462,51 @@ TestSuite.prototype.testProfilerTab = function()
/**
+ * Tests that heap profiler works.
+ */
+TestSuite.prototype.testHeapProfiler = function()
+{
+ this.showPanel("profiles");
+
+ var panel = WebInspector.panels.profiles;
+ var test = this;
+
+ function findDisplayedNode() {
+ var node = panel.visibleView.dataGrid.children[0];
+ if (!node) {
+ // Profile hadn't been queried yet, re-schedule.
+ window.setTimeout(findDisplayedNode, 100);
+ return;
+ }
+
+ // Iterate over displayed functions and find node called "A"
+ // If found, this will mean that we actually have taken heap snapshot.
+ while (node) {
+ if (node.constructorName.indexOf("A") !== -1) {
+ test.releaseControl();
+ return;
+ }
+ node = node.traverseNextNode(false, null, true);
+ }
+
+ test.fail();
+ }
+
+ function findVisibleView() {
+ if (!panel.visibleView) {
+ setTimeout(findVisibleView, 0);
+ return;
+ }
+ setTimeout(findDisplayedNode, 0);
+ }
+
+ WebInspector.HeapSnapshotProfileType.prototype.buttonClicked();
+ findVisibleView();
+ this.takeControl();
+};
+
+
+/**
* Tests that scripts tab can be open and populated with inspected scripts.
*/
TestSuite.prototype.testShowScriptsTab = function()
@@ -488,31 +533,19 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
var test = this;
this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one.");
- this.addSniffer(devtools.DebuggerAgent.prototype, "reset", waitUntilScriptIsParsed);
+ this.addSniffer(WebInspector.panels.scripts, "reset", waitUntilScriptIsParsed);
// Reload inspected page. It will reset the debugger agent.
test.evaluateInConsole_(
"window.location.reload(true);",
- function(resultText) {
- test.assertEquals("undefined", resultText, "Unexpected result of reload().");
- });
+ function(resultText) {});
function waitUntilScriptIsParsed() {
- var parsed = devtools.tools.getDebuggerAgent().parsedScripts_;
- for (var id in parsed) {
- var url = parsed[id].getUrl();
- if (url && url.search("debugger_test_page.html") !== -1) {
- checkScriptsPanel();
- return;
- }
- }
- test.addSniffer(devtools.DebuggerAgent.prototype, "addScriptInfo_", waitUntilScriptIsParsed);
- }
-
- function checkScriptsPanel() {
test.showPanel("scripts");
- test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Inspected script not found in the scripts list");
- test.releaseControl();
+ test._waitUntilScriptsAreParsed(["debugger_test_page.html"],
+ function() {
+ test.releaseControl();
+ });
}
// Wait until all scripts are added to the debugger.
@@ -603,7 +636,7 @@ TestSuite.prototype.testSetBreakpoint = function()
var test = this;
this.showPanel("scripts");
- var breakpointLine = 12;
+ var breakpointLine = 16
this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
function() {
@@ -611,15 +644,25 @@ TestSuite.prototype.testSetBreakpoint = function()
"debugger_test_page.html",
function(view, url) {
view._addBreakpoint(breakpointLine);
- // Force v8 execution.
- RemoteDebuggerAgent.processDebugCommands();
- test.waitForSetBreakpointResponse_(url, breakpointLine,
- function() {
- test.releaseControl();
+
+ test.evaluateInConsole_(
+ 'setTimeout("calculate()" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
});
});
});
+ this._waitForScriptPause(
+ {
+ functionsOnStack: ["calculate", ""],
+ lineNumber: breakpointLine,
+ lineText: " result = fib(lastVal++);"
+ },
+ function() {
+ test.releaseControl();
+ });
+
this.takeControl();
};
@@ -632,21 +675,13 @@ TestSuite.prototype.testPauseOnException = function()
this.showPanel("scripts");
var test = this;
- // TODO(yurys): remove else branch once the states are supported.
- if (WebInspector.ScriptsPanel.PauseOnExceptionsState) {
- while (WebInspector.currentPanel._pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions)
- WebInspector.currentPanel._pauseOnExceptionButton.element.click();
- } else {
- // Make sure pause on exceptions is on.
- if (!WebInspector.currentPanel._pauseOnExceptionButton.toggled)
- WebInspector.currentPanel._pauseOnExceptionButton.element.click();
- }
+ InspectorBackend.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]);
this._waitForScriptPause(
{
- functionsOnStack: ["throwAnException", "handleClick", "(anonymous function)"],
+ functionsOnStack: ["throwAnException", "handleClick", ""],
lineNumber: 6,
lineText: " return unknown_var;"
},
@@ -728,7 +763,7 @@ TestSuite.prototype.testPauseWhenScriptIsRunning = function()
test._waitForScriptPause(
{
- functionsOnStack: ["handleClick", "(anonymous function)"],
+ functionsOnStack: ["handleClick", ""],
lineNumber: 5,
lineText: " while(true) {"
},
@@ -861,36 +896,30 @@ TestSuite.prototype.testEvalOnCallFrame = function()
var breakpointLine = 16;
var test = this;
- this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
- function(msg) {
+ this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
+ function() {
test.showMainPageScriptSource_(
"debugger_test_page.html",
function(view, url) {
view._addBreakpoint(breakpointLine);
- // Force v8 execution.
- RemoteDebuggerAgent.processDebugCommands();
- test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback);
+
+ // Since breakpoints are ignored in evals' calculate() function is
+ // execute after zero-timeout so that the breakpoint is hit.
+ test.evaluateInConsole_(
+ 'setTimeout("calculate(123)" , 0)',
+ function(resultText) {
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ waitForBreakpointHit();
+ });
});
});
- function setBreakpointCallback() {
- // Since breakpoints are ignored in evals' calculate() function is
- // execute after zero-timeout so that the breakpoint is hit.
- test.evaluateInConsole_(
- 'setTimeout("calculate(123)" , 0)',
- function(resultText) {
- test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
- waitForBreakpointHit();
- });
- }
-
function waitForBreakpointHit() {
- test.addSniffer(
- devtools.DebuggerAgent.prototype,
- "handleBacktraceResponse_",
- function(msg) {
- test.assertEquals(2, this.callFrames_.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(msg));
- test.assertEquals("calculate", this.callFrames_[0].functionName, "Unexpected top frame function.");
+ test.addSniffer(WebInspector,
+ "pausedScript",
+ function(callFrames) {
+ test.assertEquals(2, callFrames.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(callFrames, null, 4));
+ test.assertEquals("calculate", callFrames[0].functionName, "Unexpected top frame function.");
// Evaluate "e+1" where "e" is an argument of "calculate" function.
test.evaluateInConsole_(
"e+1",
@@ -916,7 +945,7 @@ TestSuite.prototype.testCompletionOnPause = function()
this._waitForScriptPause(
{
- functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
+ functionsOnStack: ["innerFunction", "handleClick", ""],
lineNumber: 9,
lineText: " debugger;"
},
@@ -963,6 +992,9 @@ TestSuite.prototype.testCompletionOnPause = function()
*/
TestSuite.prototype.testAutoContinueOnSyntaxError = function()
{
+ if (window.v8ScriptDebugServerEnabled)
+ return;
+
this.showPanel("scripts");
var test = this;
@@ -978,6 +1010,7 @@ TestSuite.prototype.testAutoContinueOnSyntaxError = function()
}
}
+
this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
function(msg) {
checkScriptsList();
@@ -1140,7 +1173,7 @@ TestSuite.prototype._executeCodeWhenScriptsAreParsed = function(code, expectedSc
test.evaluateInConsole_(
'setTimeout("' + code + '" , 0)',
function(resultText) {
- test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+ test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText + ". Code: " + code);
});
}
@@ -1188,7 +1221,7 @@ TestSuite.prototype.testStepOver = function()
this._performSteps([
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 3,
lineText: " debugger;"
},
@@ -1196,7 +1229,7 @@ TestSuite.prototype.testStepOver = function()
document.getElementById("scripts-step-over").click();
},
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 5,
lineText: " var y = fact(10);"
},
@@ -1204,7 +1237,7 @@ TestSuite.prototype.testStepOver = function()
document.getElementById("scripts-step-over").click();
},
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 6,
lineText: " return y;"
},
@@ -1229,7 +1262,7 @@ TestSuite.prototype.testStepOut = function()
this._performSteps([
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 3,
lineText: " debugger;"
},
@@ -1237,7 +1270,7 @@ TestSuite.prototype.testStepOut = function()
document.getElementById("scripts-step-out").click();
},
{
- functionsOnStack: ["a","(anonymous function)"],
+ functionsOnStack: ["a",""],
lineNumber: 8,
lineText: " printResult(result);"
},
@@ -1262,7 +1295,7 @@ TestSuite.prototype.testStepIn = function()
this._performSteps([
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 3,
lineText: " debugger;"
},
@@ -1270,7 +1303,7 @@ TestSuite.prototype.testStepIn = function()
document.getElementById("scripts-step-over").click();
},
{
- functionsOnStack: ["d","a","(anonymous function)"],
+ functionsOnStack: ["d","a",""],
lineNumber: 5,
lineText: " var y = fact(10);"
},
@@ -1278,7 +1311,7 @@ TestSuite.prototype.testStepIn = function()
document.getElementById("scripts-step-into").click();
},
{
- functionsOnStack: ["fact","d","a","(anonymous function)"],
+ functionsOnStack: ["fact","d","a",""],
lineNumber: 10,
lineText: " var r = 1;"
},
@@ -1440,7 +1473,7 @@ TestSuite.prototype.testExpandScope = function()
this._waitForScriptPause(
{
- functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
+ functionsOnStack: ["innerFunction", "handleClick", ""],
lineNumber: 8,
lineText: " debugger;"
},
@@ -1463,14 +1496,14 @@ TestSuite.prototype.testExpandScope = function()
properties: {
x:"2009",
innerFunctionLocalVar:"2011",
- "this": "global",
+ "this": (window.v8ScriptDebugServerEnabled ? "DOMWindow" : "global"),
}
},
{
title: "Closure",
properties: {
- n:"TextParam",
- makeClosureLocalVar:"local.TextParam",
+ n: (window.v8ScriptDebugServerEnabled ? '"TextParam"' : "TextParam"),
+ makeClosureLocalVar: (window.v8ScriptDebugServerEnabled ? '"local.TextParam"' : "local.TextParam"),
}
},
{
@@ -1554,7 +1587,7 @@ TestSuite.prototype.testDebugIntrinsicProperties = function()
this._waitForScriptPause(
{
- functionsOnStack: ["callDebugger", "handleClick", "(anonymous function)"],
+ functionsOnStack: ["callDebugger", "handleClick", ""],
lineNumber: 29,
lineText: " debugger;"
},
@@ -1574,6 +1607,15 @@ TestSuite.prototype.testDebugIntrinsicProperties = function()
}
function examineLocalScope() {
+ if (window.v8ScriptDebugServerEnabled) {
+ var scopeExpectations = [
+ "a", "Child", [
+ "constructor", "function Child(n) {", null,
+ "parentField", "10", null,
+ "childField", "20", null,
+ ]
+ ];
+ } else {
var scopeExpectations = [
"a", "Object", [
"constructor", "function Child()", [
@@ -1606,13 +1648,14 @@ TestSuite.prototype.testDebugIntrinsicProperties = function()
"childField", 20, null,
]
];
+ }
checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations);
}
var propQueue = [];
var index = 0;
- var expectedFinalIndex = 8;
+ var expectedFinalIndex = (window.v8ScriptDebugServerEnabled ? 1 : 8);
function expandAndCheckNextProperty() {
if (index === propQueue.length) {