0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 10:31:53 +00:00

Accept empty string as module source

This might be perfectly valid, if you're using a third-party module,
which requires a module yet doesn't use it in the code paths hit
and hence you just want to stub it out.
This commit is contained in:
Stefan Siegl 2015-12-06 13:25:43 +01:00
parent 4853c6d17f
commit f258980399

View File

@ -305,16 +305,6 @@ V8JS_METHOD(require)
convert_to_string(module_code);
}
// Check that some code has been returned
if (Z_STRLEN_P(module_code)==0) {
zval_ptr_dtor(&module_code);
efree(normalised_module_id);
efree(normalised_path);
info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module loader callback did not return code")));
return;
}
// Create a template for the global object and set the built-in global functions
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set(V8JS_SYM("print"), v8::FunctionTemplate::New(isolate, V8JS_MN(print)), v8::ReadOnly);