Bug 9687 - WebKit needs to log CSS errors (like FireFox & FireBug do)
Summary: WebKit needs to log CSS errors (like FireFox & FireBug do)
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Normal
Assignee: Nobody
: 14358 (view as bug list)
Depends on:
Blocks: 19236
  Show dependency treegraph
Reported: 2006-07-01 22:40 PDT by Eric Seidel (no email)
Modified: 2014-01-13 09:06 PST (History)
8 users (show)

See Also:

A hack to make this possible (2.06 KB, patch)
2006-12-24 07:40 PST, Eric Seidel (no email)
darin: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2006-07-01 22:40:05 PDT
WebKit needs to be able to log CSS errors (like FireFox & FireBug do)

These should be logged any time a declaration is dropped, or a value is ignored.
Comment 1 Eric Seidel (no email) 2006-09-18 20:33:02 PDT
I looked at this very briefly.  I would need to talk to hyatt to better understand where we might hook in.

There are several places where you might want to throw CSS-related error messages, not all of which should have the same error information.

Two examples:
1. parsing a stylesheet for a page.
2.  setting a style value via javascript.

Firefox handles case 1 quite nicely, but case 2 very poorly (it shows a useless error message).  Ideally we would design a system to work across most if not all of the cases where the CSS parser should "throw errors".
Comment 2 Dave Hyatt 2006-09-18 21:48:48 PDT
Errors basically break down into two classes I think...

(1) Errors that bison would catch, e.g., bad tokens, bad combinations, etc.

(2) Errors that cssparser.cpp would catch, i.e., grammatically well-formed properties that are simply illegal (wrong unit types, wrong # of arguments, etc.)

(1) is pretty hard, since we often don't even handle those errors well for real. :)
(2) is easier and probably where you'd get more bang for your buck anyway.
Comment 3 mitz 2006-12-16 14:12:07 PST
See also bug 7296.
Comment 4 Eric Seidel (no email) 2006-12-24 07:40:54 PST
Created attachment 12000 [details]
A hack to make this possible

I don't really expect anyone to take this patch seriously.  However it does address the issue at hand (and hopefully could start some small dialog on the subject).
Comment 5 Alexey Proskuryakov 2006-12-24 07:56:08 PST
Do we also want to distinguish errors, warnings and messages, as Firefox does?
Comment 6 Alexey Proskuryakov 2006-12-24 08:22:43 PST
Actually, this patch seems to match bug 10361 better.
Comment 7 Geoffrey Garen 2006-12-24 13:18:10 PST
Doesn't this patch mean "only log JS errors?"
Comment 8 Eric Seidel (no email) 2006-12-24 16:36:40 PST
Personally, I find Firefox's logging system a bit overly geeky.  The point of only logging JS errors in my hack-patch, was to maintain the status-quo, as logging more than that might be a "UI decision".
Comment 9 Darin Adler 2006-12-27 22:38:29 PST
Comment on attachment 12000 [details]
A hack to make this possible

This doesn't seem necessary. I suggest we start logging more on the console, and later add levels and/or types based on our experience using the console.
Comment 10 Timothy Hatcher 2008-07-19 14:26:03 PDT
*** Bug 14358 has been marked as a duplicate of this bug. ***
Comment 11 BJ Burg 2014-01-12 15:03:05 PST
CSS errors and warnings are logged to console and highlighted in the CSS text editor in the current inspector.
Comment 12 Simon Fraser (smfr) 2014-01-12 22:13:52 PST
But not nearly enough of them. I think we only log syntax errors, right, and then only property names?

What about:
* invalid values
* meaningless combinations of properties (e.g. z-index on non-positioned)
* things with perf impact (negative text-indent without overflow:hidden)
Comment 13 BJ Burg 2014-01-13 09:06:42 PST
Some invalid values are shown as crossed out in the CSS details sidebar, IIRC. The other things sound like audits to me. (I agree we need new audits, but each one in a separate bug.) In any case, I'm not sure that blasting the console with these errors/warnings is the right thing to do. Even with just parse errors today, the console gets filled with junk on popular websites.