[Webkit-unassigned] [Bug 225282] New: Invalid media query keyword values should not be parsable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 2 10:02:42 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225282

            Bug ID: 225282
           Summary: Invalid media query keyword values should not be
                    parsable
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ntim at apple.com

Examples:

prefers-color-scheme: none
prefers-color-scheme: aghadshudfsjhdsfkjhdsfdsfa
prefers-color-scheme: visible
prefers-color-scheme: hidden
prefers-color-scheme: -webkit-sticky
prefers-color-scheme: cssisawesome

Ditto for prefers-contrast

WebKit all considers them as parsable... 

This shows up in our WPT failures (notably the none cases for prefers-contrast/prefers-color-scheme).

Example snippet to reproduce:

function query_is_css_parseable(query) {
  const style = document.createElement('style');
  style.type = 'text/css';
  document.head.appendChild(style);

  const sheet = style.sheet;
  try {
    sheet.insertRule("@media " + query + "{}", 0);
    return sheet.cssRules.length == 1 &&
        sheet.cssRules[0].media.mediaText != "not all";
  } finally {
    while (sheet.cssRules.length)
      sheet.deleteRule(0);
    style.remove();
  }
}

query_is_css_parseable("(prefers-color-scheme: -webkit-sticky)") // should return false

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210502/1d2c1bb7/attachment.htm>


More information about the webkit-unassigned mailing list