Open Bug 1869096 Opened 11 months ago Updated 11 months ago

Add lint error for loading `resource://activity-stream/` URLs from files in `toolkit/`

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(Not tracked)

People

(Reporter: aminomancer, Unassigned)

References

(Blocks 2 open bugs)

Details

Lots of messaging system code is accessed from toolkit code, see here for example. But toolkit code generally shouldn't directly reference browser code, because the browser code is only guaranteed to be present in Firefox, while the toolkit code can wind up in Thunderbird or Android and possibly a bunch of other more obscure stuff. I don't think it's currently breaking anything, but it's risky without an eslint rule.

This can be resolved by extending the existing eslint rule that prevents us from generally importing browser code from toolkit code. Most of that code is caught by one of the existing URL patterns, we're just missing resource://activity-stream/

That's gonna generate a bunch of new warnings. They can be ignored where necessary, but in other cases we can remove these imports and switch to a different pattern. If something in toolkit needs to call ASRouter, it can send an event that ASRouterTriggerListeners listens for instead. Same probably goes for SpecialMessageActions importing Spotlight.jsm. As for the message schema tests, I think they're fine as they are. There isn't really a practical way of removing those references without moving SpecialMessageActions out of toolkit, and I think it needs to be there because BackgroundTasks is there.

Component: General → Lint and Formatting
Product: Toolkit → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.