napajs/lib
Daiyi Peng 3211319d77 Polish zone.execute: transported function will inherit __dirname from caller. (#40)
This change addresses issue to make zone.execute on anonymous function more fluent. Also it made transported functions more secure, which can only access their own v8 contexts.

Detailed changes

Support require(path, script) to create module from string in Napa zone.
Introduce napa.v8.currentStack to get current stack.
Replace eval with creating a new module for transported function.
Use caller JS file + function hash as module id for transported function. As a result, transported function will use __dirname from caller.
Updated test files.
Notable comments

We always assume that the function passed to zone.execute without property origin is to use caller file as origin. This assumption makes most fluent usage for most cases, but if functions are defined in different file other than caller, this assumption will be broken. User can explicit specify `f.origin = __filename' in the file where f is defined to avoid issue.

Bug fixes

Issue: require.resolve should throw on non-existed path.
2017-08-16 18:39:36 -07:00
..
core Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
memory Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
runtime Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
store Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
transport Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
v8 Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
zone Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
binding.js Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
index.ts Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
log.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
memory.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
metric.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
runtime.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
store.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
transport.ts Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
tsconfig.json Merged PR 301401: First round cleanup - remove msbuild files and unnecessary folders 2017-06-20 18:37:47 +00:00
v8.ts Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
zone.ts Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00