Skip to content

Conversation

@canova
Copy link
Member

@canova canova commented Oct 25, 2025

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):

if (sourceUuid !== null) {
try {
const response = await delegate.fetchJSSourceFromBrowser(sourceUuid);
if (response) {
return {
type: 'SUCCESS',
source: response,
};
}
} catch (e) {
errors.push({
type: 'NOT_PRESENT_IN_BROWSER',
sourceUuid,
url: file,
errorMessage: e.toString(),
});
}
}

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.

@canova canova requested a review from mstange October 25, 2025 21:10
@canova canova requested a review from a team as a code owner October 25, 2025 21:10
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ 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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

# files when the "JavaScript Sources" feature is not enabled.
SourceView--no-known-cors-url1 =
There is no known cross-origin-accessible URL for this file. If this is a
JavaScript file, you may need to enable the "JavaScript Sources" feature in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JavaScript file, you may need to enable the "JavaScript Sources" feature in
JavaScript file, you may need to enable the JavaScript Sources feature in

Could we add the linter to this project?
https://github.com/mozilla-l10n/moz-fluent-linter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, forgot that one, fixed it.

Yeah, it would be good to add a linter. Filed #5646 for that.

@canova canova force-pushed the js-sources-feature branch from 8e2aac5 to 1cfa84d Compare October 27, 2025 17:42
@canova canova force-pushed the js-sources-feature branch from 1cfa84d to 10001f7 Compare October 27, 2025 17:43
@mstange
Copy link
Contributor

mstange commented Oct 29, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should the source view suggest enabling the "JS Sources" feature?

3 participants