no-bug: Force boosts colors to fit in 32 bit ints (gh-13532)

This commit is contained in:
mr. m
2026-05-02 11:36:15 +02:00
committed by GitHub
parent c0cd45bf1d
commit a71a66c00b

View File

@@ -76,7 +76,7 @@ export class ZenBoostsChild extends JSWindowActorChild {
* > #define NS_RGBA(_r, _g, _b, _a) \
* > ((nscolor)(((_a) << 24) | ((_b) << 16) | ((_g) << 8) | (_r)))
*
* Converts [r, g, b] array to NSColor
* Converts [r, g, b] array to (uint32_t) NSColor
* Make a color out of r,g,b,a values. This assumes that the r,g,b,a
* values are properly constrained to 0-255.
*
@@ -92,7 +92,8 @@ export class ZenBoostsChild extends JSWindowActorChild {
// be fully opaque and we need an extra byte to store the contrast value. This allows
// us to still use an nscolor as parameter instead of having to deal with WebIDL structs
// shenanigans.
return (contrast << 24) | (b << 16) | (g << 8) | r;
// Take into account that its an unsigned int
return ((contrast << 24) | (b << 16) | (g << 8) | r) >>> 0;
}
/**