Bug 149185

Summary: CSS parser unable to recover after invalid @media block
Product: WebKit Reporter: Derk-Jan Hartman <hartman.wiki>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto, simon.fraser
Priority: P2 Keywords: HasReduction
Version: Safari 9   
Hardware: Mac   
OS: OS X 10.10   
Attachments:
Description Flags
Reduced testcase none

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
Comment 1 Derk-Jan Hartman 2020-10-29 06:08:25 PDT
Seems this is fixed somewhere between Safari 9 and Safari 14.