Bug 240715

Summary: Web Inspector: Assertion Failed: Expect an array of string values CSSCompletions.js:39
Product: WebKit Reporter: Razvan Caliman <rcaliman>
Component: Web InspectorAssignee: Razvan Caliman <rcaliman>
Status: RESOLVED FIXED    
Severity: Normal CC: inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   

Description Razvan Caliman 2022-05-20 07:28:23 PDT
```
[Error] Assertion Failed: Expect an array of string values – [] (0)
    CSSCompletions (CSSCompletions.js:39)
    (anonymous function) (CSSKeywordCompletions.js:233)
    (anonymous function) (CSSKeywordCompletions.js:129)
    _valueCompletionDataProvider
    _updateCompletions (SpreadsheetTextField.js:435)
    _handleInput (SpreadsheetTextField.js:422)
    _handleInput
```

**Steps to reproduce**

- Open Web Inspector, go to Styles sidebar panel
- Type `var(` on any CSS value

**Result**

No issue in UI or UX, but the assertion above is hit.


**Explanation**

It happens because the `WI.CSSCompletions` instance created in `WI.CSSKeywordCompletions.forFunction()` is initially given an empty array for "var" functions. The actual values are added immediately after instantiation via `WI.CSSCompletions.addValues()`. They come from the custom completion provider referenced by the `additionalFunctionValueCompletionsProvider` option.

There's no reason to have this two step approach. We can provide the result of `additionalFunctionValueCompletionsProvider("var")` at `WI.CSSCompletions` instantiation.
Comment 1 Radar WebKit Bug Importer 2022-05-20 07:29:02 PDT
<rdar://problem/93653315>
Comment 2 Razvan Caliman 2022-05-20 07:50:00 PDT
Pull request: https://github.com/WebKit/WebKit/pull/831
Comment 3 EWS 2022-05-24 13:55:35 PDT
Committed r294763 (250929@main): <https://commits.webkit.org/250929@main>

Reviewed commits have been landed. Closing PR #831 and removing active labels.