Title: [204510] trunk/Source/WebInspectorUI
- Revision
- 204510
- Author
- [email protected]
- Date
- 2016-08-16 09:57:27 -0700 (Tue, 16 Aug 2016)
Log Message
Web Inspector: Visual Styles: "Text -> Content" isn't escaped
https://bugs.webkit.org/show_bug.cgi?id=158271
Patch by Devin Rousso <[email protected]> on 2016-08-16
Reviewed by Timothy Hatcher.
* UserInterface/Base/Utilities.js:
(String.prototype.hasMatchingEscapedQuotes):
Checks that the given string has property escaped quotes (single or double).
* UserInterface/Views/VisualStyleBasicInput.js:
(WebInspector.VisualStyleBasicInput):
(WebInspector.VisualStyleBasicInput.prototype._handleInputElementInput):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (204509 => 204510)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-08-16 16:57:17 UTC (rev 204509)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-08-16 16:57:27 UTC (rev 204510)
@@ -1,3 +1,18 @@
+2016-08-16 Devin Rousso <[email protected]>
+
+ Web Inspector: Visual Styles: "Text -> Content" isn't escaped
+ https://bugs.webkit.org/show_bug.cgi?id=158271
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Utilities.js:
+ (String.prototype.hasMatchingEscapedQuotes):
+ Checks that the given string has property escaped quotes (single or double).
+
+ * UserInterface/Views/VisualStyleBasicInput.js:
+ (WebInspector.VisualStyleBasicInput):
+ (WebInspector.VisualStyleBasicInput.prototype._handleInputElementInput):
+
2016-08-16 Joseph Pecoraro <[email protected]>
Modernize model objects simple getters
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (204509 => 204510)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2016-08-16 16:57:17 UTC (rev 204509)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2016-08-16 16:57:27 UTC (rev 204510)
@@ -917,6 +917,14 @@
}
});
+Object.defineProperty(String.prototype, "hasMatchingEscapedQuotes",
+{
+ value: function()
+ {
+ return /^\"(?:[^\"\\]|\\.)*\"$/.test(this) || /^\'(?:[^\'\\]|\\.)*\'$/.test(this);
+ }
+});
+
Object.defineProperty(Math, "roundTo",
{
value: function(num, step)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js (204509 => 204510)
--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js 2016-08-16 16:57:17 UTC (rev 204509)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleBasicInput.js 2016-08-16 16:57:27 UTC (rev 204510)
@@ -32,7 +32,7 @@
this._inputElement = this.contentElement.createChild("input");
this._inputElement.spellcheck = false;
this._inputElement.setAttribute("placeholder", placeholder || "");
- this._inputElement.addEventListener("input", this._handleInputElementInput.bind(this));
+ this._inputElement.addEventListener("input", this.debounce(500)._handleInputElementInput);
}
// Public
@@ -59,6 +59,19 @@
_handleInputElementInput(event)
{
+ let value = this.value;
+ if (value && value.trim().length) {
+ let validItems = [];
+ for (let item of value.split(/([^\"\'\s]+|\"[^\"]*\"|\'[^\']*\')/)) {
+ if (!item.length || (!item.hasMatchingEscapedQuotes() && !/^[\w\s\-\.\(\)]+$/.test(item)))
+ continue;
+
+ validItems.push(item);
+ }
+
+ this.value = validItems.filter(item => item.trim().length).join(" ");
+ }
+
this._valueDidChange();
}
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes