From 97d3f26862897521f7cce86924067e5eb7668af2 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 26 Jan 2014 14:04:37 -0800 Subject: [PATCH] Do not cache modules if the module doesn't exist. --- Execute.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index 82ef815..b0c8aac 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1724,15 +1724,15 @@ static JSValueRef require(JSContextRef context, JSObjectRef object, JSObjectRef if (!JSValueIsUndefined(context, cache)) module = CYCastJSObject(context, cache); else { + CYUTF8String code; + code.data = reinterpret_cast(CYMapFile(path, &code.size)); + module = JSObjectMake(context, NULL, NULL); CYSetProperty(context, modules, key, module); JSObjectRef exports(JSObjectMake(context, NULL, NULL)); CYSetProperty(context, module, property, exports); - CYUTF8String code; - code.data = reinterpret_cast(CYMapFile(path, &code.size)); - std::stringstream wrap; wrap << "(function (exports, require, module) { " << code << "\n});"; code = CYPoolCode(pool, wrap); -- 2.45.2