<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>149185</bug_id>
          
          <creation_ts>2015-09-15 14:53:39 -0700</creation_ts>
          <short_desc>CSS parser unable to recover after invalid @media block</short_desc>
          <delta_ts>2020-10-29 06:08:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 9</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.10</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Derk-Jan Hartman">hartman.wiki</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>koivisto</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1126143</commentid>
    <comment_count>0</comment_count>
      <attachid>261241</attachid>
    <who name="Derk-Jan Hartman">hartman.wiki</who>
    <bug_when>2015-09-15 14:53:39 -0700</bug_when>
    <thetext>Created attachment 261241
Reduced testcase

The attached testcase shows that after an invalid media query block inside &lt;style&gt;, 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1702691</commentid>
    <comment_count>1</comment_count>
    <who name="Derk-Jan Hartman">hartman.wiki</who>
    <bug_when>2020-10-29 06:08:25 -0700</bug_when>
    <thetext>Seems this is fixed somewhere between Safari 9 and Safari 14.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>261241</attachid>
            <date>2015-09-15 14:53:39 -0700</date>
            <delta_ts>2015-09-15 14:53:39 -0700</delta_ts>
            <desc>Reduced testcase</desc>
            <filename>CSS parser fatal.html</filename>
            <type>text/html</type>
            <size>227</size>
            <attacher name="Derk-Jan Hartman">hartman.wiki</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPiNzaXRlU3ViIHtiYWNrZ3JvdW5k
OnJlZDt3aWR0aDoxMDBweDtoZWlnaHQ6MTAwcHg7fUBtZWRpYSBzY3JlZW4gI3NpdGVTdWJ7YmFj
a2dyb3VuZDpibHVlfSAjc2l0ZVN1YntiYWNrZ3JvdW5kOmdyZWVufTwvc3R5bGU+CjwvaGVhZD4K
PGJvZHk+CiAgICA8ZGl2IGlkPSJzaXRlU3ViIj4KICAgIDwvZGl2Pgo8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>