Title: [121764] trunk
Revision
121764
Author
[email protected]
Date
2012-07-03 07:44:19 -0700 (Tue, 03 Jul 2012)

Log Message

[REGRESSION] Crash when copying a StyleRuleMedia with a NULL m_mediaQueries
https://bugs.webkit.org/show_bug.cgi?id=90459

Reviewed by Andreas Kling.

Source/WebCore:

Create StyleRuleMedia with a non-NULL MediaQuerySet. The respective NULL checks for it were all over the code,
except the copy constructor. Added the check, just in case.

* css/CSSParser.cpp:
(WebCore::CSSParser::createMediaRule):
* css/StyleRule.cpp:
(WebCore::StyleRuleMedia::StyleRuleMedia):

LayoutTests:

* inspector/styles/get-set-stylesheet-text-expected.txt:
* inspector/styles/resources/get-set-stylesheet-text.css:
(@media):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121763 => 121764)


--- trunk/LayoutTests/ChangeLog	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/LayoutTests/ChangeLog	2012-07-03 14:44:19 UTC (rev 121764)
@@ -1,3 +1,14 @@
+2012-07-03  Alexander Pavlov  <[email protected]>
+
+        [REGRESSION] Crash when copying a StyleRuleMedia with a NULL m_mediaQueries
+        https://bugs.webkit.org/show_bug.cgi?id=90459
+
+        Reviewed by Andreas Kling.
+
+        * inspector/styles/get-set-stylesheet-text-expected.txt:
+        * inspector/styles/resources/get-set-stylesheet-text.css:
+        (@media):
+
 2012-07-03  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: display time intervals measured with console.time() and console.timeEnd() in Timeline

Modified: trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt (121763 => 121764)


--- trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt	2012-07-03 14:44:19 UTC (rev 121764)
@@ -16,6 +16,10 @@
     color: "badcolor" ! important /* good property with strange value */;
 }
 
+@media {
+    /* @media rule with an empty media list */
+}
+
 /* comment before selector */body.main1/* comment after selector */{/* comment */color: #F00BAA;zoo:moo /* not an !important unrecognized property */}/* comment */
 
 body.main2{background: green /* value !important comment */ !important /* no semicolon, very !important */}

Modified: trunk/LayoutTests/inspector/styles/resources/get-set-stylesheet-text.css (121763 => 121764)


--- trunk/LayoutTests/inspector/styles/resources/get-set-stylesheet-text.css	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/LayoutTests/inspector/styles/resources/get-set-stylesheet-text.css	2012-07-03 14:44:19 UTC (rev 121764)
@@ -9,6 +9,10 @@
     color: "badcolor" ! important /* good property with strange value */;
 }
 
+@media {
+    /* @media rule with an empty media list */
+}
+
 /* comment before selector */body.main1/* comment after selector */{/* comment */color: #F00BAA;zoo:moo /* not an !important unrecognized property */}/* comment */
 
 body.main2{background: green /* value !important comment */ !important /* no semicolon, very !important */}

Modified: trunk/Source/WebCore/ChangeLog (121763 => 121764)


--- trunk/Source/WebCore/ChangeLog	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/Source/WebCore/ChangeLog	2012-07-03 14:44:19 UTC (rev 121764)
@@ -1,3 +1,18 @@
+2012-07-03  Alexander Pavlov  <[email protected]>
+
+        [REGRESSION] Crash when copying a StyleRuleMedia with a NULL m_mediaQueries
+        https://bugs.webkit.org/show_bug.cgi?id=90459
+
+        Reviewed by Andreas Kling.
+
+        Create StyleRuleMedia with a non-NULL MediaQuerySet. The respective NULL checks for it were all over the code,
+        except the copy constructor. Added the check, just in case.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::createMediaRule):
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleMedia::StyleRuleMedia):
+
 2012-07-03  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: display time intervals measured with console.time() and console.timeEnd() in Timeline

Modified: trunk/Source/WebCore/css/CSSParser.cpp (121763 => 121764)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-07-03 14:44:19 UTC (rev 121764)
@@ -9401,10 +9401,10 @@
     m_allowImportRules = m_allowNamespaceDeclarations = false;
     RefPtr<StyleRuleMedia> rule;
     if (rules)
-        rule = StyleRuleMedia::create(media, *rules);
+        rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), *rules);
     else {
         RuleList emptyRules;
-        rule = StyleRuleMedia::create(media, emptyRules);
+        rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), emptyRules);
     }
     StyleRuleMedia* result = rule.get();
     m_parsedRules.append(rule.release());

Modified: trunk/Source/WebCore/css/StyleRule.cpp (121763 => 121764)


--- trunk/Source/WebCore/css/StyleRule.cpp	2012-07-03 13:47:40 UTC (rev 121763)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2012-07-03 14:44:19 UTC (rev 121764)
@@ -285,8 +285,9 @@
 
 StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o)
     : StyleRuleBlock(o)
-    , m_mediaQueries(o.m_mediaQueries->copy())
 {
+    if (o.m_mediaQueries)
+        m_mediaQueries = o.m_mediaQueries->copy();
 }
 
 StyleRuleRegion::StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to