Bug 203127

Summary: ctx.font = "" asserts in CSS parser
Product: WebKit Reporter: Dean Jackson <dino>
Component: CanvasAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, dino, esprehn+autocc, ews-watchlist, gyuyoung.kim, hi, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch hi: review+

Dean Jackson
Reported 2019-10-17 16:54:50 PDT
ctx.font = "" asserts in CSS parser
Attachments
Patch (13.89 KB, patch)
2019-10-17 16:59 PDT, Dean Jackson
hi: review+
Radar WebKit Bug Importer
Comment 1 2019-10-17 16:55:29 PDT
Dean Jackson
Comment 2 2019-10-17 16:59:48 PDT
Devin Rousso
Comment 3 2019-10-17 17:14:42 PDT
Comment on attachment 381252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=381252&action=review r=me > Source/WebCore/ChangeLog:13 > + will assert. This was the only case I could find where we sidestepped > + most of the parsing infrastructure and injected a raw string. For the record (which I think is what you were referring to), there are a number of other places where we call `CSSParser::parseValue`, and most of them already do a check for an empty string before calling it, but not all of them. The only other one I could is `CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts` (which looks to be reachable from JavaScript via `FontFaceSet.prototype.check`), so perhaps we should add a similar check there as well. > LayoutTests/http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid.html:21 > +ctx.font = '20px serif'; I realize this is a WPT, but should we have a test to check that setting a valid value after an invalid one does in fact change the `font`, just to make sure that an invalid value doesn't "permanently" mess everything up? ``` ctx.font = '20px serif'; ctx.font = 'invalid'; ctx.font = '10px sans-serif'; _assertSame(ctx.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); ```
Dean Jackson
Comment 4 2019-10-17 17:25:56 PDT
Comment on attachment 381252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=381252&action=review >> LayoutTests/http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid.html:21 >> +ctx.font = '20px serif'; > > I realize this is a WPT, but should we have a test to check that setting a valid value after an invalid one does in fact change the `font`, just to make sure that an invalid value doesn't "permanently" mess everything up? > ``` > ctx.font = '20px serif'; > ctx.font = 'invalid'; > ctx.font = '10px sans-serif'; > _assertSame(ctx.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); > ``` We probably should. Feel free to make a WPT request :)
Dean Jackson
Comment 5 2019-10-17 17:26:12 PDT
Will do FontFaceSet separately.
Dean Jackson
Comment 6 2019-10-17 17:44:14 PDT
Note You need to log in before you can comment on or make changes to this bug.