8383783: MediaQueryParser should reject query lists without comma separator#2162
8383783: MediaQueryParser should reject query lists without comma separator#2162mstr2 wants to merge 2 commits into
Conversation
|
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
|
@mstr2 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 15 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
Webrevs
|
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
preliminary review, I'd like to test it a bit more.
| errorHandler.accept(stream.consume(), "Expected COMMA"); | ||
|
|
||
| while (stream.consumeIf(NOT_COMMA) != null) { | ||
| // Skip forward to the next comma and replace the previous query with a |
There was a problem hiding this comment.
is this the case that parserRecoversFromMissingCommaBetweenMediaQueries() exercise?
There was a problem hiding this comment.
Yes. We only expect another media condition after a comma, and if there was no comma, the if (!expectMediaCondition) failure path is taken.
| errorHandler.accept(stream.current(), "Unexpected token"); | ||
| Token comma = stream.consume(); | ||
| if (expectMediaCondition || expressions.isEmpty()) { | ||
| errorHandler.accept(comma, "Unexpected token"); |
There was a problem hiding this comment.
would it make sense to test this failure path, and also in L134 for completeness sake?
There was a problem hiding this comment.
Yes that makes sense. I've added tests for all failure paths where the media query list is malformed. Now we consistently apply the rule that a malformed query evaluates to false, but doesn't stop the parser.
|
should this malformed css fail? (it does not) |
This should work and correspond to a true query. See /**
* Evaluates whether any of the media queries is {@code true}.
*
* @param context the evaluation context
* @return {@code true} if any of the media queries is {@code true} or if the list is empty,
* {@code false} otherwise
*/
public boolean evaluate(MediaQueryContext context)See also here:
|
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
Looks good! Thank you for explanations and adding the tests.
|
I can be the second reviewer. |
|
/integrate |
|
Going to push as commit 6981fb4.
Your commit was automatically rebased without conflicts. |

MediaQueryParsercurrently parses query lists without a comma separator:The correct grammar requires commas between queries.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2162/head:pull/2162$ git checkout pull/2162Update a local copy of the PR:
$ git checkout pull/2162$ git pull https://git.openjdk.org/jfx.git pull/2162/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2162View PR using the GUI difftool:
$ git pr show -t 2162Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2162.diff
Using Webrev
Link to Webrev Comment