Bug 240715 - Web Inspector: Assertion Failed: Expect an array of string values CSSCompletions.js:39
Summary: Web Inspector: Assertion Failed: Expect an array of string values CSSCompleti...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Razvan Caliman
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-20 07:28 PDT by Razvan Caliman
Modified: 2022-05-24 13:55 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.