Title: [137464] trunk
Revision
137464
Author
apav...@chromium.org
Date
2012-12-12 07:01:31 -0800 (Wed, 12 Dec 2012)

Log Message

Web Inspector: [Crash] Clear cached stylesheet rules in InspectorStyleSheet::deleteRule()
https://bugs.webkit.org/show_bug.cgi?id=104806

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Cached rules (m_flatRules) should get cleared whenever a rule is deleted.

Test: inspector/styles/undo-add-rule-crash.html

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

LayoutTests:

* inspector/styles/undo-add-rule-crash-expected.txt: Added.
* inspector/styles/undo-add-rule-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137463 => 137464)


--- trunk/LayoutTests/ChangeLog	2012-12-12 15:00:23 UTC (rev 137463)
+++ trunk/LayoutTests/ChangeLog	2012-12-12 15:01:31 UTC (rev 137464)
@@ -1,3 +1,13 @@
+2012-12-12  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Crash] Clear cached stylesheet rules in InspectorStyleSheet::deleteRule()
+        https://bugs.webkit.org/show_bug.cgi?id=104806
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/styles/undo-add-rule-crash-expected.txt: Added.
+        * inspector/styles/undo-add-rule-crash.html: Added.
+
 2012-12-12  Stephen White  <senorbla...@chromium.org>
 
         Unreviewed, rolling out r136975.

Added: trunk/LayoutTests/inspector/styles/undo-add-rule-crash-expected.txt (0 => 137464)


--- trunk/LayoutTests/inspector/styles/undo-add-rule-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/undo-add-rule-crash-expected.txt	2012-12-12 15:01:31 UTC (rev 137464)
@@ -0,0 +1,4 @@
+Tests that the inspected page does not crash after undoing a new rule addition. Bug 104806
+The test has passed (no crash).
+
+
Property changes on: trunk/LayoutTests/inspector/styles/undo-add-rule-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/styles/undo-add-rule-crash.html (0 => 137464)


--- trunk/LayoutTests/inspector/styles/undo-add-rule-crash.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/undo-add-rule-crash.html	2012-12-12 15:01:31 UTC (rev 137464)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
+
+    function step1()
+    {
+        addNewRuleAndSelectNode("other", step2);
+    }
+
+    function step2()
+    {
+        WebInspector.domAgent.undo();
+        InspectorTest.waitForStyles("other", step3);
+    }
+
+    function step3()
+    {
+        InspectorTest.completeTest();
+    }
+
+    function addNewRuleAndSelectNode(nodeId, next)
+    {
+        document.getElementById("add-style-button-test-id").click();
+        var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
+        InspectorTest.selectNodeAndWaitForStyles(nodeId, next);
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+Tests that the inspected page does not crash after undoing a new rule addition. <a href="" 104806</a>
+
+<p>The test has passed (no crash).</p>
+<div id="inspected"><div id="other" /></div>
+<style>
+@-webkit-keyframes cfpulse1 { 0% { opacity: 0.1;  } }
+.c1 { -webkit-animation-name: cfpulse1;  }
+</style>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/undo-add-rule-crash.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (137463 => 137464)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 15:00:23 UTC (rev 137463)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 15:01:31 UTC (rev 137464)
@@ -1,3 +1,17 @@
+2012-12-12  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Crash] Clear cached stylesheet rules in InspectorStyleSheet::deleteRule()
+        https://bugs.webkit.org/show_bug.cgi?id=104806
+
+        Reviewed by Vsevolod Vlasov.
+
+        Cached rules (m_flatRules) should get cleared whenever a rule is deleted.
+
+        Test: inspector/styles/undo-add-rule-crash.html
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::deleteRule):
+
 2012-12-12  Stephen White  <senorbla...@chromium.org>
 
         Unreviewed, rolling out r136975.

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (137463 => 137464)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2012-12-12 15:00:23 UTC (rev 137463)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2012-12-12 15:01:31 UTC (rev 137464)
@@ -898,7 +898,7 @@
 
     String sheetText = m_parsedStyleSheet->text();
     sheetText.remove(sourceData->ruleHeaderRange.start, sourceData->ruleBodyRange.end - sourceData->ruleHeaderRange.start + 1);
-    m_parsedStyleSheet->setText(sheetText);
+    setText(sheetText);
     fireStyleSheetChanged();
     return true;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to