Changeset 90304 in webkit


Ignore:
Timestamp:
Jul 1, 2011, 5:43:45 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2011-07-01 Tim Horton <timothy_horton@apple.com>

Reviewed by Darin Adler.

Errors encountered within SVG documents should be reported to the console
https://bugs.webkit.org/show_bug.cgi?id=62599

Add SVGElement::reportAttributeParsingError, which will
write a Web Inspector console message if passed an SVGParsingError
and the attribute which was being applied, only in the case where
there is actually an error.

Include the SVG document's URI when writing to the Web Inspector
console, so that the UI displays both the filename and the line number.

  • svg/SVGDocumentExtensions.cpp: (WebCore::reportMessage):
  • svg/SVGElement.cpp: (WebCore::SVGElement::reportAttributeParsingError):
  • svg/SVGElement.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90303 r90304  
     12011-07-01  Tim Horton  <timothy_horton@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Errors encountered within SVG documents should be reported to the console
     6        https://bugs.webkit.org/show_bug.cgi?id=62599
     7
     8        Add SVGElement::reportAttributeParsingError, which will
     9        write a Web Inspector console message if passed an SVGParsingError
     10        and the attribute which was being applied, only in the case where
     11        there is actually an error.
     12
     13        Include the SVG document's URI when writing to the Web Inspector
     14        console, so that the UI displays both the filename and the line number.
     15
     16        * svg/SVGDocumentExtensions.cpp:
     17        (WebCore::reportMessage):
     18        * svg/SVGElement.cpp:
     19        (WebCore::SVGElement::reportAttributeParsingError):
     20        * svg/SVGElement.h:
     21
    1222011-07-01  Scott Byer  <scottbyer@chromium.org>
    223
  • trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp

    r85413 r90304  
    199199{
    200200    if (Frame* frame = document->frame())
    201         frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, parserLineNumber(document), String());
     201        frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, parserLineNumber(document), document->documentURI());
    202202}
    203203
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r88989 r90304  
    104104}
    105105
     106void SVGElement::reportAttributeParsingError(SVGParsingError error, Attribute* attribute)
     107{
     108    if (error == NoError)
     109        return;
     110
     111    String errorString = "<" + tagName() + "> attribute " + attribute->name().toString() + "=\"" + attribute->value() + "\"";
     112    SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
     113
     114    if (error == NegativeValueForbiddenError) {
     115        extensions->reportError("Invalid negative value for " + errorString);
     116        return;
     117    }
     118
     119    if (error == ParsingAttributeFailedError) {
     120        extensions->reportError("Invalid value for " + errorString);
     121        return;
     122    }
     123
     124    ASSERT_NOT_REACHED();
     125}
     126
     127
    106128bool SVGElement::isSupported(StringImpl* feature, StringImpl* version) const
    107129{
  • trunk/Source/WebCore/svg/SVGElement.h

    r87125 r90304  
    4848    AnimatedTransformList,
    4949    AnimatedUnknown
     50};
     51
     52enum SVGParsingError {
     53    NoError,
     54    ParsingAttributeFailedError,
     55    NegativeValueForbiddenError
    5056};
    5157
     
    124130    SVGElementRareData* ensureRareSVGData();
    125131
     132    void reportAttributeParsingError(SVGParsingError, Attribute*);
     133
    126134private:
    127135    friend class SVGElementInstance;
Note: See TracChangeset for help on using the changeset viewer.