Bug 59322 - Web Inspector: CSS is parsed improperly when saved in UTF-8 with a BOM
Summary: Web Inspector: CSS is parsed improperly when saved in UTF-8 with a BOM
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-25 07:59 PDT by Alexander Pavlov (apavlov)
Modified: 2011-04-25 09:33 PDT (History)
10 users (show)

See Also:


Attachments
[PATCH] Suggested fix (5.26 KB, patch)
2011-04-25 08:27 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2011-04-25 07:59:26 PDT
A UTF-8 BOM is not handled properly by the CSSParser (and it should never get through to it).

Upstreaming http://code.google.com/p/chromium/issues/detail?id=78703
Comment 1 Alexander Pavlov (apavlov) 2011-04-25 08:27:59 PDT
Created attachment 90917 [details]
[PATCH] Suggested fix
Comment 2 Yury Semikhatsky 2011-04-25 08:34:08 PDT
Comment on attachment 90917 [details]
[PATCH] Suggested fix

View in context: https://bugs.webkit.org/attachment.cgi?id=90917&action=review

> LayoutTests/inspector/styles/parse-utf8-bom.html:15
> +        InspectorTest.dumpSelectedElementStyles(true, false, true);

Can we be sure that the styles content is already loaded at this point?
Comment 3 Alexander Pavlov (apavlov) 2011-04-25 08:41:00 PDT
(In reply to comment #2)
> (From update of attachment 90917 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=90917&action=review
> 
> > LayoutTests/inspector/styles/parse-utf8-bom.html:15
> > +        InspectorTest.dumpSelectedElementStyles(true, false, true);
> 
> Can we be sure that the styles content is already loaded at this point?

Yes, all external stylesheets will have been loaded by the time window.onload fires.
Comment 4 Alexander Pavlov (apavlov) 2011-04-25 08:54:42 PDT
Committed r84777: <http://trac.webkit.org/changeset/84777>
Comment 5 Pavel Feldman 2011-04-25 09:33:48 PDT
Comment on attachment 90917 [details]
[PATCH] Suggested fix

View in context: https://bugs.webkit.org/attachment.cgi?id=90917&action=review

> Source/WebCore/inspector/InspectorStyleSheet.cpp:1061
> +        success = resourceStyleSheetText(&rawText);

You should instead fetch CachedResource, cast it to the Stylesheet and get decoded data.