Repository navigation
Parsing tests for CSS UI Level 3 - #10700
Conversation
| test_valid_value("outline", "rgba(10, 20, 30, 0.4)"); | ||
|
|
||
| test_valid_value("outline", "auto"); | ||
| test_valid_value("outline", "none", ["none", "invert"]); // Edge serializes as "invert" |
There was a problem hiding this comment.
I don't think serializing as invert should pass this test.
There was a problem hiding this comment.
Or if it does, please leave a comment with the reasoning from the spec text.
There was a problem hiding this comment.
I have now omitted "invert" as an accepted serialization.
| test_valid_value("outline", "1px"); | ||
| test_valid_value("outline", "calc(2em + 3ex)"); | ||
| test_valid_value("outline", "thin"); | ||
| test_valid_value("outline", "medium", ["medium", "invert"]); // Edge serializes as "invert" |
The tests expose a number of bugs: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16854772/ https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16900961/ https://bugzilla.mozilla.org/show_bug.cgi?id=1453258 [fixed] https://bugzilla.mozilla.org/show_bug.cgi?id=1457652 [fixed] https://bugs.chromium.org/p/chromium/issues/detail?id=708197 [fixed] https://bugs.chromium.org/p/chromium/issues/detail?id=831550
9817fd4 to
a3ba00f
Compare
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw --HG-- extra : rebase_source : 4c4e738ceaec32750ae0c5aa0308c17346806b3a
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw
This is going to be tested in web-platform-tests/wpt#10700. Bug: 1457652 Reviewed-by: xidorn MozReview-Commit-ID: 7Oi1it70YFw
frivoal
left a comment
There was a problem hiding this comment.
Initially, I thought that this looks good (modulo the few minor fixes I've requested).
That said, separately from evaluating the correctness of these tests, I have a little bit of concern about the effects of testing syntax only, as this series of tests does.
Quite a lot of this (most of the *-valid.html) tests are redundant with existing tests, as the existing ones couldn't pass if valid syntax wasn't supported (exceptions for things like checking calc(), which may not have full coverage in the existing test suite). But a fair amount of the existing tests are also manual (and hard/impossible to convert), and there's value in automated checking.
However, in the past, browsers have on occasion added parsing support for some property/values without actually adding the corresponding behavior:
- implement syntax first, behavior later
- make a syntax improvement that affects several properties, implement the behavior only in some of them (this is a subcase of the previous point)
- implement both syntax and behavior, maintain the parsing well but let the behavior bitrot and eventually fall apart
That sort of things makes it hard for web developers to provide fallbacks, either using the cascade or @supports, since they cannot reliably detect whether the feature is actually supported.
Because of this, I am a little concerned about syntax-only tests, which make it looks like implementing syntax only is an improvement, while it is actually a source of problems.
Those that test for invalid syntax are fine, as this concern does not apply, and those that are known to catch actual browser bugs are especially useful.
But for those that test for valid syntax, I am a little less sure:
- if the effects of the property/value can be automatically tested, aren't those tests enough and more safe?
- if the effects of the property/value cannot be automatically tested, how do we avoid turning this into a temptation to support syntax without behavior?
Here's one example of how things could go wrong here: a browser who has no interest in supporting actual inverted color outlines implements support for parsing outline:invert without the behavior, just to make a test go green. The acceptable behaviors (parse and do it, or fail to parse) are already covered in outline-006.html, so maybe that test provides the necessary safety. At the same time, given that that test exists, do we need parsing-only tests for invert?
I wonder what's the best approach. Here are a few suggestions:
- the parts of of *-valid tests that check that things are not serialized to some known-to-be incorrect value are useful, (e.g.
test_valid_value("outline", "none"); // Edge serializes as "invert", or the tests that mozilla fails due to incorrect ordering or not using the shortest serialization), but they could be changed from "assert equals the correct thing" to "assert not equal the known-to-be-wrong thing". - make reftests for the parts of *-valid tests that can and that that are not already covered in the test suite (e.g. calc in outline)
- drop the rest of -valid tests
(we should probably do 2. anyway, and possibly also 1., even if we don't plan to do 3.)
I know this isn't very satisfying, because this series of test is nice on its own, and some parts that would be dropped are only covered in manual tests. But the concern remains.
We could add warnings in the tests ("if this fails, don't fix it unless you also make sure that <a href="...">other test<:/a> also passes"), but I am far from sure this would be effective.
Or maybe we just trust that reason will prevail and browser developers will not do the bad things I'm worried about. But as it has happened in the past, I am a little nervous about providing incentives (in the form of failing tests) for the unfortunate behavior.
Or maybe I'm just paranoid, and this is fine. Feedback appreciated.
CCing a few CSS tests gurus for opinions: @fantasai @gsnedders @dbaron @Ms2ger
| <body> | ||
| <script> | ||
| test_valid_value("outline-color", "rgba(10, 20, 30, 0.4)"); | ||
| test_valid_value("outline-color", "invert"); |
There was a problem hiding this comment.
Per the spec, support for the "invert" value is not mandatory:
Conformant UAs may ignore the invert value on platforms that do not support color inversion of the pixels on the screen.
If the UA does not support the invert value then it must reject that value at parse-time, and the initial value of the outline-color property is the currentColor keyword.
I suggest splitting this test in two: outline-color-valid-mandatory.html and outline-color-valid-optional.html, with the later having <meta name="flags" content="may">
| <title>CSS UI Level 3: parsing outline with valid values</title> | ||
| <link rel="author" title="Eric Willigers" href="mailto:[email protected]"> | ||
| <link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline"> | ||
| <meta name="assert" content="outline supports the full grammar '<outline-color> || <outline> || <outline>'."> |
There was a problem hiding this comment.
This does a more that checking if the full grammar is supported, it also checks if the serialization follows the principles of https://drafts.csswg.org/cssom/#serializing-css-values (canonical order, shortest possible serialization).
Can you update the assert to say so, and add
<link rel="help" href="https://drafts.csswg.org/cssom/#serializing-css-values">
There was a problem hiding this comment.
done, but that applies applies to nearly all the -valid tests.
| </head> | ||
| <body> | ||
| <script> | ||
| test_valid_value("outline", "invert"); |
There was a problem hiding this comment.
As for outline-color-valid.html:
Per the spec, support for the "invert" value is not mandatory:
Conformant UAs may ignore the invert value on platforms that do not support color inversion of the pixels on the screen.
If the UA does not support the invert value then it must reject that value at parse-time, and the initial value of the outline-color property is the currentColor keyword.
I suggest splitting this test in two: outline-valid-mandatory.html and outline-valid-optional.html, with the later having <meta name="flags" content="may">
|
I don't think any browser implementer would seriously consider shipping syntax first without any behavior, is there any precedent for that? |
|
(Apart from WebKit shipping parsing of |
Note we essentially have the same issue with everything using idlharness.js: you get thousands of tests passing if you dump the IDL file in your tree and your binding generation is correct. It's never been the case that number of tests passed has ever been meaningful (because we have both extremes in various places: ones where you can have 99.9% of the spec correct and fail almost everything, and ones where you can have 0.1% of the spec correct and pass almost everything), and I don't think we should start worrying about it now. Ideally, we'd have something analogue to idlharness.js for CSS (where you give the property value definition and it generates however many tests for the syntax being supported), which is #9113. We know these tests catch issues, so we absolutely should have them. |
I think this is a valid concern in theory, but not really an issue in practice. Speaking for Edge here, tests aren't ever going to be the reason we would do this. There is nothing worse than gaining a few points on a test suite with a fake implementation that later causes you to have a bug on a real website. No user is ever looking at test suites, users look at real sites. Now, it's totally possible that Edge would ship syntax even if it doesn't support its behavior, for instance if we face real websites being broken (we have shipped FWIW though, I was doing exactly this right now in a prototype pull request because Edge does not parse |
|
side discussion |
I agree it's never been meaningful, but that's different from saying that nobody is every influenced by them.
Right, but I argue parsing-only tests are worse. They tests mean that on the same spec and test suite, you can make things worse by increasing the pass rate. Now, @fantasai said
As far as I can tell, except those that test for invalid syntax (which are fine), almost all the rest does have corresponding tests for functional support, even though some of these tests are manual. ("almost all": I think the only exception are tests involving calc). CSS-UI is a bit special, given the large amount of non-automatable tests that it has. So I guess that the automated syntax tests are valuable there. But for the other tests that cover things already covered by a ref-test, I am unsure what the value is. |
I am not sure (I mean, literally, I don't mean that I am sure of the opposite). Multiple browsers have in the past made parsing only implementations (and I am not talking about the deliberate kind of things like parsing the hotspot of the cursor, which can be argued for). Multiple browsers have, on occasion, made races out of completing a test suite or having the highest pass percentage or score. Should people know better? Totally. Do people still fall for it on occasion? I don't know for sure, but I'd guess so. Maybe junior developers. Maybe not-so-junior developers under pressure from a marketing team. I wouldn't go as far as to say parsing-only tests should never exist, but I don't think they should be routine, and we need to weight the pros and cons each time. Here, I'm thinking the ones that correspond to things that can only be tested manually are probably good ideas. The rest, I am less sure. |
|
I echo others who have already stated that these tests are useful. Similar tests have exposed bugs in implementations such as https://crbug.com/776208, where Chrome allowed syntax that was explicitly rejected by the spec, and areas where serialization differs between browsers (due to implementations or the spec being unclear). While testing that output via content is important, testing interoperability of syntax and serialization through CSSOM/Typed OM is additionally important, and thus both types of tests are needed. |
This is going to be tested in web-platform-tests/wpt#10700. Bug: 1457652 Reviewed-by: xidorn MozReview-Commit-ID: 7Oi1it70YFw
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 2a03e9effe84d574a0dfdaaefd9bde2f69df6d0e
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 807e94988d9a9563504d6b3751562fdbbde13084
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 2a03e9effe84d574a0dfdaaefd9bde2f69df6d0e
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 807e94988d9a9563504d6b3751562fdbbde13084
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 2a03e9effe84d574a0dfdaaefd9bde2f69df6d0e
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw UltraBlame original commit: 807e94988d9a9563504d6b3751562fdbbde13084
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw
This is going to be tested in web-platform-tests/wpt#10700. MozReview-Commit-ID: 7Oi1it70YFw
The tests expose a number of bugs:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16854772/
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16900961/
https://bugzilla.mozilla.org/show_bug.cgi?id=1453258 [fixed]
https://bugzilla.mozilla.org/show_bug.cgi?id=1457652 [fixed]
https://bugs.chromium.org/p/chromium/issues/detail?id=708197 [fixed]
https://bugs.chromium.org/p/chromium/issues/detail?id=831550