Changeset 147031 in webkit
- Timestamp:
- Mar 27, 2013 5:16:07 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147030 r147031 1 2013-03-27 PhistucK <phistuck@chromium.org> 2 3 Web Inspector: Plumb and expose cookie clearing options throughout the Resources Cookies tree and views 4 https://bugs.webkit.org/show_bug.cgi?id=87140 5 6 Reviewed by Vsevolod Vlasov. 7 8 Added cookie clearing buttons and context menu options 9 throughout the tree and views. 10 Drive by - 11 - Made sure the delete button is only visible 12 when a cookie is selected. 13 - Fixed a wrong JSDoc comment. 14 15 * inspector/front-end/CookieItemsView.js: 16 (WebInspector.CookieItemsView): 17 (WebInspector.CookieItemsView.prototype.statusBarItems): 18 (WebInspector.CookieItemsView.prototype._updateWithCookies): 19 (WebInspector.CookieItemsView.prototype.clear): 20 Added. Clears the entire cookie view. 21 (WebInspector.CookieItemsView.prototype._clearButtonClicked): 22 Added. Ditto (when clicking on the button). 23 (WebInspector.CookieItemsView.prototype._showDeleteButton): 24 Added. Shows the delete button when selecting a cookie row. 25 * inspector/CookiesTable.js: 26 (WebInspector.CookiesTable): 27 (WebInspector.CookiesTable.prototype._clearAndRefresh): 28 Added. Clears the cookies of the current table and updates it. 29 (WebInspector.CookiesTable.prototype._handleContextMenuEvent): 30 Added. Manages the context menu within the table. 31 (WebInspector.CookiesTable.prototype.clear): 32 Added. Clears the cookies of the current table. 33 (WebInspector.CookiesTable.prototype.setCookies): 34 Fixed a wrong JSDoc comment structure. 35 * inspector/front-end/ResourcesPanel.js: 36 (WebInspector.ResourcesPanel.prototype.clearCookies): 37 Added. Clears the cookies of the given domain view. 38 (WebInspector.CookieTreeElement.prototype.onattach): 39 Added. Adds a contextmenu handler. 40 (WebInspector.CookieTreeElement.prototype._handleContextMenuEvent): 41 Added. Manages the context menu within cookie tree. 42 (WebInspector.CookieTreeElement.prototype._clearCookies): 43 Added. Clears the cookies of the view of the tree item. 44 * inspector/front-end/treeoutline.js: 45 (TreeOutline): Fixed a wrong JSDoc comment. 46 47 * English.lproj/localizedStrings.js: 48 Added strings for the context menu options. 49 1 50 2013-03-27 Andrey Lushnikov <lushnikov@chromium.org> 2 51 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r146276 r147031 106 106 localizedStrings["Calls"] = "Calls"; 107 107 localizedStrings["Cannot find corresponding heap snapshot node"] = "Cannot find corresponding heap snapshot node"; 108 localizedStrings["Clear All"] = "Clear All"; 109 localizedStrings["Clear all"] = "Clear all"; 110 localizedStrings["Clear all from \"%s\""] = "Clear all from \"%s\""; 111 localizedStrings["Clear All from \"%s\""] = "Clear All from \"%s\""; 108 112 localizedStrings["Clear all profiles."] = "Clear all profiles."; 109 113 localizedStrings["Clear Browser Cache"] = "Clear Browser Cache"; -
trunk/Source/WebCore/inspector/front-end/CookieItemsView.js
r145875 r147031 42 42 this._deleteButton.addEventListener("click", this._deleteButtonClicked, this); 43 43 44 this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-storage-status-bar-item"); 45 this._clearButton.visible = false; 46 this._clearButton.addEventListener("click", this._clearButtonClicked, this); 47 44 48 this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); 45 49 this._refreshButton.addEventListener("click", this._refreshButtonClicked, this); … … 57 61 get statusBarItems() 58 62 { 59 return [this._refreshButton.element, this._ deleteButton.element];63 return [this._refreshButton.element, this._clearButton.element, this._deleteButton.element]; 60 64 }, 61 65 … … 86 90 // Nothing to show. 87 91 this._emptyView.show(this.element); 92 this._clearButton.visible = false; 88 93 this._deleteButton.visible = false; 89 94 if (this._cookiesTable) … … 93 98 94 99 if (!this._cookiesTable) 95 this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(false, this._update.bind(this) ) : new WebInspector.SimpleCookiesTable();100 this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(false, this._update.bind(this), this._showDeleteButton.bind(this)) : new WebInspector.SimpleCookiesTable(); 96 101 97 102 this._cookiesTable.setCookies(this._cookies); … … 101 106 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length, 102 107 Number.bytesToString(this._totalSize)); 103 this._deleteButton.visible = true; 108 this._clearButton.visible = true; 109 this._deleteButton.visible = !!this._cookiesTable.selectedCookie(); 104 110 } 105 111 }, … … 139 145 }, 140 146 147 clear: function() 148 { 149 this._cookiesTable.clear(); 150 this._update(); 151 }, 152 153 _clearButtonClicked: function() 154 { 155 this.clear(); 156 }, 157 158 _showDeleteButton: function() 159 { 160 this._deleteButton.visible = true; 161 }, 162 141 163 _deleteButtonClicked: function() 142 164 { -
trunk/Source/WebCore/inspector/front-end/CookiesTable.js
r146325 r147031 34 34 * @param {boolean} expandable 35 35 * @param {function()=} refreshCallback 36 * @param {function()=} selectedCallback 36 37 */ 37 WebInspector.CookiesTable = function(expandable, refreshCallback )38 WebInspector.CookiesTable = function(expandable, refreshCallback, selectedCallback) 38 39 { 39 40 WebInspector.View.call(this); … … 54 55 ]; 55 56 56 this._dataGrid = new WebInspector.DataGrid(columns, null, readOnly ? null : this._onDeleteCookie.bind(this), refreshCallback); 57 if (readOnly) 58 this._dataGrid = new WebInspector.DataGrid(columns, null, null, refreshCallback); 59 else { 60 this._dataGrid = new WebInspector.DataGrid(columns); 61 this._dataGrid.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); 62 } 63 57 64 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this); 65 66 if (selectedCallback) 67 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, selectedCallback, this); 58 68 59 69 this._nextSelectedCookie = /** @type {?WebInspector.Cookie} */ (null); … … 70 80 }, 71 81 72 /* 82 /** 83 * @param {?string} domain 84 */ 85 _clearAndRefresh: function(domain) 86 { 87 this.clear(domain); 88 if (this._refreshCallback) 89 this._refreshCallback(); 90 }, 91 92 _handleContextMenuEvent: function(event) 93 { 94 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target); 95 96 if (!gridNode) 97 return; 98 99 var contextMenu = new WebInspector.ContextMenu(event); 100 var cookie = gridNode.cookie; 101 102 if (this._refreshCallback) 103 contextMenu.appendItem(WebInspector.UIString("Refresh"), this._refreshCallback); 104 105 if (cookie) { 106 contextMenu.appendItem(WebInspector.UIString("Delete"), this._onDeleteCookie.bind(this, gridNode)); 107 contextMenu.appendSeparator(); 108 var cookieDomain = cookie.domain(); 109 110 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all from \"%s\"" : "Clear All from \"%s\"", cookieDomain), this._clearAndRefresh.bind(this, cookieDomain)); 111 } else 112 contextMenu.appendSeparator(); 113 114 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all" : "Clear All"), this._clearAndRefresh.bind(this, null)); 115 116 contextMenu.show(); 117 }, 118 119 /** 73 120 * @param {!Array.<!WebInspector.Cookie>} cookies 74 121 */ … … 94 141 var node = this._dataGrid.selectedNode; 95 142 return node ? node.cookie : null; 143 }, 144 145 /** 146 * @param {string=} domain 147 */ 148 clear: function(domain) 149 { 150 for (var i = 0, length = this._data.length; i < length; ++i) { 151 var cookies = this._data[i].cookies; 152 for (var j = 0, cookieCount = cookies.length; j < cookieCount; ++j) { 153 if (!domain || cookies[j].domain() === domain) 154 cookies[j].remove(); 155 } 156 } 96 157 }, 97 158 -
trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js
r146614 r147031 514 514 }, 515 515 516 /** 517 * @param {string} cookieDomain 518 */ 519 clearCookies: function(cookieDomain) 520 { 521 this._cookieViews[cookieDomain].clear(); 522 }, 523 516 524 showApplicationCache: function(frameId) 517 525 { … … 1940 1948 }, 1941 1949 1950 onattach: function() 1951 { 1952 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); 1953 this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); 1954 }, 1955 1956 /** 1957 * @param {Event} event 1958 */ 1959 _handleContextMenuEvent: function(event) 1960 { 1961 var contextMenu = new WebInspector.ContextMenu(event); 1962 contextMenu.appendItem(WebInspector.UIString("Clear"), this._clearCookies.bind(this)); 1963 contextMenu.show(); 1964 }, 1965 1966 /** 1967 * @param {string} domain 1968 */ 1969 _clearCookies: function(domain) 1970 { 1971 this._storagePanel.clearCookies(this._cookieDomain); 1972 }, 1973 1942 1974 onselect: function(selectedByUser) 1943 1975 { -
trunk/Source/WebCore/inspector/front-end/treeoutline.js
r136706 r147031 29 29 /** 30 30 * @constructor 31 * @param {Element} listNode 31 32 * @param {boolean=} nonFocusable 32 33 */
Note: See TracChangeset
for help on using the changeset viewer.