bitmasksForCategory for CATEGORY_MASK is using a string sort on Numbers

NEW
Unassigned

Status

()

Firefox
Developer Tools: Performance Tools (Profiler/Timeline)
P3
minor
a year ago
a year ago

People

(Reporter: MattN, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox51 affected)

Details

(URL)

> If the category is mapped to by multiple masks, CATEGORY_MASK for that name must be called with an additional argument specifying the desired id (in ascending order).

The code seems to be unintentionally using a string sort on the masks so while it may be "ascending order" it may not be the order expected (as I would expect a numeric sort to be used):

[64, 128, 4].sort() => [128, 4, 64]

https://dxr.mozilla.org/mozilla-central/rev/b3ec8a3373e8faca26c39e9ff577a2d4f8b6927a/devtools/client/performance/modules/categories.js#94

Note the `+mask` to cast to a Number from a String before sorting.

This may not matter in practice since I only see one mask per category at the moment but I noticed it while looking for this pattern or problem.
Summary: bitmasksForCategory for [CATEGORY_MASK is using a string sort on Numbers → bitmasksForCategory for CATEGORY_MASK is using a string sort on Numbers
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.