wiki.techinc.nl/tests/qunit/data/requireCallMwLoaderTestCallback.js
Timo Tijhof 3eef71c701 mw.loader: Don't unset 'require' after execution in debug mode
Follows-up bc4e07b6f6.

In production mode, 'module' and 'require' are lexically provided
through closure to the executing script and will continue to be
accessible through the script's life-time.

In debug mode, the script executes without wrapper directly from
disk (and as such, in the global scope) and variables are provided
as global variables. Since a variable can only be set to one value,
we swap the object that 'module' points to after each file. And
to avoid leakage, it is removed in-between files and after the
last one. Aside from it being technically infeasible right now,
async access to 'module' is discouraged regardless.

Late access to 'require', however, is not uncommon and should
work as expected.

Bug: T144879
Change-Id: I6ede10fd42676bb035ea26c693c78bcdc1438a7d
2016-10-04 16:55:34 +00:00

6 lines
136 B
JavaScript

module.exports = {
immediate: require( 'test.require.define' ),
later: function () {
return require( 'test.require.define' );
}
};