summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/src/js')
-rw-r--r--WebKit/chromium/src/js/DevTools.js64
-rw-r--r--WebKit/chromium/src/js/InjectDispatch.js67
-rw-r--r--WebKit/chromium/src/js/Tests.js349
3 files changed, 4 insertions, 476 deletions
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js
index 895c68b..0fd66c9 100644
--- a/WebKit/chromium/src/js/DevTools.js
+++ b/WebKit/chromium/src/js/DevTools.js
@@ -34,22 +34,6 @@
* DevTools frontend together. It is also responsible for overriding existing
* WebInspector functionality while it is getting upstreamed into WebCore.
*/
-
-/**
- * Dispatches raw message from the host.
- * @param {string} remoteName
- * @prama {string} methodName
- * @param {string} param1, param2, param3 Arguments to dispatch.
- */
-devtools$$dispatch = 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);
-};
-
-
devtools.ToolsAgent = function()
{
this.profilerAgent_ = new devtools.ProfilerAgent();
@@ -75,30 +59,6 @@ devtools.tools = null;
var context = {}; // Used by WebCore's inspector routines.
-(function() {
- WebInspector._paramsObject = {};
-
- var queryParams = window.location.search;
- if (queryParams) {
- var params = queryParams.substring(1).split("&");
- for (var i = 0; i < params.length; ++i) {
- var pair = params[i].split("=");
- WebInspector._paramsObject[pair[0]] = pair[1];
- }
- }
- if ("page" in WebInspector._paramsObject) {
- WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page);
- 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");
- }
-})();
///////////////////////////////////////////////////////////////////////////////
// Here and below are overrides to existing WebInspector methods only.
// TODO(pfeldman): Patch WebCore and upstream changes.
@@ -114,24 +74,15 @@ WebInspector.loaded = function()
Preferences.profilerAlwaysEnabled = true;
Preferences.canEditScriptSource = true;
Preferences.onlineDetectionEnabled = false;
- if ("page" in WebInspector._paramsObject) {
- WebInspector.loadedDone = true;
- if (WebInspector.socketOpened)
- WebInspector.doLoadedDone();
- return;
- }
- WebInspector.doLoadedDone();
-}
-WebInspector.doLoadedDone = function() {
- oldLoaded.call(this);
+ oldLoaded.call(WebInspector);
}
devtools.domContentLoaded = function()
{
- WebInspector.setAttachedWindow(WebInspector._paramsObject.docked === "true");
- if (WebInspector._paramsObject.toolbar_color && WebInspector._paramsObject.text_color)
- WebInspector.setToolbarColors(WebInspector._paramsObject.toolbar_color, WebInspector._paramsObject.text_color);
+ WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true");
+ if (WebInspector.queryParamsObject.toolbar_color && WebInspector.queryParamsObject.text_color)
+ WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbar_color, WebInspector.queryParamsObject.text_color);
}
document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false);
@@ -243,10 +194,3 @@ WebInspector.resetToolbarColors = function()
if (window.RemoteDebuggerAgent) {
RemoteDebuggerAgent.setContextId = function() {};
}
-
-
-// Support for pause while renderer is busy (is dispatched on IO thread).
-InspectorBackend.pause = function()
-{
- RemoteDebuggerCommandExecutor.DebuggerPauseScript();
-};
diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js
deleted file mode 100644
index cda84e5..0000000
--- a/WebKit/chromium/src/js/InjectDispatch.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview Injects "injected" object into the inspectable page.
- */
-
-
-var InspectorControllerDispatcher = {};
-
-/**
- * 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.
- */
-InspectorControllerDispatcher.dispatch = function(functionName, json_args)
-{
- var params = JSON.parse(json_args);
- InspectorBackend[functionName].apply(InspectorBackend, params);
-};
-
-/**
- * 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) {
- var args = Array.prototype.slice.call(arguments);
- var call = JSON.stringify(args);
- DevToolsAgentHost.dispatch(call, method);
-};
-
-function close() {
- // This method is called when InspectorFrontend closes in layout tests.
-}
-
-function inspectedPageDestroyed() {
-}
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js
index 764f624..41574b4 100644
--- a/WebKit/chromium/src/js/Tests.js
+++ b/WebKit/chromium/src/js/Tests.js
@@ -1069,25 +1069,6 @@ TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callbac
/**
- * Performs sequence of steps.
- * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2,
- * action2,...,actionN].
- */
-TestSuite.prototype._performSteps = function(actions)
-{
- var test = this;
- var i = 0;
- function doNextAction() {
- if (i > 0)
- actions[i++]();
- if (i < actions.length - 1)
- test._waitForScriptPause(actions[i++], doNextAction);
- }
- doNextAction();
-};
-
-
-/**
* Waits until all the scripts are parsed and asynchronously executes the code
* in the inspected page.
*/
@@ -1128,131 +1109,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb
/**
- * Waits until all debugger scripts are parsed and executes "a()" in the
- * inspected page.
- */
-TestSuite.prototype._executeFunctionForStepTest = function()
-{
- this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]);
-};
-
-
-/**
- * Tests step over in the debugger.
- */
-TestSuite.prototype.testStepOver = function()
-{
- this.showPanel("scripts");
- var test = this;
-
- this._executeFunctionForStepTest();
-
- this._performSteps([
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 3,
- lineText: " debugger;"
- },
- function() {
- document.getElementById("scripts-step-over").click();
- },
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 5,
- lineText: " var y = fact(10);"
- },
- function() {
- document.getElementById("scripts-step-over").click();
- },
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 6,
- lineText: " return y;"
- },
- function() {
- test.releaseControl();
- }
- ]);
-
- test.takeControl();
-};
-
-
-/**
- * Tests step out in the debugger.
- */
-TestSuite.prototype.testStepOut = function()
-{
- this.showPanel("scripts");
- var test = this;
-
- this._executeFunctionForStepTest();
-
- this._performSteps([
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 3,
- lineText: " debugger;"
- },
- function() {
- document.getElementById("scripts-step-out").click();
- },
- {
- functionsOnStack: ["a",""],
- lineNumber: 8,
- lineText: " printResult(result);"
- },
- function() {
- test.releaseControl();
- }
- ]);
-
- test.takeControl();
-};
-
-
-/**
- * Tests step in in the debugger.
- */
-TestSuite.prototype.testStepIn = function()
-{
- this.showPanel("scripts");
- var test = this;
-
- this._executeFunctionForStepTest();
-
- this._performSteps([
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 3,
- lineText: " debugger;"
- },
- function() {
- document.getElementById("scripts-step-over").click();
- },
- {
- functionsOnStack: ["d","a",""],
- lineNumber: 5,
- lineText: " var y = fact(10);"
- },
- function() {
- document.getElementById("scripts-step-into").click();
- },
- {
- functionsOnStack: ["fact","d","a",""],
- lineNumber: 10,
- lineText: " var r = 1;"
- },
- function() {
- test.releaseControl();
- }
- ]);
-
- test.takeControl();
-};
-
-
-/**
* Gets a XPathResult matching given xpath.
* @param {string} xpath
* @param {number} resultType
@@ -1503,116 +1359,6 @@ TestSuite.prototype._hookGetPropertiesCallback = function(hook, code)
/**
- * Tests that all elements in prototype chain of an object have expected
- * intrinic proprties(__proto__, constructor, prototype).
- */
-TestSuite.prototype.testDebugIntrinsicProperties = function()
-{
- this.showPanel("scripts");
- var test = this;
-
- this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]);
-
- this._waitForScriptPause(
- {
- functionsOnStack: ["callDebugger", "handleClick", ""],
- lineNumber: 29,
- lineText: " debugger;"
- },
- expandLocalScope);
-
- var localScopeSection = null;
- function expandLocalScope() {
- test._expandScopeSections(function(sections, i) {
- if (i === 0) {
- test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local.");
- localScopeSection = sections[i];
- return true;
- }
- return false;
- },
- examineLocalScope);
- }
-
- function examineLocalScope() {
- var scopeExpectations = [
- "a", "Child", [
- "__proto__", "Child", [
- "__proto__", "Parent", [
- "__proto__", "Object", null,
- "constructor", "function Parent(n) {", [
- "name", '"Parent"', null,
- "prototype", 'Parent', [
- "parentProtoField", "11", null,
- ]
- ],
- "parentProtoField", "11", null,
- ],
- "constructor", "function Child(n) {", null,
- "childProtoField", "21", null,
- ],
-
- "parentField", "10", null,
- "childField", "20", null,
- ]
- ];
- checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations);
- }
-
- var propQueue = [];
- var index = 0;
- var expectedFinalIndex = 5;
-
- function expandAndCheckNextProperty() {
- if (index === propQueue.length) {
- test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects.");
- test.releaseControl();
- return;
- }
-
- // Read next property data from the queue.
- var treeElement = propQueue[index].treeElement;
- var path = propQueue[index].path;
- var expectations = propQueue[index].expectations;
- index++;
-
- // Expand the property.
- test._hookGetPropertiesCallback(function() {
- checkProperty(treeElement, path, expectations);
- },
- function() {
- treeElement.expand();
- });
- }
-
- function checkProperty(treeElement, path, expectations) {
- for (var i = 0; i < expectations.length; i += 3) {
- var name = expectations[i];
- var description = expectations[i+1];
- var value = expectations[i+2];
-
- var propertyPath = path + "." + name;
- var propertyTreeElement = test._findChildProperty(treeElement, name, path);
- test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.');
- test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.');
- if (value) {
- // Schedule property content check.
- propQueue.push({
- treeElement: propertyTreeElement,
- path: propertyPath,
- expectations: value,
- });
- }
- }
- // Check next property in the queue.
- expandAndCheckNextProperty();
- }
-
- test.takeControl();
-};
-
-
-/**
* Tests "Pause" button will pause debugger when a snippet is evaluated.
*/
TestSuite.prototype.testPauseInEval = function()
@@ -1647,101 +1393,6 @@ TestSuite.createKeyEvent = function(keyIdentifier)
/**
- * Tests console eval.
- */
-TestSuite.prototype.testConsoleEval = function()
-{
- var test = this;
- this.evaluateInConsole_("123",
- function(resultText) {
- test.assertEquals("123", resultText);
- test.releaseControl();
- });
-
- this.takeControl();
-};
-
-
-/**
- * Tests console log.
- */
-TestSuite.prototype.testConsoleLog = function()
-{
- WebInspector.showConsole();
- var messages = WebInspector.console.messages;
- var index = 0;
-
- var test = this;
- var assertNext = function(line, message, opt_class, opt_count, opt_substr) {
- var elem = messages[index++].toMessageElement();
- var clazz = elem.getAttribute("class");
- var expectation = (opt_count || '') + 'console_test_page.html:' + line + message;
- if (opt_substr)
- test.assertContains(elem.textContent, expectation);
- else
- test.assertEquals(expectation, elem.textContent);
- if (opt_class)
- test.assertContains(clazz, "console-" + opt_class);
- };
-
- assertNext("5", "log", "log-level");
- assertNext("7", "debug", "log-level");
- assertNext("9", "info", "log-level");
- assertNext("11", "warn", "warning-level");
- assertNext("13", "error", "error-level");
- assertNext("15", "Message format number 1, 2 and 3.5");
- assertNext("17", "Message format for string");
- assertNext("19", "Object Object");
- assertNext("22", "repeated", "log-level", 5);
- assertNext("26", "count: 1");
- assertNext("26", "count: 2");
- assertNext("29", "group", "group-title");
- index++;
- assertNext("33", "timer:", "log-level", "", true);
- assertNext("35", "1 2 3", "log-level");
- assertNext("37", "HTMLDocument", "log-level");
- assertNext("39", "<html>", "log-level", "", true);
-};
-
-
-/**
- * Tests eval of global objects.
- */
-TestSuite.prototype.testEvalGlobal = function()
-{
- WebInspector.showConsole();
-
- var inputs = ["foo", "foobar"];
- var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"];
-
- // Do not change code below - simply add inputs and expectations above.
- var initEval = function(input) {
- WebInspector.console.prompt.text = input;
- WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
- };
- var test = this;
- var messagesCount = 0;
- var inputIndex = 0;
- this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
- function(commandResult) {
- messagesCount++;
- if (messagesCount === expectations.length) {
- var messages = WebInspector.console.messages;
- for (var i = 0; i < expectations; ++i) {
- var elem = messages[i++].toMessageElement();
- test.assertEquals(elem.textContent, expectations[i]);
- }
- test.releaseControl();
- } else if (messagesCount % 2 === 0)
- initEval(inputs[inputIndex++]);
- }, true);
-
- initEval(inputs[inputIndex++]);
- this.takeControl();
-};
-
-
-/**
* Tests the message loop re-entrancy.
*/
TestSuite.prototype.testMessageLoopReentrant = function()