Title: [95806] trunk
Revision
95806
Author
[email protected]
Date
2011-09-23 08:22:35 -0700 (Fri, 23 Sep 2011)

Log Message

Web Inspector: InspectorStyleSheet should use stylesheet's original url, not final one.
https://bugs.webkit.org/show_bug.cgi?id=68631

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: http/tests/inspector/styles/styles-redirected-css.html

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::resourceStyleSheetText):

LayoutTests:

* http/tests/inspector/elements-test.js:
(initialize_ElementTest.InspectorTest.getElementStylePropertyTreeItem):
(initialize_ElementTest.InspectorTest.getMatchedStylePropertyTreeItem):
(initialize_ElementTest.InspectorTest.getFirstPropertyTreeItemForSection):
* http/tests/inspector/styles/resources/styles-redirected-css.css: Added.
(div):
* http/tests/inspector/styles/resources/styles-redirected-css.php: Added.
* http/tests/inspector/styles/styles-redirected-css-expected.txt: Added.
* http/tests/inspector/styles/styles-redirected-css.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95805 => 95806)


--- trunk/LayoutTests/ChangeLog	2011-09-23 15:08:09 UTC (rev 95805)
+++ trunk/LayoutTests/ChangeLog	2011-09-23 15:22:35 UTC (rev 95806)
@@ -1,5 +1,22 @@
 2011-09-23  Vsevolod Vlasov  <[email protected]>
 
+        Web Inspector: InspectorStyleSheet should use stylesheet's original url, not final one.
+        https://bugs.webkit.org/show_bug.cgi?id=68631
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector/elements-test.js:
+        (initialize_ElementTest.InspectorTest.getElementStylePropertyTreeItem):
+        (initialize_ElementTest.InspectorTest.getMatchedStylePropertyTreeItem):
+        (initialize_ElementTest.InspectorTest.getFirstPropertyTreeItemForSection):
+        * http/tests/inspector/styles/resources/styles-redirected-css.css: Added.
+        (div):
+        * http/tests/inspector/styles/resources/styles-redirected-css.php: Added.
+        * http/tests/inspector/styles/styles-redirected-css-expected.txt: Added.
+        * http/tests/inspector/styles/styles-redirected-css.html: Added.
+
+2011-09-23  Vsevolod Vlasov  <[email protected]>
+
         Web Inspector: XHRs requests with the same url as main resource should have correct category.
         https://bugs.webkit.org/show_bug.cgi?id=68646
 

Modified: trunk/LayoutTests/http/tests/inspector/elements-test.js (95805 => 95806)


--- trunk/LayoutTests/http/tests/inspector/elements-test.js	2011-09-23 15:08:09 UTC (rev 95805)
+++ trunk/LayoutTests/http/tests/inspector/elements-test.js	2011-09-23 15:22:35 UTC (rev 95806)
@@ -222,7 +222,24 @@
 {
     var styleSections = WebInspector.panels.elements.sidebarPanes.styles.sections[0];
     var elementStyleSection = styleSections[1];
-    var outline = elementStyleSection.propertiesTreeOutline;
+    return InspectorTest.getFirstPropertyTreeItemForSection(elementStyleSection, propertyName);
+};
+
+// FIXME: this returns the first tree item found (may fail for same-named properties in a style).
+InspectorTest.getMatchedStylePropertyTreeItem = function(propertyName)
+{
+    var styleSections = WebInspector.panels.elements.sidebarPanes.styles.sections[0];
+    for (var i = 1; i < styleSections.length; ++i) {
+        var treeItem = InspectorTest.getFirstPropertyTreeItemForSection(styleSections[i], propertyName);
+        if (treeItem)
+            return treeItem;
+    }
+    return null;
+};
+
+InspectorTest.getFirstPropertyTreeItemForSection = function(section, propertyName)
+{
+    var outline = section.propertiesTreeOutline;
     for (var i = 0; i < outline.children.length; ++i) {
         var treeItem = outline.children[i];
         if (treeItem.name === propertyName)

Added: trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.css (0 => 95806)


--- trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.css	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.css	2011-09-23 15:22:35 UTC (rev 95806)
@@ -0,0 +1,4 @@
+div {
+    background-color: red;
+}
+

Added: trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.php (0 => 95806)


--- trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/resources/styles-redirected-css.php	2011-09-23 15:22:35 UTC (rev 95806)
@@ -0,0 +1,3 @@
+<?php
+    header("Location: styles-redirected-css.css");
+?>

Added: trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css-expected.txt (0 => 95806)


--- trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css-expected.txt	2011-09-23 15:22:35 UTC (rev 95806)
@@ -0,0 +1,4 @@
+Tests that styles in redirected css are editable.
+
+Bug 68631
+test

Added: trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css.html (0 => 95806)


--- trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/styles/styles-redirected-css.html	2011-09-23 15:22:35 UTC (rev 95806)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<link rel="stylesheet" href="" type="text/css">
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.selectNodeAndWaitForStyles("test_div", step1);
+
+    function step1()
+    {
+        var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("background-color");
+        treeItem.property.setDisabled(true, step2);
+    }
+
+    function step2(newStyle)
+    {
+        InspectorTest.assertTrue(!!newStyle, "Could not disable style in redirected css.");
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that styles in redirected css are editable.</p>
+<a href="" 68631</a>
+
+<div id="test_div">test</div>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (95805 => 95806)


--- trunk/Source/WebCore/ChangeLog	2011-09-23 15:08:09 UTC (rev 95805)
+++ trunk/Source/WebCore/ChangeLog	2011-09-23 15:22:35 UTC (rev 95806)
@@ -1,5 +1,17 @@
 2011-09-23  Vsevolod Vlasov  <[email protected]>
 
+        Web Inspector: InspectorStyleSheet should use stylesheet's original url, not final one.
+        https://bugs.webkit.org/show_bug.cgi?id=68631
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: http/tests/inspector/styles/styles-redirected-css.html
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::resourceStyleSheetText):
+
+2011-09-23  Vsevolod Vlasov  <[email protected]>
+
         Web Inspector: XHRs requests with the same url as main resource should have correct category.
         https://bugs.webkit.org/show_bug.cgi?id=68646
 

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (95805 => 95806)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-09-23 15:08:09 UTC (rev 95805)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-09-23 15:22:35 UTC (rev 95806)
@@ -1003,7 +1003,7 @@
 
     String error;
     bool base64Encoded;
-    InspectorPageAgent::resourceContent(&error, ownerDocument()->frame(), m_pageStyleSheet->finalURL(), result, &base64Encoded);
+    InspectorPageAgent::resourceContent(&error, ownerDocument()->frame(), KURL(ParsedURLString, m_pageStyleSheet->href()), result, &base64Encoded);
     return error.isEmpty() && !base64Encoded;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to