Bläddra i källkod

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.
Stefan Siegl 9 år sedan
förälder
incheckning
f258980399
1 ändrade filer med 0 tillägg och 10 borttagningar
  1. 0 10
      v8js_methods.cc

+ 0 - 10
v8js_methods.cc

@@ -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);