Make require.stub() optionally accept a factory function

`require.stub()` can now accept a factory function instead of an object
so that stubbed modules are initialized lazily:

```js
require.stub('zlib', function() {
    // initialized once, when zlib first required
    return {
        createGzip: function() { ... }
    };
});
```

http://code.google.com/p/phantomjs/issues/detail?id=1044