summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector/front-end/WatchExpressionsSidebarPane.js')
-rw-r--r--WebCore/inspector/front-end/WatchExpressionsSidebarPane.js74
1 files changed, 32 insertions, 42 deletions
diff --git a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
index 4804897..3655d68 100644
--- a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
+++ b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
@@ -31,35 +31,41 @@
WebInspector.WatchExpressionsSidebarPane = function()
{
WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions"));
+ WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
+}
- this.section = new WebInspector.WatchExpressionsSection();
+WebInspector.WatchExpressionsSidebarPane.prototype = {
+ _settingsLoaded: function()
+ {
+ this.bodyElement.removeChildren();
- this.bodyElement.appendChild(this.section.element);
+ this.expanded = WebInspector.settings.watchExpressions.length > 0;
+ this.section = new WebInspector.WatchExpressionsSection();
+ this.bodyElement.appendChild(this.section.element);
- var addElement = document.createElement("button");
- addElement.setAttribute("type", "button");
- addElement.textContent = WebInspector.UIString("Add");
- addElement.addEventListener("click", this.section.addExpression.bind(this.section), false);
+ var addElement = document.createElement("button");
+ addElement.setAttribute("type", "button");
+ addElement.textContent = WebInspector.UIString("Add");
+ addElement.addEventListener("click", this.section.addExpression.bind(this.section), false);
- var refreshElement = document.createElement("button");
- refreshElement.setAttribute("type", "button");
- refreshElement.textContent = WebInspector.UIString("Refresh");
- refreshElement.addEventListener("click", this.section.update.bind(this.section), false);
+ var refreshElement = document.createElement("button");
+ refreshElement.setAttribute("type", "button");
+ refreshElement.textContent = WebInspector.UIString("Refresh");
+ refreshElement.addEventListener("click", this.section.update.bind(this.section), false);
- var centerElement = document.createElement("div");
- centerElement.addStyleClass("watch-expressions-buttons-container");
- centerElement.appendChild(addElement);
- centerElement.appendChild(refreshElement);
- this.bodyElement.appendChild(centerElement);
+ var centerElement = document.createElement("div");
+ centerElement.addStyleClass("watch-expressions-buttons-container");
+ centerElement.appendChild(addElement);
+ centerElement.appendChild(refreshElement);
+ this.bodyElement.appendChild(centerElement);
- this.expanded = this.section.loadSavedExpressions().length > 0;
- this.onexpand = this.refreshExpressions.bind(this);
-}
+ this.onexpand = this.refreshExpressions.bind(this);
+ },
-WebInspector.WatchExpressionsSidebarPane.prototype = {
refreshExpressions: function()
{
- this.section.update();
+ if (this.section)
+ this.section.update();
}
}
@@ -71,7 +77,7 @@ WebInspector.WatchExpressionsSection = function()
WebInspector.ObjectPropertiesSection.call(this);
- this.watchExpressions = this.loadSavedExpressions();
+ this.watchExpressions = WebInspector.settings.watchExpressions;
this.headerElement.className = "hidden";
this.editable = true;
@@ -127,7 +133,8 @@ WebInspector.WatchExpressionsSection.prototype = {
}
}
- InspectorBackend.releaseWrapperObjectGroup(this._watchObjectGroupId)
+ // TODO: pass exact injected script id.
+ InspectorBackend.releaseWrapperObjectGroup(0, this._watchObjectGroupId)
var properties = [];
// Count the properties, so we known when to call this.updateProperties()
@@ -181,21 +188,6 @@ WebInspector.WatchExpressionsSection.prototype = {
return children[i];
},
- loadSavedExpressions: function()
- {
- var json = InspectorFrontendHost.setting("watchExpressions");
- if (!json)
- return [];
-
- try {
- json = JSON.parse(json);
- } catch(e) {
- return [];
- }
-
- return json.expressions || [];
- },
-
saveExpressions: function()
{
var toSave = [];
@@ -203,9 +195,7 @@ WebInspector.WatchExpressionsSection.prototype = {
if (this.watchExpressions[i])
toSave.push(this.watchExpressions[i]);
- var json = JSON.stringify({expressions: toSave});
- InspectorFrontendHost.setSetting("watchExpressions", json);
-
+ WebInspector.settings.watchExpressions = toSave;
return toSave.length;
}
}
@@ -255,7 +245,7 @@ WebInspector.WatchExpressionTreeElement.prototype = {
if (WebInspector.isBeingEdited(this.nameElement) || !this.treeOutline.section.editable)
return;
- this.nameElement.textContent = this.property.name.trimWhitespace();
+ this.nameElement.textContent = this.property.name.trim();
var context = { expanded: this.expanded };
@@ -278,7 +268,7 @@ WebInspector.WatchExpressionTreeElement.prototype = {
applyExpression: function(expression, updateInterface)
{
- expression = expression.trimWhitespace();
+ expression = expression.trim();
if (!expression)
expression = null;