diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/inspector/front-end/WatchExpressionsSidebarPane.js | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/inspector/front-end/WatchExpressionsSidebarPane.js')
-rw-r--r-- | WebCore/inspector/front-end/WatchExpressionsSidebarPane.js | 74 |
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; |