Add hint to enable JavaScript Sources feature in source view error
Fixes #5640.
This is not the ideal solution I had in mind initially.
I initially wanted to add a new error, that shows this only when it's a JS file. But when this feature is disabled, there isn't a way to know if this is a JS source. We have sourceUuid, but it becomes null when this feature is disabled, because we don't serialize the source table in the backend when the this feature doesn't exist (since we don't collect the sources in the first place):
https://github.com/firefox-devtools/profiler/blob/d396f271ed9c5c1cef258c5f13a32aaa989b8e27/src/utils/fetch-source.ts#L93-L110
Potentially we can propagate an isJS argument to this function. But not so sure if that's worth it. I think this is an okay middle ground for this.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 85.76%. Comparing base (2690409) to head (10001f7).
Additional details and impacted files
@@ Coverage Diff @@
## main #5643 +/- ##
=======================================
Coverage 85.76% 85.76%
=======================================
Files 311 311
Lines 30747 30747
Branches 8455 8455
=======================================
Hits 26370 26370
Misses 3953 3953
Partials 424 424
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Hrmm the compromise makes it less useful. It will now also suggest this for C++ functions.
Could we instead put the sources table always into the profile, even if the feature is off? And when the front-end requests the source, Firefox could return an error with a message which suggests enabling the feature - I think the existing error handling might just work in that case, no?
Forgot about this PR. I'll look for a better solution later.