JSRT module api by Yongqu · Pull Request #1254 · chakra-core/ChakraCore

@Yongqu

Add module support in chakracore by adding related JSRT APIs. This set of
APIs are in chakracore.dll only, not in chakra.dll as we are using different binding
for edge browser. The host is responsible for asynchronously fetch dependent modules
and handle error conditions.

The overall loading sequences:
   host                                chakacore.dll
1. Load top level script
2.                             ---->   JsInitializeModuleRecord // for root module
3.                             ---->   JsParseModuleSource      // parse root module
4. FetchImportedModuleCallback <----                            // optional for imported module
5.                             ----->  JsInitializeModuleRecord // for nested module
6. load additional script
7.                             ----->  JsParseModuleSource      // for nested module
8. NotifyModuleReadyCallback   <-----
9.                             ----->  JsModuleEvaluation       // for root module

step 4 to step 7 could be happening in a loop, and step 5 should happen asynchronously
like in a Promise. Step 9 will also evaluate all the nested modules.

Port some existing test cases to ch. We need to support test262 hook in later checkin.