Web Inspector: CSS parser errors in the console should include column numbers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Mar 2015 06:11:10 +0000 (06:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Mar 2015 06:11:10 +0000 (06:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=114313

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-03-10
Reviewed by Benjamin Poulain.

Source/WebCore:

Test: inspector-protocol/console/warnings-errors.html

* css/CSSParser.h:
(WebCore::CSSParser::currentCharacterOffset):
Get the current character offset depending on the source type.
Add instance variables to track column position and start
line / column for inline stylesheets.

* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::parseSheet):
Initialize new instance variables.

(WebCore::CSSParser::currentLocation):
Update to include column information. Also, if we are on the first line
we may need to take into account a start column offset as well.

(WebCore::CSSParser::realLex):
When bumping the line number, reset the column offset for the next
line with the next character.

(WebCore::CSSParser::syntaxError):
(WebCore::CSSParser::logError):
Include column information.

* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::parseString):
(WebCore::StyleSheetContents::parseStringAtLineAndColumn):
Include column information.

* css/StyleSheetContents.h:
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::InlineStyleSheetOwner):
(WebCore::InlineStyleSheetOwner::createSheet):
Save and use column information later on.

* dom/InlineStyleSheetOwner.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::ensureSourceData):
Updated parser signature needs starting column and no longer has optional parameters.

Source/WebInspectorUI:

* UserInterface/Views/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._linkifyLocation):
Column numbers in console messages are also 1 based and should be adjusted.

LayoutTests:

Test errors in both external and inline CSS and Scripts to ensure they have
expected line:column information.

* inspector-protocol/console/warnings-errors-expected.txt: Added.
* inspector-protocol/console/warnings-errors.html: Added.
* inspector-protocol/resources/errors.css: Added.
* inspector-protocol/resources/errors.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181367 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/console/warnings-errors-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/console/warnings-errors.html [new file with mode: 0644]
LayoutTests/inspector-protocol/resources/errors.css [new file with mode: 0644]
LayoutTests/inspector-protocol/resources/errors.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/css/StyleSheetContents.h
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/InlineStyleSheetOwner.h
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js

index d93be3e..641ba3a 100644 (file)
@@ -1,3 +1,18 @@
+2015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        Test errors in both external and inline CSS and Scripts to ensure they have
+        expected line:column information.
+
+        * inspector-protocol/console/warnings-errors-expected.txt: Added.
+        * inspector-protocol/console/warnings-errors.html: Added.
+        * inspector-protocol/resources/errors.css: Added.
+        * inspector-protocol/resources/errors.js: Added.
+
 2015-03-10  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Unreviewed EFL gardening on 10th Mar.
diff --git a/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt b/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt
new file mode 100644 (file)
index 0000000..6743bf4
--- /dev/null
@@ -0,0 +1,25 @@
+CONSOLE MESSAGE: line 1: error script
+CONSOLE MESSAGE: line 1: warn script
+CONSOLE MESSAGE: line 5: error script
+CONSOLE MESSAGE: line 6: warn script
+CONSOLE MESSAGE: line 15: TypeError: undefined is not an object (evaluating '[].x.x')
+CONSOLE MESSAGE: line 17: warn 1
+CONSOLE MESSAGE: line 17: error 1
+CONSOLE MESSAGE: line 18: error 2
+Tests that CSS/JavaScript errors and warnings are sent to the console with line and column information.
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:5:20"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:6:14"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:7:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:9:8"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"}
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
+{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"warnings-errors.html:15:18"}
+{"source":"console-api","level":"warning","text":"warn 1","location":"warnings-errors.html:17:13","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 1","location":"warnings-errors.html:17:38","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 2","location":"warnings-errors.html:18:17","parameters":[{"type":"string"}]}
+
diff --git a/LayoutTests/inspector-protocol/console/warnings-errors.html b/LayoutTests/inspector-protocol/console/warnings-errors.html
new file mode 100644 (file)
index 0000000..81abfcc
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<link rel="stylesheet" href="../resources/errors.css">
+  <style>    div { * color: red; }</style>
+<style>div { * color: red; }
+div { * color: red; }
+   div {
+       *
+       color:
+       red;
+   }
+</style>
+<script src="../resources/errors.js" type="text/javascript" charset="utf-8"></script>
+  <script>   [].x.x   </script>
+<script>
+console.warn("warn 1"); console.error("error 1");
+   console.error("error 2");
+</script>
+<script>
+function test()
+{
+    InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
+
+    InspectorTest.sendCommand("Console.enable", {});
+
+    var consoleMessageCount = 0;
+    const expectedConsoleMessages = 15;
+
+    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
+    {
+        var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
+        InspectorTest.log(JSON.stringify(simplifiedMessage));
+
+        if (++consoleMessageCount === expectedConsoleMessages)
+            InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests that CSS/JavaScript errors and warnings are sent to the console with line and column information.<br>
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector-protocol/resources/errors.css b/LayoutTests/inspector-protocol/resources/errors.css
new file mode 100644 (file)
index 0000000..285b421
--- /dev/null
@@ -0,0 +1,7 @@
+div { * color: red; } div { * color: red; }
+
+div {
+    *
+    color:
+    red;
+}
diff --git a/LayoutTests/inspector-protocol/resources/errors.js b/LayoutTests/inspector-protocol/resources/errors.js
new file mode 100644 (file)
index 0000000..d437eae
--- /dev/null
@@ -0,0 +1,9 @@
+console.error("error script"); console.warn("warn script");
+
+
+function foo() {
+    console.error("error script");
+    console.warn("warn script");
+}
+
+foo();
index 722523b..2c36668 100644 (file)
@@ -1,3 +1,52 @@
+2015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        Test: inspector-protocol/console/warnings-errors.html
+
+        * css/CSSParser.h:
+        (WebCore::CSSParser::currentCharacterOffset):
+        Get the current character offset depending on the source type.
+        Add instance variables to track column position and start
+        line / column for inline stylesheets.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::CSSParser):
+        (WebCore::CSSParser::parseSheet):
+        Initialize new instance variables.
+
+        (WebCore::CSSParser::currentLocation):
+        Update to include column information. Also, if we are on the first line
+        we may need to take into account a start column offset as well.
+
+        (WebCore::CSSParser::realLex):
+        When bumping the line number, reset the column offset for the next
+        line with the next character.
+
+        (WebCore::CSSParser::syntaxError):
+        (WebCore::CSSParser::logError):
+        Include column information.
+
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::parseAuthorStyleSheet):
+        (WebCore::StyleSheetContents::parseString):
+        (WebCore::StyleSheetContents::parseStringAtLineAndColumn):
+        Include column information.
+
+        * css/StyleSheetContents.h:
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::InlineStyleSheetOwner::InlineStyleSheetOwner):
+        (WebCore::InlineStyleSheetOwner::createSheet):
+        Save and use column information later on.
+
+        * dom/InlineStyleSheetOwner.h:
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::ensureSourceData):
+        Updated parser signature needs starting column and no longer has optional parameters.
+
 2015-03-10  Darin Adler  <darin@apple.com>
 
         Try to fix the GTK build.
index 6fb0285..c5b1718 100644 (file)
@@ -331,6 +331,9 @@ CSSParser::CSSParser(const CSSParserContext& context)
     , m_lineNumber(0)
     , m_tokenStartLineNumber(0)
     , m_lastSelectorLineNumber(0)
+    , m_columnOffsetForLine(0)
+    , m_sheetStartLineNumber(0)
+    , m_sheetStartColumnNumber(0)
     , m_allowImportRules(true)
     , m_allowNamespaceDeclarations(true)
 #if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -429,7 +432,7 @@ void CSSParser::setupParser(const char* prefix, unsigned prefixLength, StringVie
     m_lexFunc = &CSSParser::realLex<UChar>;
 }
 
-void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int startLineNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
+void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int startLineNumber, int startColumnNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
 {
     setStyleSheet(sheet);
     m_defaultNamespace = starAtom; // Reset the default namespace.
@@ -440,6 +443,9 @@ void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int
     m_logErrors = logErrors && sheet->singleOwnerDocument() && !sheet->baseURL().isEmpty() && sheet->singleOwnerDocument()->page();
     m_ignoreErrorsInDeclaration = false;
     m_lineNumber = startLineNumber;
+    m_columnOffsetForLine = 0;
+    m_sheetStartLineNumber = startLineNumber;
+    m_sheetStartColumnNumber = startColumnNumber;
     setupParser("", string, "");
     cssyyparse(this);
     sheet->shrinkToFit();
@@ -10483,10 +10489,19 @@ CSSParser::Location CSSParser::currentLocation()
 {
     Location location;
     location.lineNumber = m_tokenStartLineNumber;
+    location.columnNumber = tokenStartOffset() - m_columnOffsetForLine;
+
+    ASSERT(location.lineNumber >= 0);
+    ASSERT(location.columnNumber >= 0);
+
+    if (m_tokenStartLineNumber == m_sheetStartLineNumber)
+        location.columnNumber += m_sheetStartColumnNumber;
+
     if (is8BitSource())
         location.token.init(tokenStart<LChar>(), currentCharacter<LChar>() - tokenStart<LChar>());
     else
         location.token.init(tokenStart<UChar>(), currentCharacter<UChar>() - tokenStart<UChar>());
+
     return location;
 }
 
@@ -11580,9 +11595,12 @@ restartAfterComment:
         // Might start with a '\n'.
         --currentCharacter<SrcCharacterType>();
         do {
-            if (*currentCharacter<SrcCharacterType>() == '\n')
+            if (*currentCharacter<SrcCharacterType>() == '\n') {
                 ++m_lineNumber;
-            ++currentCharacter<SrcCharacterType>();
+                ++currentCharacter<SrcCharacterType>();
+                m_columnOffsetForLine = currentCharacterOffset();
+            } else
+                ++currentCharacter<SrcCharacterType>();
         } while (*currentCharacter<SrcCharacterType>() <= ' ' && (typesOfASCIICharacters[*currentCharacter<SrcCharacterType>()] == CharacterWhiteSpace));
         break;
 
@@ -11650,8 +11668,12 @@ restartAfterComment:
         if (*currentCharacter<SrcCharacterType>() == '*') {
             ++currentCharacter<SrcCharacterType>();
             while (currentCharacter<SrcCharacterType>()[0] != '*' || currentCharacter<SrcCharacterType>()[1] != '/') {
-                if (*currentCharacter<SrcCharacterType>() == '\n')
+                if (*currentCharacter<SrcCharacterType>() == '\n') {
                     ++m_lineNumber;
+                    ++currentCharacter<SrcCharacterType>();
+                    m_columnOffsetForLine = currentCharacterOffset();
+                    continue;
+                }
                 if (*currentCharacter<SrcCharacterType>() == '\0') {
                     // Unterminated comments are simply ignored.
                     currentCharacter<SrcCharacterType>() -= 2;
@@ -11869,14 +11891,15 @@ void CSSParser::syntaxError(const Location& location, SyntaxErrorType error)
 {
     if (!isLoggingErrors())
         return;
+
     StringBuilder builder;
     switch (error) {
     case PropertyDeclarationError:
         builder.appendLiteral("Invalid CSS property declaration at: ");
         break;
-
     default:
         builder.appendLiteral("Unexpected CSS token: ");
+        break;
     }
 
     if (location.token.is8Bit())
@@ -11884,7 +11907,7 @@ void CSSParser::syntaxError(const Location& location, SyntaxErrorType error)
     else
         builder.append(location.token.characters16(), location.token.length());
 
-    logError(builder.toString(), location.lineNumber);
+    logError(builder.toString(), location.lineNumber, location.columnNumber);
 
     m_ignoreErrorsInDeclaration = true;
 }
@@ -11894,11 +11917,10 @@ bool CSSParser::isLoggingErrors()
     return m_logErrors && !m_ignoreErrorsInDeclaration;
 }
 
-void CSSParser::logError(const String& message, int lineNumber)
+void CSSParser::logError(const String& message, int lineNumber, int columnNumber)
 {
-    // FIXME: <http://webkit.org/b/114313> CSS parser console message errors should include column numbers.
     PageConsoleClient& console = m_styleSheet->singleOwnerDocument()->page()->console();
-    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
+    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet->baseURL().string(), lineNumber + 1, columnNumber + 1);
 }
 
 PassRefPtr<StyleRuleKeyframes> CSSParser::createKeyframesRule(const String& name, std::unique_ptr<Vector<RefPtr<StyleKeyframe>>> popKeyframes)
index 66e21f8..c350358 100644 (file)
@@ -105,7 +105,7 @@ public:
 
     WEBCORE_EXPORT ~CSSParser();
 
-    void parseSheet(StyleSheetContents*, const String&, int startLineNumber = 0, RuleSourceDataList* = nullptr, bool = false);
+    void parseSheet(StyleSheetContents*, const String&, int startLineNumber, int startColumnNumber, RuleSourceDataList*, bool logErrors);
     PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
     PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
     bool parseSupportsCondition(const String&);
@@ -464,6 +464,8 @@ private:
     inline unsigned tokenStartOffset();
     inline UChar tokenStartChar();
 
+    inline unsigned currentCharacterOffset();
+
     template <typename CharacterType>
     inline bool isIdentifierStart();
 
@@ -593,6 +595,10 @@ private:
     int m_lineNumber;
     int m_tokenStartLineNumber;
     int m_lastSelectorLineNumber;
+    int m_columnOffsetForLine;
+
+    int m_sheetStartLineNumber;
+    int m_sheetStartColumnNumber;
 
     bool m_allowImportRules;
     bool m_allowNamespaceDeclarations;
@@ -642,7 +648,7 @@ private:
     };
 
     bool isLoggingErrors();
-    void logError(const String& message, int lineNumber);
+    void logError(const String& message, int lineNumber, int columnNumber);
 
     bool validateCalculationUnit(ValueWithCalculation&, Units);
 
@@ -686,6 +692,7 @@ private:
 
 struct CSSParser::Location {
     int lineNumber;
+    int columnNumber;
     CSSParserString token;
 };
 
@@ -714,6 +721,13 @@ inline unsigned CSSParser::tokenStartOffset()
     return m_tokenStart.ptr16 - m_dataStart16.get();
 }
 
+inline unsigned CSSParser::currentCharacterOffset()
+{
+    if (is8BitSource())
+        return m_currentCharacter8 - m_dataStart8.get();
+    return m_currentCharacter16 - m_dataStart16.get();
+}
+
 inline UChar CSSParser::tokenStartChar()
 {
     if (is8BitSource())
index 741cb64..5b7e422 100644 (file)
@@ -291,7 +291,7 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached
     String sheetText = cachedStyleSheet->sheetText(&hasValidMIMEType);
 
     CSSParser p(parserContext());
-    p.parseSheet(this, sheetText, 0, 0, true);
+    p.parseSheet(this, sheetText, 0, 0, nullptr, true);
 
     // If we're loading a stylesheet cross-origin, and the MIME type is not standard, require the CSS
     // to at least start with a syntactically valid CSS rule.
@@ -316,13 +316,13 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached
 
 bool StyleSheetContents::parseString(const String& sheetText)
 {
-    return parseStringAtLine(sheetText, 0, false);
+    return parseStringAtLineAndColumn(sheetText, 0, 0, false);
 }
 
-bool StyleSheetContents::parseStringAtLine(const String& sheetText, int startLineNumber, bool createdByParser)
+bool StyleSheetContents::parseStringAtLineAndColumn(const String& sheetText, int startLineNumber, int startColumnNumber, bool createdByParser)
 {
     CSSParser p(parserContext());
-    p.parseSheet(this, sheetText, startLineNumber, 0, createdByParser);
+    p.parseSheet(this, sheetText, startLineNumber, startColumnNumber, nullptr, createdByParser);
 
     return true;
 }
index e14b07a..6ca03d2 100644 (file)
@@ -62,7 +62,7 @@ public:
 
     void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*);
     WEBCORE_EXPORT bool parseString(const String&);
-    bool parseStringAtLine(const String&, int startLineNumber, bool);
+    bool parseStringAtLineAndColumn(const String&, int startLineNumber, int startColumnNumber, bool createdByParser);
 
     bool isCacheable() const;
 
index ec7768b..cdfb84b 100644 (file)
@@ -35,10 +35,10 @@ namespace WebCore {
 InlineStyleSheetOwner::InlineStyleSheetOwner(Document& document, bool createdByParser)
     : m_isParsingChildren(createdByParser)
     , m_loading(false)
-    , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
+    , m_startTextPosition(WTF::OrdinalNumber::beforeFirst(), WTF::OrdinalNumber::beforeFirst())
 {
     if (createdByParser && document.scriptableDocumentParser() && !document.isInDocumentWrite())
-        m_startLineNumber = document.scriptableDocumentParser()->textPosition().m_line;
+        m_startTextPosition = document.scriptableDocumentParser()->textPosition();
 }
 
 InlineStyleSheetOwner::~InlineStyleSheetOwner()
@@ -123,7 +123,7 @@ void InlineStyleSheetOwner::createSheet(Element& element, const String& text)
 
     if (!isValidCSSContentType(element, m_contentType))
         return;
-    if (!document.contentSecurityPolicy()->allowInlineStyle(document.url(), m_startLineNumber))
+    if (!document.contentSecurityPolicy()->allowInlineStyle(document.url(), m_startTextPosition.m_line))
         return;
 
     RefPtr<MediaQuerySet> mediaQueries;
@@ -144,7 +144,7 @@ void InlineStyleSheetOwner::createSheet(Element& element, const String& text)
     m_sheet = CSSStyleSheet::createInline(element, URL(), document.inputEncoding());
     m_sheet->setMediaQueries(mediaQueries.release());
     m_sheet->setTitle(element.title());
-    m_sheet->contents().parseStringAtLine(text, m_startLineNumber.zeroBasedInt(), m_isParsingChildren);
+    m_sheet->contents().parseStringAtLineAndColumn(text, m_startTextPosition.m_line.zeroBasedInt(), m_startTextPosition.m_column.zeroBasedInt(), m_isParsingChildren);
 
     m_loading = false;
 
index 6f422c9..1ef3ed2 100644 (file)
@@ -57,7 +57,7 @@ private:
 
     bool m_isParsingChildren;
     bool m_loading;
-    WTF::OrdinalNumber m_startLineNumber;
+    WTF::TextPosition m_startTextPosition;
     AtomicString m_contentType;
     AtomicString m_media;
     RefPtr<CSSStyleSheet> m_sheet;
index 08bdbee..69fe39d 100644 (file)
@@ -1106,7 +1106,7 @@ bool InspectorStyleSheet::ensureSourceData()
 
     RefPtr<StyleSheetContents> newStyleSheet = StyleSheetContents::create();
     auto ruleSourceDataResult = std::make_unique<RuleSourceDataList>();
-    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, ruleSourceDataResult.get());
+    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, 0, ruleSourceDataResult.get(), false);
     m_parsedStyleSheet->setSourceData(WTF::move(ruleSourceDataResult));
     return m_parsedStyleSheet->hasSourceData();
 }
index 901af52..f8cb9ec 100644 (file)
@@ -1,5 +1,16 @@
 2015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        * UserInterface/Views/ConsoleMessageImpl.js:
+        (WebInspector.ConsoleMessageImpl.prototype._linkifyLocation):
+        Column numbers in console messages are also 1 based and should be adjusted.
+
+2015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: console.error output broken, does not produce ObjectTree
         https://bugs.webkit.org/show_bug.cgi?id=142554
 
index 535dbcc..3f46975 100644 (file)
@@ -199,6 +199,7 @@ WebInspector.ConsoleMessageImpl.prototype = {
     {
         // ConsoleMessage stack trace line numbers are one-based.
         lineNumber = lineNumber ? lineNumber - 1 : 0;
+        columnNumber = columnNumber ? columnNumber - 1 : 0;
 
         return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");
     },