Automatic update from web-platform-tests Silently ignore unknown CSS URL modifiers A CSSWG resolution[1] says that unknown modifiers should be silently ignored rather than invalidating the whole function. We shouldn't allow duplicated modifiers[2], which makes that slightly more tricky, so we also need to track whether (which?) unknown modifiers are duplicated. [1] https://github.com/w3c/csswg-drafts/issues/1603#issuecomment-467221081 [2] https://github.com/w3c/csswg-drafts/issues/12151#issuecomment-3009005578 Bug: 435625756 Change-Id: I74f4979605713173b32ea6da4a244d39de6d815c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7807092 Reviewed-by: Fredrik Söderquist <fs@opera.com> Commit-Queue: jj <jj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1624624} -- wpt-commits: 0513a9e6e4beca68d576ed0f9dca0e5c0f358681 wpt-pr: 59632
60 lines
5.8 KiB
HTML
60 lines
5.8 KiB
HTML
<!DOCTYPE html>
|
|
<link rel="help" href="https://drafts.csswg.org/css-values-5/#request-url-modifiers">
|
|
<link rel="author" title="Sam Weinig" href="mailto:weinig@webkit.org">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/css/support/parsing-testcommon.js"></script>
|
|
<script>
|
|
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin())');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(,))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(anonymous,))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(,anonymous))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(anonymous foobar))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(anonymous) cross-origin(anonymous))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(anonymous) cross-origin(use-credentials))');
|
|
test_invalid_value('background-image', 'url(cross-origin(anonymous) "http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png")');
|
|
test_invalid_value('background-image', '"http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" cross-origin(anonymous)');
|
|
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity())');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity(,))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity("sha384-foobar",))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity(,"sha384-foobar"))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity("sha384-foobar" foobar))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity(sha384-foobar))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity("sha384-foobar") integrity("sha384-foobar"))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity("sha384-foobar") integrity("sha384-barbaz"))');
|
|
test_invalid_value('background-image', 'url(integrity("sha384-foobar") "http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png")');
|
|
test_invalid_value('background-image', '"http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" integrity("sha384-foobar")');
|
|
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy())');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(,))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer,))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(,no-referrer))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer foobar))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer same-origin))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer) referrer-policy(no-referrer))');
|
|
test_invalid_value('background-image', 'url("http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer) referrer-policy(same-origin))');
|
|
test_invalid_value('background-image', 'url(referrer-policy(no-referrer) "http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png")');
|
|
test_invalid_value('background-image', '"http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png" referrer-policy(no-referrer)');
|
|
|
|
// Duplicates of unknown <url-modifier>s are not allowed, even though
|
|
// individual unknown modifiers are silently ignored.
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" foobar(baz) foobar(baz))');
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" foobar(baz) foobar(qux))');
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" foobar foobar)');
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" FooBar foobar)');
|
|
|
|
// Tokens that aren't an ident or function should be a parse error.
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" 42)');
|
|
test_invalid_value('background-image', 'url("/css/support/1x1-green.png" "foobar")');
|
|
|
|
// "A <url> that is either unquoted or not wrapped in url() notation
|
|
// cannot accept any <url-modifier>s."
|
|
// https://drafts.csswg.org/css-values-4/#url-modifiers
|
|
test_invalid_value('background-image', 'url(http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png cross-origin(anonymous))');
|
|
test_invalid_value('background-image', 'url(http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png integrity("sha384-foobar"))');
|
|
test_invalid_value('background-image', 'url(http://{{hosts[][]}}:{{ports[http][0]}}/css/support/1x1-green.png referrer-policy(no-referrer))');
|
|
|
|
</script>
|