Changeset 274593 in webkit
- Timestamp:
- Mar 17, 2021 2:59:47 PM (16 months ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Views/CookiePopover.css (modified) (1 diff)
-
UserInterface/Views/CookiePopover.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r274592 r274593 1 2021-03-17 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: use native datetime-local picker for changing `expires` value in cookie popover 4 https://bugs.webkit.org/show_bug.cgi?id=209389 5 6 Reviewed by BJ Burg. 7 8 r259173 already made it so that the `<input>` for Expires used `datetime-local`, so nothing 9 needs to be changed to adopt that. We still want to keep the `"input"` event listener that 10 parses and validates the `value` (or `placeholder`) of the `<input type="datetime-local">` 11 because dates in the past should be considered invalid. 12 13 * UserInterface/Views/CookiePopover.js: 14 (WI.CookiePopover.prototype.show): Add `step = 1` so that the seconds field is shown. 15 (WI.CookiePopover.prototype.show.formatDate): Added. 16 (WI.CookiePopover.prototype.show.formatDate.pad): Added. 17 * UserInterface/Views/CookiePopover.css: Remove the FIXME comment. 18 1 19 2021-03-17 Razvan Caliman <rcaliman@apple.com> 2 20 -
trunk/Source/WebInspectorUI/UserInterface/Views/CookiePopover.css
r269166 r274593 46 46 } 47 47 48 /* FIXME: <https://webkit.org/b/209389> Web Inspector: use native datetime-local picker for changing `expires` value in cookie popover */49 50 48 .popover .cookie-popover-content > table > tr > td > input:matches([type="text"], [type="datetime-local"]) { 51 49 width: 100%; -
trunk/Source/WebInspectorUI/UserInterface/Views/CookiePopover.js
r262848 r274593 108 108 this._preferredEdges = preferredEdges; 109 109 110 function formatDate(date) { 111 function pad(number) { 112 return String(number).padStart(2, "0"); 113 } 114 return [ 115 date.getFullYear(), 116 "-", 117 pad(date.getMonth() + 1), 118 "-", 119 pad(date.getDate()), 120 "T", 121 pad(date.getHours()), 122 ":", 123 pad(date.getMinutes()), 124 ":", 125 pad(date.getSeconds()), 126 ].join(""); 127 } 128 110 129 let data = {}; 111 130 if (cookie) { … … 114 133 data.domain = cookie.domain; 115 134 data.path = cookie.path; 116 data.expires = (cookie.expires || this._defaultExpires()).toLocaleString();135 data.expires = formatDate(cookie.expires || this._defaultExpires()); 117 136 data.session = cookie.session; 118 137 data.httpOnly = cookie.httpOnly; … … 125 144 data.domain = urlComponents.host; 126 145 data.path = urlComponents.path; 127 data.expires = this._defaultExpires().toLocaleString();146 data.expires = formatDate(this._defaultExpires()); 128 147 data.session = true; 129 148 data.httpOnly = false; … … 197 216 let expiresInputRow = createInputRow("expires", WI.unlocalizedString("Expires"), "datetime-local", data.expires); 198 217 this._expiresInputElement = expiresInputRow.inputElement; 218 this._expiresInputElement.step = 1; // Causes the seconds field to be shown. 199 219 this._expiresInputElement.addEventListener("input", (event) => { 200 220 this._expiresInputElement.classList.toggle("invalid", isNaN(this._parseExpires()));
Note: See TracChangeset
for help on using the changeset viewer.