Changeset 36624 in webkit


Ignore:
Timestamp:
Sep 18, 2008 3:18:01 PM (16 years ago)
Author:
Beth Dakin
Message:

WebCore:

2008-09-18 Beth Dakin <Beth Dakin>

Reviewed by Dave Hyatt.

Fix for https://bugs.webkit.org/show_bug.cgi?id=20515 Crash upon
parsing CSS: unicode-range: searchfield-cancel-buttonpt=-webkit-
dashboard-region=
and corresponding: <rdar://problem/6174100>

This patch makes CSSParserValue::createCSSValue handle unknown
identifiers.

  • css/CSSParserValues.cpp: (WebCore::CSSParserValue::createCSSValue): If we have an identifier with no id (an unknown identifier) create a CSSPrimitiveValue of type CSS_PARSER_IDENTIFIER
  • css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::cssText): (WebCore::CSSPrimitiveValue::parserValue):
  • css/CSSPrimitiveValue.h: (WebCore::CSSPrimitiveValue::):

LayoutTests:

2008-09-18 Beth Dakin <Beth Dakin>

Reviewed by Dave Hyatt.

Test for https://bugs.webkit.org/show_bug.cgi?id=20515 Crash upon
parsing CSS: unicode-range: searchfield-cancel-buttonpt=-webkit-
dashboard-region=
and corresponding: <rdar://problem/6174100>

  • fast/css/variables/invalid-identifier-expected.txt: Added.
  • fast/css/variables/invalid-identifier.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r36608 r36624  
     12008-09-18  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Test for https://bugs.webkit.org/show_bug.cgi?id=20515 Crash upon
     6        parsing CSS: unicode-range: searchfield-cancel-buttonpt=-webkit-
     7        dashboard-region=
     8        and corresponding: <rdar://problem/6174100>
     9
     10        * fast/css/variables/invalid-identifier-expected.txt: Added.
     11        * fast/css/variables/invalid-identifier.html: Added.
     12
    1132008-09-18  Mark Rowe  <mrowe@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r36623 r36624  
     12008-09-18  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=20515 Crash upon
     6        parsing CSS: unicode-range: searchfield-cancel-buttonpt=-webkit-
     7        dashboard-region=
     8        and corresponding: <rdar://problem/6174100>
     9
     10        This patch makes CSSParserValue::createCSSValue handle unknown
     11        identifiers.
     12
     13        * css/CSSParserValues.cpp:
     14        (WebCore::CSSParserValue::createCSSValue): If we have an identifier
     15        with no id (an unknown identifier) create a CSSPrimitiveValue of
     16        type CSS_PARSER_IDENTIFIER
     17        * css/CSSPrimitiveValue.cpp:
     18        (WebCore::CSSPrimitiveValue::cssText):
     19        (WebCore::CSSPrimitiveValue::parserValue):
     20        * css/CSSPrimitiveValue.h:
     21        (WebCore::CSSPrimitiveValue::):
     22
    1232008-09-18  Sam Weinig  <sam@webkit.org>
    224
  • trunk/WebCore/css/CSSParserValues.cpp

    r35351 r36624  
    6262    if (id)
    6363        parsedValue = CSSPrimitiveValue::createIdentifier(id);
     64    else if (unit == CSSPrimitiveValue::CSS_IDENT)
     65        parsedValue = CSSPrimitiveValue::create(string, CSSPrimitiveValue::CSS_PARSER_IDENTIFIER);
    6466    else if (unit == CSSPrimitiveValue::CSS_NUMBER && isInt)
    6567        parsedValue = CSSPrimitiveValue::create(fValue, CSSPrimitiveValue::CSS_PARSER_INTEGER);
  • trunk/WebCore/css/CSSPrimitiveValue.cpp

    r35351 r36624  
    770770            text = String(&c, 1U);
    771771            break;
     772        case CSS_PARSER_IDENTIFIER:
     773            text = quoteStringIfNeeded(m_value.string);
     774            break;
    772775    }
    773776    return text;
     
    829832            value.isInt = true;
    830833            break;
     834        case CSS_PARSER_IDENTIFIER:
     835            value.string.characters = const_cast<UChar*>(m_value.string->characters());
     836            value.string.length = m_value.string->length();
     837            value.unit = CSSPrimitiveValue::CSS_IDENT;
     838            break;
    831839        case CSS_UNKNOWN:
    832840        case CSS_ATTR:
  • trunk/WebCore/css/CSSPrimitiveValue.h

    r35351 r36624  
    7676        CSS_PARSER_VARIABLE_EQUALS_SYNTAX = 106,
    7777        CSS_PARSER_VARIABLE_DOLLAR_SYNTAX = 107,
    78         CSS_PARSER_HEXCOLOR = 108
     78        CSS_PARSER_HEXCOLOR = 108,
     79       
     80        // This is used internally for unknown identifiers
     81        CSS_PARSER_IDENTIFIER = 109
    7982    };
    8083
Note: See TracChangeset for help on using the changeset viewer.