Changeset 121764 in webkit


Ignore:
Timestamp:
Jul 3, 2012 7:44:19 AM (12 years ago)
Author:
apavlov@chromium.org
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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121763 r121764  
     12012-07-03  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        [REGRESSION] Crash when copying a StyleRuleMedia with a NULL m_mediaQueries
     4        https://bugs.webkit.org/show_bug.cgi?id=90459
     5
     6        Reviewed by Andreas Kling.
     7
     8        * inspector/styles/get-set-stylesheet-text-expected.txt:
     9        * inspector/styles/resources/get-set-stylesheet-text.css:
     10        (@media):
     11
    1122012-07-03  Andrey Kosyakov  <caseq@chromium.org>
    213
  • trunk/LayoutTests/inspector/styles/get-set-stylesheet-text-expected.txt

    r103761 r121764  
    1515    important:!important;
    1616    color: "badcolor" ! important /* good property with strange value */;
     17}
     18
     19@media {
     20    /* @media rule with an empty media list */
    1721}
    1822
  • trunk/LayoutTests/inspector/styles/resources/get-set-stylesheet-text.css

    r82252 r121764  
    1010}
    1111
     12@media {
     13    /* @media rule with an empty media list */
     14}
     15
    1216/* comment before selector */body.main1/* comment after selector */{/* comment */color: #F00BAA;zoo:moo /* not an !important unrecognized property */}/* comment */
    1317
  • trunk/Source/WebCore/ChangeLog

    r121763 r121764  
     12012-07-03  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        [REGRESSION] Crash when copying a StyleRuleMedia with a NULL m_mediaQueries
     4        https://bugs.webkit.org/show_bug.cgi?id=90459
     5
     6        Reviewed by Andreas Kling.
     7
     8        Create StyleRuleMedia with a non-NULL MediaQuerySet. The respective NULL checks for it were all over the code,
     9        except the copy constructor. Added the check, just in case.
     10
     11        * css/CSSParser.cpp:
     12        (WebCore::CSSParser::createMediaRule):
     13        * css/StyleRule.cpp:
     14        (WebCore::StyleRuleMedia::StyleRuleMedia):
     15
    1162012-07-03  Andrey Kosyakov  <caseq@chromium.org>
    217
  • trunk/Source/WebCore/css/CSSParser.cpp

    r121551 r121764  
    94029402    RefPtr<StyleRuleMedia> rule;
    94039403    if (rules)
    9404         rule = StyleRuleMedia::create(media, *rules);
     9404        rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), *rules);
    94059405    else {
    94069406        RuleList emptyRules;
    9407         rule = StyleRuleMedia::create(media, emptyRules);
     9407        rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), emptyRules);
    94089408    }
    94099409    StyleRuleMedia* result = rule.get();
  • trunk/Source/WebCore/css/StyleRule.cpp

    r120943 r121764  
    286286StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o)
    287287    : StyleRuleBlock(o)
    288     , m_mediaQueries(o.m_mediaQueries->copy())
    289 {
     288{
     289    if (o.m_mediaQueries)
     290        m_mediaQueries = o.m_mediaQueries->copy();
    290291}
    291292
Note: See TracChangeset for help on using the changeset viewer.