Bug 1779421 - Part 3: Add tests for expected module status and async evaluating state r=yulia
This adds a shell function 'clearModules' to clear all loaded modules, so that tests can be insulated from one another. Depends on D151834 Differential Revision: https://phabricator.services.mozilla.com/D151835
This commit is contained in:
@@ -5585,6 +5585,14 @@ static bool RegisterModule(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ClearModules(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
ShellContext* sc = GetShellContext(cx);
|
||||
sc->moduleLoader->clearModules(cx);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ModuleLink(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
@@ -9396,6 +9404,10 @@ static const JSFunctionSpecWithHelp shell_functions[] = {
|
||||
" Register a module with the module loader, so that subsequent import from\n"
|
||||
" |specifier| will resolve to |module|. Returns |module|."),
|
||||
|
||||
JS_FN_HELP("clearModules", ClearModules, 0, 0,
|
||||
"clearModules()",
|
||||
" Clear knowledge of all loaded modules."),
|
||||
|
||||
JS_FN_HELP("moduleLink", ModuleLink, 1, 0,
|
||||
"moduleLink(moduleOjbect)",
|
||||
" Link a module graph, performing the spec's Link method."),
|
||||
|
||||
Reference in New Issue
Block a user