Bug 149185 - CSS parser unable to recover after invalid @media block
Summary: CSS parser unable to recover after invalid @media block
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 9
Hardware: Macintosh OS X 10.10
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2015-09-15 14:53 PDT by Derk-Jan Hartman
Modified: 2015-09-17 08:37 PDT (History)
2 users (show)

See Also:


Attachments
Reduced testcase (227 bytes, text/html)
2015-09-15 14:53 PDT, Derk-Jan Hartman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Derk-Jan Hartman 2015-09-15 14:53:39 PDT
Created attachment 261241 [details]
Reduced testcase

The attached testcase shows that after an invalid media query block inside <style>, the CSS parser is unable to recover and ignores anything and everything that will follow the invalid block.

Browsers like Chrome and Firefox, ignore the first statement after the invalid media query block (which in the testcase would have made the div blue), but then do apply any following statements (in the testcase making the div green).

This caused a serious CSS styling issue on Wikimedia Commons, where a good percentage of CSS statements was ignored by Safari. Downstream report in Wikipedia: https://phabricator.wikimedia.org/T112552#1643002