Make the callsites call InspectorUtils.rgbToColorName instead.
Since it was throwing when passed a non-valid named color,
which wasn't the expected outcome in DevTools, modify the
c++ method so it return an empty string instead.
Add a dedicated test since there wasn't one.
Details
Details
Diff Detail
Diff Detail
- Repository
- rMOZILLACENTRAL mozilla-central
- Lint
Lint Not Applicable - Unit
Tests Not Applicable - Build Status
Buildable 505035 Build 601388: arc lint + arc unit
Event Timeline
Comment Actions
Great work, thanks for tweaking the c++ to avoid the intermediate workaround!
devtools/client/shared/test/xpcshell/test_cssColorDatabase.js | ||
---|---|---|
20 | This test is only assertion cases where isValidCssColor return true, should it also cover one or some case(s) where it returns false? May be it is already covered by layout mochitests? |
devtools/client/shared/test/xpcshell/test_cssColorDatabase.js | ||
---|---|---|
20 | yes, the layout test checking those https://searchfox.org/mozilla-central/search?q=is+not+a+valid+color&path=layout&case=false®exp=false |
layout/inspector/InspectorUtils.cpp | ||
---|---|---|
513–514 | Truncate is better. |
layout/inspector/InspectorUtils.cpp | ||
---|---|---|
513–514 | oh shoot, I'll fix that in a follow up |
layout/inspector/InspectorUtils.cpp | ||
---|---|---|
513–514 | It's a lot simpler and probably more efficient. And just what we usually do to make something an empty string. |