summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/js
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-07-30 10:46:49 +0100
committerKristian Monsen <kristianm@google.com>2010-08-04 13:01:34 +0100
commit0617145a89917ae7735fe1c9538688ab9a577df5 (patch)
tree56206078694427c37ed7bdf27eb5221398b833c0 /WebKit/chromium/src/js
parentef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff)
downloadexternal_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebKit/chromium/src/js')
-rw-r--r--WebKit/chromium/src/js/DebuggerScript.js6
-rw-r--r--WebKit/chromium/src/js/DevTools.js59
-rw-r--r--WebKit/chromium/src/js/DevToolsHostStub.js1
-rw-r--r--WebKit/chromium/src/js/InspectorControllerImpl.js161
4 files changed, 48 insertions, 179 deletions
diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js
index 7181d74..51787f6 100644
--- a/WebKit/chromium/src/js/DebuggerScript.js
+++ b/WebKit/chromium/src/js/DebuggerScript.js
@@ -32,6 +32,7 @@
var DebuggerScript = {};
DebuggerScript._breakpoints = {};
+DebuggerScript._breakpointsActivated = true;
DebuggerScript.PauseOnExceptionsState = {
DontPauseOnExceptions : 0,
@@ -82,7 +83,7 @@ DebuggerScript._formatScript = function(script)
scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld;
return {
id: script.id,
- name: script.name,
+ name: script.nameOrSourceURL(),
source: script.source,
lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset),
lineCount: script.lineCount(),
@@ -94,7 +95,7 @@ DebuggerScript.setBreakpoint = function(execState, args)
{
args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition);
- if (!args.enabled)
+ if (!args.enabled || !DebuggerScript._breakpointsActivated)
Debug.disableScriptBreakPoint(breakId);
var locations = Debug.findBreakPointActualLocations(breakId);
@@ -204,6 +205,7 @@ DebuggerScript.setBreakpointsActivated = function(execState, args)
else
Debug.disableScriptBreakPoint(breakId);
}
+ DebuggerScript._breakpointsActivated = args.enabled;
}
DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js
index 35cca2f..640474b 100644
--- a/WebKit/chromium/src/js/DevTools.js
+++ b/WebKit/chromium/src/js/DevTools.js
@@ -93,7 +93,7 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function()
*/
devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message)
{
- var args = JSON.parse(message);
+ var args = typeof message === "string" ? JSON.parse(message) : message;
var methodName = args[0];
var parameters = args.slice(1);
WebInspector[methodName].apply(WebInspector, parameters);
@@ -129,6 +129,28 @@ 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) { eval(message.data); }
+ WebInspector.socket.onerror = function(error) { console.err(error); }
+ WebInspector.socket.onopen = function() {
+ WebInspector.socketOpened = true;
+ if (WebInspector.loadedDone)
+ WebInspector.doLoadedDone();
+ };
+ }
+})();
///////////////////////////////////////////////////////////////////////////////
// Here and below are overrides to existing WebInspector methods only.
// TODO(pfeldman): Patch WebCore and upstream changes.
@@ -145,25 +167,25 @@ WebInspector.loaded = function()
Preferences.canEditScriptSource = true;
Preferences.appCacheEnabled = false;
- oldLoaded.call(this);
+ if ("page" in WebInspector._paramsObject) {
+ WebInspector.loadedDone = true;
+ if (WebInspector.socketOpened)
+ WebInspector.doLoadedDone();
+ return;
+ }
+ WebInspector.doLoadedDone();
+}
+WebInspector.doLoadedDone = function() {
+ oldLoaded.call(this);
InspectorFrontendHost.loaded();
-};
+}
devtools.domContentLoaded = function()
{
- var queryParams = window.location.search;
- if (queryParams) {
- var params = queryParams.substring(1).split("&");
- var paramsObject = {};
- for (var i = 0; i < params.length; ++i) {
- var pair = params[i].split("=");
- paramsObject[pair[0]] = pair[1];
- }
- WebInspector.setAttachedWindow(paramsObject.docked === "true");
- if (paramsObject.toolbar_color && paramsObject.text_color)
- WebInspector.setToolbarColors(paramsObject.toolbar_color, paramsObject.text_color);
- }
+ 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);
}
document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false);
@@ -275,3 +297,10 @@ 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/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js
index a2f356f..52b28bb 100644
--- a/WebKit/chromium/src/js/DevToolsHostStub.js
+++ b/WebKit/chromium/src/js/DevToolsHostStub.js
@@ -37,7 +37,6 @@ if (!window["RemoteDebuggerCommandExecutor"]) {
window["RemoteDebuggerCommandExecutor"] = {};
window["RemoteProfilerAgent"] = {};
window["RemoteToolsAgent"] = {
- dispatchOnInjectedScript: function() {},
dispatchOnInspectorController: function() {}
};
}
diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js
deleted file mode 100644
index 5ed506a..0000000
--- a/WebKit/chromium/src/js/InspectorControllerImpl.js
+++ /dev/null
@@ -1,161 +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 DevTools' implementation of the InspectorController API.
- */
-
-if (!this.devtools)
- devtools = {};
-
-devtools.InspectorBackendImpl = function()
-{
- WebInspector.InspectorBackendStub.call(this);
- this.installInspectorControllerDelegate_("addInspectedNode");
- this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad");
- 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");
- this.installInspectorControllerDelegate_("getChildNodes");
- this.installInspectorControllerDelegate_("getCookies");
- this.installInspectorControllerDelegate_("getDatabaseTableNames");
- this.installInspectorControllerDelegate_("getDOMStorageEntries");
- this.installInspectorControllerDelegate_("getEventListenersForNode");
- this.installInspectorControllerDelegate_("getOuterHTML");
- this.installInspectorControllerDelegate_("getProfile");
- this.installInspectorControllerDelegate_("getProfileHeaders");
- this.installInspectorControllerDelegate_("removeProfile");
- this.installInspectorControllerDelegate_("clearProfiles");
- this.installInspectorControllerDelegate_("getResourceContent");
- this.installInspectorControllerDelegate_("highlightDOMNode");
- this.installInspectorControllerDelegate_("hideDOMNodeHighlight");
- this.installInspectorControllerDelegate_("performSearch");
- this.installInspectorControllerDelegate_("pushNodeByPathToFrontend");
- this.installInspectorControllerDelegate_("releaseWrapperObjectGroup");
- this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad");
- this.installInspectorControllerDelegate_("reloadPage");
- this.installInspectorControllerDelegate_("removeAttribute");
- this.installInspectorControllerDelegate_("removeDOMStorageItem");
- this.installInspectorControllerDelegate_("removeNode");
- this.installInspectorControllerDelegate_("saveApplicationSettings");
- this.installInspectorControllerDelegate_("saveSessionSettings");
- this.installInspectorControllerDelegate_("searchCanceled");
- 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");
- this.installInspectorControllerDelegate_("getComputedStyle");
- this.installInspectorControllerDelegate_("getInlineStyle");
- this.installInspectorControllerDelegate_("getStyleSheet");
- this.installInspectorControllerDelegate_("getRuleRangesForStyleSheetId");
- this.installInspectorControllerDelegate_("applyStyleText");
- this.installInspectorControllerDelegate_("setStyleText");
- this.installInspectorControllerDelegate_("setStyleProperty");
- this.installInspectorControllerDelegate_("toggleStyleEnabled");
- this.installInspectorControllerDelegate_("setRuleSelector");
- this.installInspectorControllerDelegate_("addRule");
-
- this.installInspectorControllerDelegate_("disableDebugger");
- this.installInspectorControllerDelegate_("editScriptSource");
- this.installInspectorControllerDelegate_("getScriptSource");
- this.installInspectorControllerDelegate_("enableDebugger");
- this.installInspectorControllerDelegate_("setBreakpoint");
- this.installInspectorControllerDelegate_("removeBreakpoint");
- this.installInspectorControllerDelegate_("activateBreakpoints");
- this.installInspectorControllerDelegate_("deactivateBreakpoints");
- this.installInspectorControllerDelegate_("resume");
- this.installInspectorControllerDelegate_("stepIntoStatement");
- this.installInspectorControllerDelegate_("stepOutOfFunction");
- this.installInspectorControllerDelegate_("stepOverStatement");
- this.installInspectorControllerDelegate_("setPauseOnExceptionsState");
-};
-devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype;
-
-
-devtools.InspectorBackendImpl.prototype.pause = function()
-{
- RemoteDebuggerCommandExecutor.DebuggerPauseScript();
-};
-
-
-/**
- * @override
- */
-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);
-};
-
-
-/**
- * Installs delegating handler into the inspector controller.
- * @param {string} methodName Method to install delegating handler for.
- */
-devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_ = function(methodName)
-{
- this[methodName] = this.callInspectorController_.bind(this, methodName);
-};
-
-
-/**
- * Bound function with the installInjectedScriptDelegate_ actual
- * implementation.
- */
-devtools.InspectorBackendImpl.prototype.callInspectorController_ = function(methodName, var_arg)
-{
- var args = Array.prototype.slice.call(arguments, 1);
- RemoteToolsAgent.dispatchOnInspectorController(WebInspector.Callback.wrap(function(){}), methodName, JSON.stringify(args));
-};
-
-
-InspectorBackend = new devtools.InspectorBackendImpl();