Closed Bug 1517510 Opened 2 years ago Closed 1 year ago

Capstone: Update browser_all_files_referenced.js to check all shipped fluent files are referenced


(Firefox :: General, enhancement, P3)




Firefox 67
Tracking Status
firefox66 --- wontfix
firefox67 --- fixed


(Reporter: Gijs, Assigned: berning5, Mentored)


(Blocks 1 open bug)



(1 file)

To do this, the following steps should help:

1. add `.ftl` to the list at . Probably worth indenting the list a bit nicer while we're there instead of having such a long line.

(You could just run the test as a sanity check after this step - I'd expect it to flag up every single packaged .ftl file we have.)

2. add a block to `parseCodeFile` that checks for .ftl paths. That is, somewhere in this loop that does per-line checks:

we need to add a regular expression looking for `/[a-z0-9_\/-]+\.ftl/i`, and set `urls` to an array of any found string, prefixed with "resource:///localization/en-US/". (or maybe `resource://app/localization/en-US/`, I'm not 100% sure)

3. Test, and add any unreferenced .ftl files to the list of exceptions at the top of the file.

Note that in theory, there shouldn't be any unreferenced ftl files.

I haven't tested this plan. I'm fairly confident that it's correct in the rough steps, but you'll probably run into issues which you'll need to debug. You can use the `info` helper function to log things (`info("Hello from the test")`). You can also add a `debugger;` statement in the JS and run the test as `./mach mochitest browser/base/content/test/static/browser_all_files_referenced.js --jsdebugger` . It'll break into the debugger when it hits the `debugger;` statement, at which point you can inspect variables etc.

One more point of note is that after getting this to work, you'll need to also check that it works against a packaged build, which is what the test will run against on our test infrastructure. You can do this locally by first running:

./mach package

and then running the test using:

./mach mochitest browser/base/content/test/static/browser_all_files_referenced.js --appname=dist

to run against the packaged 'dist' build.
Priority: -- → P3
Assignee: nobody → berning5
Pushed by
Checking if all shipped fluent files are referenced, r=Gijs
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
You need to log in before you can comment on or make changes to this bug.