I have just landed a change that helps ESLint to automatically detect globals for loadSubScript when importing test files.
Previously you may have had to write a line to tell ESLint to import the file, e.g.
/* import-globals-from
../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
*/
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_utils.js",
this
);
No more! Now you can simply call loadSubScript:
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_utils.js",
this
);
For urls starting with chrome://mochitests/content/browser/, our ESLint setup will now automatically find the source file and load the relevant global variables.
The patches I have just landed also clean up all (that I can
find) the existing instances of import-globals-from that are now
unnecessary.
Mark