Title: [102581] trunk
Revision
102581
Author
[email protected]
Date
2011-12-12 07:24:36 -0800 (Mon, 12 Dec 2011)

Log Message

Web Inspector: [Styles] Modified selector text needs sanitization
https://bugs.webkit.org/show_bug.cgi?id=74291

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/StylesSidebarPane.js:

LayoutTests:

* inspector/styles/commit-selector-expected.txt:
* inspector/styles/commit-selector.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102580 => 102581)


--- trunk/LayoutTests/ChangeLog	2011-12-12 15:13:18 UTC (rev 102580)
+++ trunk/LayoutTests/ChangeLog	2011-12-12 15:24:36 UTC (rev 102581)
@@ -1,3 +1,13 @@
+2011-12-12  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [Styles] Modified selector text needs sanitization
+        https://bugs.webkit.org/show_bug.cgi?id=74291
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/styles/commit-selector-expected.txt:
+        * inspector/styles/commit-selector.html:
+
 2011-11-30  Alexander Pavlov  <[email protected]>
 
         WebKit does not enumerate over CSS properties in HTMLElement.style

Modified: trunk/LayoutTests/inspector/styles/commit-selector-expected.txt (102580 => 102581)


--- trunk/LayoutTests/inspector/styles/commit-selector-expected.txt	2011-12-12 15:13:18 UTC (rev 102580)
+++ trunk/LayoutTests/inspector/styles/commit-selector-expected.txt	2011-12-12 15:24:36 UTC (rev 102581)
@@ -16,15 +16,30 @@
 display: block;
 
 
-=== After selector modification ===
+=== After non-affecting selector modification ===
 [expanded] 
 element.style  { ()
 color: red;
 
 ======== Matched CSS Rules ========
 [expanded] 
+hr, #inspected  { (commit-selector.html:4)
+/-- overloaded --/ color: green;
+
+[expanded] 
 div  { (user agent stylesheet)
 display: block;
 
 
+=== After affecting selector modification ===
+[expanded] 
+element.style  { ()
+color: red;
 
+======== Matched CSS Rules ========
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+

Modified: trunk/LayoutTests/inspector/styles/commit-selector.html (102580 => 102581)


--- trunk/LayoutTests/inspector/styles/commit-selector.html	2011-12-12 15:13:18 UTC (rev 102580)
+++ trunk/LayoutTests/inspector/styles/commit-selector.html	2011-12-12 15:24:36 UTC (rev 102581)
@@ -20,15 +20,26 @@
         InspectorTest.dumpSelectedElementStyles(true);
         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
         section.startEditingSelector();
-        section._selectorElement.textContent = "#inspectedChanged";
+        section._selectorElement.textContent = "hr, #inspected ";
         section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
         InspectorTest.runAfterPendingDispatches(step2);
     }
 
     function step2()
     {
-        InspectorTest.addResult("=== After selector modification ===");
+        InspectorTest.addResult("=== After non-affecting selector modification ===");
         InspectorTest.dumpSelectedElementStyles(true);
+        var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
+        section.startEditingSelector();
+        section._selectorElement.textContent = "#inspectedChanged";
+        section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+        InspectorTest.runAfterPendingDispatches(step3);
+    }
+
+    function step3()
+    {
+        InspectorTest.addResult("=== After affecting selector modification ===");
+        InspectorTest.dumpSelectedElementStyles(true);
         InspectorTest.completeTest();
     }
 }

Modified: trunk/Source/WebCore/ChangeLog (102580 => 102581)


--- trunk/Source/WebCore/ChangeLog	2011-12-12 15:13:18 UTC (rev 102580)
+++ trunk/Source/WebCore/ChangeLog	2011-12-12 15:24:36 UTC (rev 102581)
@@ -1,3 +1,12 @@
+2011-12-12  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: [Styles] Modified selector text needs sanitization
+        https://bugs.webkit.org/show_bug.cgi?id=74291
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/StylesSidebarPane.js:
+
 2011-12-12  Renata Hodovan  <[email protected]>
 
         Fulfill FIXME in  HTMLLinkElement.h.

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (102580 => 102581)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-12-12 15:13:18 UTC (rev 102580)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-12-12 15:24:36 UTC (rev 102581)
@@ -1207,8 +1207,13 @@
 
     editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection)
     {
-        if (newContent === oldContent)
+        if (newContent)
+            newContent = newContent.trim();
+        if (newContent === oldContent) {
+            // Revert to a trimmed version of the selector if need be.
+            this._selectorElement.textContent = newContent;
             return this._moveEditorFromSelector(moveDirection);
+        }
 
         function successCallback(newRule, doesAffectSelectedNode)
         {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to