diff options
author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebKit/chromium/src/js | |
parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebKit/chromium/src/js')
-rw-r--r-- | WebKit/chromium/src/js/DevTools.js | 71 | ||||
-rw-r--r-- | WebKit/chromium/src/js/DevToolsHostStub.js | 4 | ||||
-rw-r--r-- | WebKit/chromium/src/js/ProfilerAgent.js | 28 | ||||
-rw-r--r-- | WebKit/chromium/src/js/ProfilerProcessor.js | 2 | ||||
-rw-r--r-- | WebKit/chromium/src/js/Tests.js | 47 |
5 files changed, 61 insertions, 91 deletions
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 674f1d7..895c68b 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -41,44 +41,22 @@ * @prama {string} methodName * @param {string} param1, param2, param3 Arguments to dispatch. */ -devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) +devtools$$dispatch = function(message) { - remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8); - var agent = window[remoteName]; - if (!agent) { - debugPrint("No remote agent '" + remoteName + "' found."); - return; - } - var method = agent[methodName]; - if (!method) { - debugPrint("No method '" + remoteName + "." + methodName + "' found."); - return; - } - method.call(this, param1, param2, param3); + var args = typeof message === "string" ? JSON.parse(message) : message; + var methodName = args[0]; + var parameters = args.slice(1); + WebInspector[methodName].apply(WebInspector, parameters); }; devtools.ToolsAgent = function() { - RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; - RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); this.profilerAgent_ = new devtools.ProfilerAgent(); }; /** - * @param {string} script Script exression to be evaluated in the context of the - * inspected page. - * @param {function(Object|string, boolean):undefined} opt_callback Function to - * call with the result. - */ -devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback) -{ - InspectorBackend.evaluate(script, opt_callback || function() {}); -}; - - -/** * @return {devtools.ProfilerAgent} Profiler agent instance. */ devtools.ToolsAgent.prototype.getProfilerAgent = function() @@ -87,38 +65,6 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() }; -/** - * @param {string} message Serialized call to be dispatched on WebInspector. - * @private - */ -devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) -{ - var args = typeof message === "string" ? JSON.parse(message) : message; - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - -/** - * Evaluates js expression. - * @param {string} expr - */ -devtools.ToolsAgent.prototype.evaluate = function(expr) -{ - RemoteToolsAgent.evaluate(expr); -}; - - -/** - * Prints string to the inspector console or shows alert if the console doesn't - * exist. - * @param {string} text - */ -function debugPrint(text) { - WebInspector.log(text); -} - /** * Global instance of the tools agent. @@ -142,13 +88,15 @@ var context = {}; // Used by WebCore's inspector routines. } if ("page" in WebInspector._paramsObject) { WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); - WebInspector.socket.onmessage = function(message) { eval(message.data); } + WebInspector.socket.onmessage = function(message) { devtools$$dispatch(message.data); } WebInspector.socket.onerror = function(error) { console.err(error); } WebInspector.socket.onopen = function() { WebInspector.socketOpened = true; if (WebInspector.loadedDone) WebInspector.doLoadedDone(); }; + InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); + InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); } })(); /////////////////////////////////////////////////////////////////////////////// @@ -165,7 +113,7 @@ WebInspector.loaded = function() Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; - + Preferences.onlineDetectionEnabled = false; if ("page" in WebInspector._paramsObject) { WebInspector.loadedDone = true; if (WebInspector.socketOpened) @@ -177,7 +125,6 @@ WebInspector.loaded = function() WebInspector.doLoadedDone = function() { oldLoaded.call(this); - InspectorFrontendHost.loaded(); } devtools.domContentLoaded = function() diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index 52b28bb..d3333e2 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -35,8 +35,4 @@ if (!window["RemoteDebuggerCommandExecutor"]) { window["RemoteDebuggerCommandExecutor"] = {}; - window["RemoteProfilerAgent"] = {}; - window["RemoteToolsAgent"] = { - dispatchOnInspectorController: function() {} - }; } diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js index 0b65ace..7f74595 100644 --- a/WebKit/chromium/src/js/ProfilerAgent.js +++ b/WebKit/chromium/src/js/ProfilerAgent.js @@ -37,8 +37,6 @@ */ devtools.ProfilerAgent = function() { - RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this); - RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this); /** * Profiler log position. @@ -92,10 +90,17 @@ devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately) if (this._lastRequestedLogPosition == this._logPosition) return; var pos = this._lastRequestedLogPosition = this._logPosition; + + var callId = WebInspector.Callback.wrap(this._didGetProfilerLogLines.bind(this)); if (immediately) - RemoteProfilerAgent.getLogLines(pos); - else - setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500); + InspectorBackend.getProfilerLogLines(callId, pos); + else { + function delayedRequest() + { + InspectorBackend.getProfilerLogLines(callId, pos); + } + setTimeout(delayedRequest, 500); + } }; @@ -114,20 +119,11 @@ devtools.ProfilerAgent.prototype.startProfiling = function(modules) /** - * Handles current profiler status. - * @param {number} modules List of active (started) modules. - */ -devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules) -{ -}; - - -/** * Handles a portion of a profiler log retrieved by getLogLines call. * @param {number} pos Current position in log. * @param {string} log A portion of profiler log. */ -devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) +devtools.ProfilerAgent.prototype._didGetProfilerLogLines = function(pos, log) { this._logPosition = pos; if (log.length > 0) { @@ -138,3 +134,5 @@ devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) this._lastRequestedLogPosition = this._logPosition - 1; } }; + +WebInspector.didGetProfilerLogLines = WebInspector.Callback.processCallback; diff --git a/WebKit/chromium/src/js/ProfilerProcessor.js b/WebKit/chromium/src/js/ProfilerProcessor.js index f678d2c..61714e8 100644 --- a/WebKit/chromium/src/js/ProfilerProcessor.js +++ b/WebKit/chromium/src/js/ProfilerProcessor.js @@ -281,7 +281,7 @@ devtools.profiler.Processor.prototype.__proto__ = devtools.profiler.LogReader.pr */ devtools.profiler.Processor.prototype.printError = function(str) { - debugPrint(str); + WebInspector.log(str); }; diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index e2ab3b3..764f624 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -261,10 +261,10 @@ TestSuite.prototype.testEnableResourcesTab = function() var test = this; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { test.assertEquals("simple_page.html", payload.lastPathComponent); WebInspector.panels.resources.refresh(); - WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[identifier]); + WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[payload.id]); test.releaseControl(); }); @@ -289,10 +289,10 @@ TestSuite.prototype.testResourceContentLength = function() var png = false; var html = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { + function(payload) { if (!payload.didLengthChange) return; - var resource = WebInspector.resources[identifier]; + var resource = WebInspector.resources[payload.id]; if (!resource || !resource.url) return; if (resource.url.search("image.html") !== -1) { @@ -346,8 +346,8 @@ TestSuite.prototype.testResourceHeaders = function() var timingOk = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -393,8 +393,8 @@ TestSuite.prototype.testCachedResourceMimeType = function() var hasReloaded = false; this.addSniffer(WebInspector, "updateResource", - function(identifier, payload) { - var resource = this.resources[identifier]; + function(payload) { + var resource = this.resources[payload.id]; if (!resource || resource.mainResource) { // We are only interested in secondary resources in this test. return; @@ -1845,8 +1845,37 @@ uiTests.runAllTests = function() */ uiTests.runTest = function(name) { - new TestSuite().runTest(name); + if (uiTests._populatedInterface) + new TestSuite().runTest(name); + else + uiTests._pendingTestName = name; }; +(function() { + +function runTests() +{ + uiTests._populatedInterface = true; + var name = uiTests._pendingTestName; + delete uiTests._pendingTestName; + if (name) + new TestSuite().runTest(name); +} + +var oldShowElementsPanel = WebInspector.showElementsPanel; +WebInspector.showElementsPanel = function() +{ + oldShowElementsPanel.call(this); + runTests(); +} + +var oldShowPanel = WebInspector.showPanel; +WebInspector.showPanel = function(name) +{ + oldShowPanel.call(this, name); + runTests(); +} + +})(); } |