8000 SandBox, refactor: modify the parameter order of the module wrapper t… · fibjs/fibjs@c051529 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit c051529

Browse files
committed
SandBox, refactor: modify the parameter order of the module wrapper to be compatible with node.js.
1 parent dbd3041 commit c051529

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

fibjs/src/sandbox/loaders/base_loader.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
namespace fibjs {
1616

17-
const char* SandBox::script_args = "(async function(__filename,__dirname,require,run,exports,module,__argv){";
18-
const char* SandBox::worker_args = "(async function(__filename,__dirname,require,run,exports,module,Master){";
19-
const char* SandBox::module_args = "(async function(__filename,__dirname,require,run,exports,module){";
20-
const char* SandBox::base_args = "(async function(__filename,__dirname,require,run,exports,module";
17+
const char* SandBox::script_args = "(async function(exports,require,module,__filename,__dirname,run,__argv){";
18+
const char* SandBox::worker_args = "(async function(exports,require,module,__filename,__dirname,run,Master){";
19+
const char* SandBox::module_args = "(async function(exports,require,module,__filename,__dirname,run){";
20+
const char* SandBox::base_args = "(async function(exports,require,module,__filename,__dirname,run";
2121

2222
result_t SandBox::ExtLoader::run_script(Context* ctx, Buffer_base* src, exlib::string name,
2323
std::vector<arg>& extarg, bool is_main)
@@ -52,12 +52,12 @@ result_t SandBox::ExtLoader::run_module(Context* ctx, Buffer_base* src, exlib::s
5252
exlib::string pname;
5353
path_base::dirname(name, pname);
5454

55-
args[0] = isolate->NewString(name);
56-
args[1] = isolate->NewString(pname);
57-
args[2] = ctx->m_fnRequest;
58-
args[3] = ctx->m_fnRun;
59-
args[4] = exports;
60-
args[5] = module;
55+
args[0] = exports;
56+
args[1] = ctx->m_fnRequest;
57+
args[2] = module;
58+
args[3] = isolate->NewString(name);
59+
args[4] = isolate->NewString(pname);
60+
args[5] = ctx->m_fnRun;
6161

6262
int32_t i;
6363
exlib::string arg_names(base_args);

fibjs/src/sandbox/loaders/json_loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ result_t JsonLoader::run(SandBox::Context* ctx, Buffer_base* src, exlib::string
2626
if (hr < 0)
2727
return hr;
2828

29-
v8::Local<v8::Object> module = v8::Local<v8::Object>::Cast(args[5]);
29+
v8::Local<v8::Object> module = v8::Local<v8::Object>::Cast(args[2]);
3030
module->Set(context, isolate->NewString("exports"), v).IsJust();
3131

3232
return 0;

0 commit comments

Comments
 (0)
0