The main system is built upon this, and is optional, if only natives
are used in application (eg. node-core).
Natives not loaded into own context if NODE_MODULE_CONTEXTS=1.
This have its inner logic, if natives are seen just as lazy-loaded
parts of the core.
And fix missing var!
It would be good to get this script running at the end of every test, so we
know that modules aren't leaking either - but it will require a lot
modification of the tests so that they themselves aren't leaking globals.
Change process._tickCallback so that if a callback throws an error but
there are other callbacks after it, we indicate that
process._tickCallback needs to be ran again.
Currently, if a callback in process._tickCallback throws an error, and
that error is caught by an uncaughtException handler and
process.nextTick is never called again, then any other callbacks already
added to the nextTickQueue won't be called again.
Updated the next-tick-errors test to catch this scenario.
If the function for a process.nextTick throws an error, then the
splice() never removes that function from the nextTickQueue array. This
makes sure the functions that have been run in _tickCallback get removed
regardless of errors.
Also add a test for this.
Separating "what to traverse" from "how to traverse and what to do with it "
in findModulePath. It may also fix one not-yet-found bug (absolute ids
weren't loaded when dirs.length = 0).