Note that many preprocessor directives in JS code can be replaced with - AppConstants.jsm (which relies itself on preprocessor directives, but we could reimplement it in C++ if needed); - OS.Constants (which is a bit heavyweight to use right now, because it is tied to OS.File, but we could easily extract it to a more lightweight module).
(In reply to David Rajchenbach-Teller [:Yoric] (use "needinfo") from comment #2) > Note that many preprocessor directives in JS code can be replaced with > - AppConstants.jsm (which relies itself on preprocessor directives, but we > could reimplement it in C++ if needed); I think that's great! Keeping that file in JS is fine, methinks.
I wonder if it makes sense to separate the eradication of #include and #ifdef directives into separate bugs, since they will probably need different strategies.
(In reply to David Rajchenbach-Teller [:Yoric] (use "needinfo") from comment #2) > Note that many preprocessor directives in JS code can be replaced with > - AppConstants.jsm (which relies itself on preprocessor directives, but we > could reimplement it in C++ if needed); Hey, look, I already started on that work: https://dxr.mozilla.org/mozilla-central/source/xpcom/system/nsIXULRuntime.idl#139 I needed this to remove preprocessing in a bunch of test files. Adding more things there is trivial, we could easily use that for everything in AppConstants.jsm: https://hg.mozilla.org/mozilla-central/rev/a34e6d5519ef
I've started filing deps to remove these. I'll try to finish this tomorrow / the rest of this week. Please feel free to take and/or sign up as mentors for any of them. I'll post to fx-dev once browser/ is covered.
Just a reminder: as we eradicate preprocessor directives completely from files, we should also update the associated moz.build/jar.mn to avoid the preprocessing and hence speeding up build times and get the full benefits of the removal of the directives.