summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/front-end
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector/front-end')
-rw-r--r--WebCore/inspector/front-end/BreakpointManager.js65
-rw-r--r--WebCore/inspector/front-end/ElementsPanel.js3
-rw-r--r--WebCore/inspector/front-end/InjectedScript.js29
-rw-r--r--WebCore/inspector/front-end/InspectorBackendStub.js3
-rw-r--r--WebCore/inspector/front-end/Object.js14
-rw-r--r--WebCore/inspector/front-end/ScriptView.js2
-rw-r--r--WebCore/inspector/front-end/ScriptsPanel.js7
-rw-r--r--WebCore/inspector/front-end/SourceFrame.js12
-rw-r--r--WebCore/inspector/front-end/SourceView.js4
-rw-r--r--WebCore/inspector/front-end/TextViewer.js26
10 files changed, 87 insertions, 78 deletions
diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js
index 4f6965a..709a9c2 100644
--- a/WebCore/inspector/front-end/BreakpointManager.js
+++ b/WebCore/inspector/front-end/BreakpointManager.js
@@ -36,39 +36,36 @@ WebInspector.BreakpointManager.prototype = {
if (this._breakpoints[breakpoint.id])
return;
if (this._oneTimeBreakpoint)
- this._removeBreakpointFromBackend(this._oneTimeBreakpoint);
+ InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line);
this._oneTimeBreakpoint = breakpoint;
// FIXME(40669): one time breakpoint will be persisted in inspector settings if not hit.
- this._saveBreakpointOnBackend(breakpoint);
+ this._setBreakpointOnBackend(breakpoint, true);
},
removeOneTimeBreakpoint: function()
{
if (this._oneTimeBreakpoint) {
- this._removeBreakpointFromBackend(this._oneTimeBreakpoint);
+ InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line);
delete this._oneTimeBreakpoint;
}
},
- addBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+ setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
{
- var breakpoint = this._addBreakpoint(sourceID, sourceURL, line, enabled, condition);
+ var breakpoint = this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
if (breakpoint)
- this._saveBreakpointOnBackend(breakpoint);
+ this._setBreakpointOnBackend(breakpoint);
},
restoredBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
{
- this._addBreakpoint(sourceID, sourceURL, line, enabled, condition);
+ this._setBreakpoint(sourceID, sourceURL, line, enabled, condition);
},
removeBreakpoint: function(breakpoint)
{
- if (!(breakpoint.id in this._breakpoints))
- return;
- delete this._breakpoints[breakpoint.id];
- this._removeBreakpointFromBackend(breakpoint);
- this.dispatchEventToListeners("breakpoint-removed", breakpoint);
+ if (this._removeBreakpoint(breakpoint))
+ InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
},
breakpointsForSourceID: function(sourceID)
@@ -97,7 +94,7 @@ WebInspector.BreakpointManager.prototype = {
delete this._oneTimeBreakpoint;
},
- _addBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
+ _setBreakpoint: function(sourceID, sourceURL, line, enabled, condition)
{
var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition);
if (this._breakpoints[breakpoint.id])
@@ -109,14 +106,36 @@ WebInspector.BreakpointManager.prototype = {
return breakpoint;
},
- _saveBreakpointOnBackend: function(breakpoint)
- {
- InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
- },
-
- _removeBreakpointFromBackend: function(breakpoint)
+ _removeBreakpoint: function(breakpoint)
{
- InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
+ if (!(breakpoint.id in this._breakpoints))
+ return false;
+ breakpoint.removeAllListeners();
+ delete breakpoint._breakpointManager;
+ delete this._breakpoints[breakpoint.id];
+ this.dispatchEventToListeners("breakpoint-removed", breakpoint);
+ return true;
+ },
+
+ _setBreakpointOnBackend: function(breakpoint, isOneTime)
+ {
+ function didSetBreakpoint(success, line)
+ {
+ if (success && line == breakpoint.line)
+ return;
+ if (isOneTime) {
+ if (success)
+ this._oneTimeBreakpoint.line = line;
+ else
+ delete this._oneTimeBreakpoint;
+ } else {
+ this._removeBreakpoint(breakpoint);
+ if (success)
+ this._setBreakpoint(breakpoint.sourceID, breakpoint.sourceURL, line, breakpoint.enabled, breakpoint.condition);
+ }
+ }
+ var callbackId = WebInspector.Callback.wrap(didSetBreakpoint.bind(this));
+ InspectorBackend.setBreakpoint(callbackId, breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
}
}
@@ -145,7 +164,7 @@ WebInspector.Breakpoint.prototype = {
return;
this._enabled = x;
- this._breakpointManager._saveBreakpointOnBackend(this);
+ this._breakpointManager._setBreakpointOnBackend(this);
if (this._enabled)
this.dispatchEventToListeners("enabled");
else
@@ -187,9 +206,11 @@ WebInspector.Breakpoint.prototype = {
this._condition = c;
if (this.enabled)
- this._breakpointManager._saveBreakpointOnBackend(this);
+ this._breakpointManager._setBreakpointOnBackend(this);
this.dispatchEventToListeners("condition-changed");
}
}
WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.didSetBreakpoint = WebInspector.Callback.processCallback;
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index c8eb3dd..e176112 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -1028,7 +1028,8 @@ WebInspector.ElementsPanel.prototype = {
updateStyles: function(forceUpdate)
{
var stylesSidebarPane = this.sidebarPanes.styles;
- if (!stylesSidebarPane.expanded || !stylesSidebarPane.needsUpdate)
+ var computedStylePane = this.sidebarPanes.computedStyle;
+ if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate)
return;
stylesSidebarPane.update(this.focusedDOMNode, null, forceUpdate);
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 26495e8..5d9d065 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -121,27 +121,6 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbre
if (!ignoreHasOwnProperty && object.__proto__)
propertyNames.push("__proto__");
- if (jsEngine === "v8") {
- // Check if the object is a scope.
- if (InjectedScript._isScopeProxy(objectProxy)) {
- propertyNames = [];
- for (var name in object)
- propertyNames.push(name);
- } else {
- // FIXME(http://crbug.com/41243): Object.getOwnPropertyNames may return duplicated names.
- var a = [];
- propertyNames.sort();
- var prev;
- for (var i = 0; i < propertyNames.length; i++) {
- var n = propertyNames[i];
- if (n != prev)
- a.push(n);
- prev = n;
- }
- propertyNames = a;
- }
- }
-
// Go over properties, prepare results.
for (var i = 0; i < propertyNames.length; ++i) {
var propertyName = propertyNames[i];
@@ -171,12 +150,6 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbre
return properties;
}
-InjectedScript._isScopeProxy = function(objectProxy)
-{
- var objectId = objectProxy.objectId;
- return typeof objectId === "object" && !objectId.thisObject;
-}
-
InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression)
{
var object = InjectedScript._resolveObject(objectProxy);
@@ -217,7 +190,7 @@ InjectedScript._populatePropertyNames = function(object, resultSet)
try {
var names = Object.getOwnPropertyNames(o);
for (var i = 0; i < names.length; ++i)
- resultSet[names[i] + ""] = true;
+ resultSet[names[i]] = true;
} catch (e) {
}
}
diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js
index 1ae32b5..761e876 100644
--- a/WebCore/inspector/front-end/InspectorBackendStub.js
+++ b/WebCore/inspector/front-end/InspectorBackendStub.js
@@ -165,8 +165,9 @@ WebInspector.InspectorBackendStub.prototype = {
WebInspector.debuggerWasDisabled();
},
- setBreakpoint: function(sourceID, line, enabled, condition)
+ setBreakpoint: function(callId, sourceID, line, enabled, condition)
{
+ WebInspector.didSetBreakpoint(callId, true, line);
},
removeBreakpoint: function(sourceID, line)
diff --git a/WebCore/inspector/front-end/Object.js b/WebCore/inspector/front-end/Object.js
index 27e2144..5872b8b 100644
--- a/WebCore/inspector/front-end/Object.js
+++ b/WebCore/inspector/front-end/Object.js
@@ -27,7 +27,8 @@ WebInspector.Object = function() {
}
WebInspector.Object.prototype = {
- addEventListener: function(eventType, listener, thisObject) {
+ addEventListener: function(eventType, listener, thisObject)
+ {
if (!("_listeners" in this))
this._listeners = {};
if (!(eventType in this._listeners))
@@ -35,7 +36,8 @@ WebInspector.Object.prototype = {
this._listeners[eventType].push({ thisObject: thisObject, listener: listener });
},
- removeEventListener: function(eventType, listener, thisObject) {
+ removeEventListener: function(eventType, listener, thisObject)
+ {
if (!("_listeners" in this) || !(eventType in this._listeners))
return;
var listeners = this._listeners[eventType];
@@ -50,7 +52,13 @@ WebInspector.Object.prototype = {
delete this._listeners[eventType];
},
- dispatchEventToListeners: function(eventType, eventData) {
+ removeAllListeners: function()
+ {
+ delete this._listeners;
+ },
+
+ dispatchEventToListeners: function(eventType, eventData)
+ {
if (!("_listeners" in this) || !(eventType in this._listeners))
return;
diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js
index 1883fb3..c576510 100644
--- a/WebCore/inspector/front-end/ScriptView.js
+++ b/WebCore/inspector/front-end/ScriptView.js
@@ -96,7 +96,7 @@ WebInspector.ScriptView.prototype = {
_addBreakpoint: function(line)
{
- WebInspector.breakpointManager.addBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, "");
+ WebInspector.breakpointManager.setBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, "");
},
_editLineComplete: function(newBody)
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index c23db14..5563b93 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -224,9 +224,9 @@ WebInspector.ScriptsPanel.prototype = {
hide: function()
{
- WebInspector.Panel.prototype.hide.call(this);
if (this.visibleView)
this.visibleView.hide();
+ WebInspector.Panel.prototype.hide.call(this);
},
get searchableViews()
@@ -364,9 +364,10 @@ WebInspector.ScriptsPanel.prototype = {
}
for (var i = 0; i < breakpoints.length; ++i) {
var breakpoint = breakpoints[i];
+ var newLine = breakpoint.line;
if (success && breakpoint.line >= line)
- breakpoint.line += linesCountToShift;
- WebInspector.breakpointManager.addBreakpoint(breakpoint);
+ newLine += linesCountToShift;
+ WebInspector.breakpointManager.setBreakpoint(sourceID, breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition);
}
};
var callbackId = WebInspector.Callback.wrap(mycallback.bind(this))
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index f221086..73c3e2a 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -56,10 +56,18 @@ WebInspector.SourceFrame.prototype = {
this._visible = visible;
this._createViewerIfNeeded();
- if (!visible) {
+ if (visible) {
+ if (this._textViewer && this._scrollTop)
+ this._textViewer.element.scrollTop = this._scrollTop;
+ if (this._textViewer && this._scrollLeft)
+ this._textViewer.element.scrollLeft = this._scrollLeft;
+ } else {
this._hidePopup();
- if (this._textViewer)
+ if (this._textViewer) {
+ this._scrollTop = this._textViewer.element.scrollTop;
+ this._scrollLeft = this._textViewer.element.scrollLeft;
this._textViewer.freeCachedElements();
+ }
}
},
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index e4d7fed..1bf8194 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -58,8 +58,8 @@ WebInspector.SourceView.prototype = {
hide: function()
{
- WebInspector.View.prototype.hide.call(this);
this.sourceFrame.visible = false;
+ WebInspector.View.prototype.hide.call(this);
if (this.localSourceFrame)
this.localSourceFrame.visible = false;
this._currentSearchResultIndex = -1;
@@ -127,7 +127,7 @@ WebInspector.SourceView.prototype = {
_addBreakpoint: function(line)
{
var sourceID = this._sourceIDForLine(line);
- WebInspector.breakpointManager.addBreakpoint(sourceID, this.resource.url, line, true, "");
+ WebInspector.breakpointManager.setBreakpoint(sourceID, this.resource.url, line, true, "");
},
_removeBreakpoint: function(breakpoint)
diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js
index 4709a59..13b2836 100644
--- a/WebCore/inspector/front-end/TextViewer.js
+++ b/WebCore/inspector/front-end/TextViewer.js
@@ -551,28 +551,24 @@ WebInspector.TextViewer.prototype = {
return { line: lineNumber, column: this._textModel.lineLength(lineNumber) };
var column = 0;
- if (lineRow.chunk) {
- // This is chunk.
- var text = lineRow.lastChild.textContent;
+ var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild);
+ while (node && node !== container) {
+ column += node.textContent.length;
+ node = node.traverseNextTextNode(lineRow.lastChild);
+ }
+
+ // This may be chunk and chunks may contain \n.
+ if (node === container && offset) {
+ var text = node.textContent;
for (var i = 0; i < offset; ++i) {
if (text.charAt(i) === "\n") {
lineNumber++;
column = 0;
} else
- column++;
+ column++;
}
- return { line: lineNumber, column: column };
- }
-
- // This is individul line.
- var column = 0;
- var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild);
- while (node && node !== container) {
- column += node.textContent.length;
- node = node.traverseNextTextNode(lineRow.lastChild);
}
- column += offset;
- return { line: lineRow.lineNumber, column: column };
+ return { line: lineNumber, column: column };
},
_appendSpan: function(element, content, className)