Title: [134909] trunk
Revision
134909
Author
ta...@google.com
Date
2012-11-16 00:06:06 -0800 (Fri, 16 Nov 2012)

Log Message

ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost
https://bugs.webkit.org/show_bug.cgi?id=102116

Reviewed by Alexander Pavlov.

Source/WebCore:

Provide a CSSUnknownRule instance as a CSSOM wrapper for StyleRuleHost
rules. Since there is no CSSOM wrapper for @host @-rules and
ASSERT_NOT_REACHED is used when a CSSOM wrapper is requested,
this crash occurs.

Tests: fast/css/at-host-cssom-crash.html
       inspector/styles/styles-include-host-rules-crash.html

* css/StyleRule.cpp:
(WebCore::StyleRuleBase::createCSSOMWrapper):
Return a CSSUnknownRule instance for StyleRuleHost rules instead of
calling ASSERT_NOT_REACHED().

LayoutTests:

* fast/css/at-host-cssom-crash-expected.txt: Added.
* fast/css/at-host-cssom-crash.html: Added.
* inspector/styles/styles-include-host-rules-crash-expected.txt: Added.
* inspector/styles/styles-include-host-rules-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134908 => 134909)


--- trunk/LayoutTests/ChangeLog	2012-11-16 08:02:55 UTC (rev 134908)
+++ trunk/LayoutTests/ChangeLog	2012-11-16 08:06:06 UTC (rev 134909)
@@ -1,3 +1,15 @@
+2012-11-16  Takashi Sakamoto  <ta...@google.com>
+
+        ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost
+        https://bugs.webkit.org/show_bug.cgi?id=102116
+
+        Reviewed by Alexander Pavlov.
+
+        * fast/css/at-host-cssom-crash-expected.txt: Added.
+        * fast/css/at-host-cssom-crash.html: Added.
+        * inspector/styles/styles-include-host-rules-crash-expected.txt: Added.
+        * inspector/styles/styles-include-host-rules-crash.html: Added.
+
 2012-11-15  Kenichi Ishibashi  <ba...@chromium.org>
 
         Unreviewed test update.

Added: trunk/LayoutTests/fast/css/at-host-cssom-crash-expected.txt (0 => 134909)


--- trunk/LayoutTests/fast/css/at-host-cssom-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/at-host-cssom-crash-expected.txt	2012-11-16 08:06:06 UTC (rev 134909)
@@ -0,0 +1,2 @@
+Test for 102116: ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost
+This test has PASSED (no crash).

Added: trunk/LayoutTests/fast/css/at-host-cssom-crash.html (0 => 134909)


--- trunk/LayoutTests/fast/css/at-host-cssom-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/at-host-cssom-crash.html	2012-11-16 08:06:06 UTC (rev 134909)
@@ -0,0 +1,29 @@
+<!doctype html>
+<head>
+<style>
+@host {
+    div {
+      padding: 2px;
+    }
+}
+
+div {
+  padding: 2px;
+}
+</style>
+</head>
+<body>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var styleSheets = document.styleSheets;
+for (var i = 0; i < styleSheets.length; ++i)
+    for (var j = 0; j < styleSheets[i].cssRules.length; ++j)
+        styleSheets[i].cssRules.item(j);
+</script>
+Test for <a href="" ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost<br>
+This test has PASSED (no crash).
+</body>
+</html>
+

Added: trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash-expected.txt (0 => 134909)


--- trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash-expected.txt	2012-11-16 08:06:06 UTC (rev 134909)
@@ -0,0 +1,17 @@
+[bug 102116] - https://bugs.webkit.org/show_bug.cgi?id=102116 - ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost. If this test passes, no crash occurs.
+
+Foo
+[expanded] 
+display: block;
+    div - block user agent stylesheet
+
+[expanded] 
+element.style  { ()
+
+======== Matched CSS Rules ========
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+

Added: trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash.html (0 => 134909)


--- trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/styles-include-host-rules-crash.html	2012-11-16 08:06:06 UTC (rev 134909)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<style>
+@host {
+    div { border: 1px solid blue; }
+}
+
+@host.div {
+  opacity: 0;
+}
+</style>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.selectNodeAndWaitForStylesWithComputed("foo", step1);
+
+    function step1()
+    {
+        InspectorTest.dumpSelectedElementStyles(false, false);
+        InspectorTest.completeTest();
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+[bug 102116] - <a href="" -
+ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost.
+If this test passes, no crash occurs.
+</p>
+
+<div id="container">
+    <div id="foo">Foo</div>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134908 => 134909)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 08:02:55 UTC (rev 134908)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 08:06:06 UTC (rev 134909)
@@ -1,3 +1,23 @@
+2012-11-16  Takashi Sakamoto  <ta...@google.com>
+
+        ASSERT_NOT_REACHED() when building a CSSOM wrapper for StyleRuleHost
+        https://bugs.webkit.org/show_bug.cgi?id=102116
+
+        Reviewed by Alexander Pavlov.
+
+        Provide a CSSUnknownRule instance as a CSSOM wrapper for StyleRuleHost
+        rules. Since there is no CSSOM wrapper for @host @-rules and
+        ASSERT_NOT_REACHED is used when a CSSOM wrapper is requested,
+        this crash occurs.
+
+        Tests: fast/css/at-host-cssom-crash.html
+               inspector/styles/styles-include-host-rules-crash.html
+
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::createCSSOMWrapper):
+        Return a CSSUnknownRule instance for StyleRuleHost rules instead of
+        calling ASSERT_NOT_REACHED().
+
 2012-11-16  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         Avoid copying of ViewportArguments in computeViewportAttributes function

Modified: trunk/Source/WebCore/css/StyleRule.cpp (134908 => 134909)


--- trunk/Source/WebCore/css/StyleRule.cpp	2012-11-16 08:02:55 UTC (rev 134908)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2012-11-16 08:06:06 UTC (rev 134909)
@@ -28,6 +28,7 @@
 #include "CSSMediaRule.h"
 #include "CSSPageRule.h"
 #include "CSSStyleRule.h"
+#include "CSSUnknownRule.h"
 #include "StyleRuleImport.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include "WebKitCSSKeyframeRule.h"
@@ -220,6 +221,9 @@
         break;
 #endif
     case Host:
+        // FIXME: The current CSSOM editor's draft (http://dev.w3.org/csswg/cssom/) does not handle @host rules (see bug 102344).
+        rule = adoptRef(new CSSUnknownRule());
+        break;
     case Unknown:
     case Charset:
     case Keyframe:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to