Permalink
Browse files

SandBox, feat: support disable ext loader.

  • Loading branch information...
xicilion committed Aug 4, 2018
1 parent e54cf2e commit 70b6a8feab0390fc24a0ebe0145d1e6ce1965302
Showing with 11 additions and 9 deletions.
  1. +1 −1 fibjs/include/SandBox.h
  2. +10 −8 fibjs/src/sandbox/SandBox.cpp
View
@@ -19,7 +19,7 @@ namespace fibjs {
class SandBox : public SandBox_base {
public:
SandBox();
SandBox(bool extLoader = true);
public:
// SandBox_base
@@ -59,18 +59,20 @@ result_t SandBox_base::_new(v8::Local<v8::Object> mods, v8::Local<v8::Function>
return 0;
}
SandBox::SandBox()
SandBox::SandBox(bool extLoader)
{
obj_ptr<ExtLoader> loader;
loader = new JsLoader();
m_loaders.push_back(loader);
loader = new TsLoader();
m_loaders.push_back(loader);
if (extLoader) {
loader = new TsLoader();
m_loaders.push_back(loader);
loader = new JscLoader();
m_loaders.push_back(loader);
loader = new JscLoader();
m_loaders.push_back(loader);
}
loader = new JsonLoader();
m_loaders.push_back(loader);
@@ -171,9 +173,9 @@ result_t SandBox::has(exlib::string id, bool& retVal)
{
path_base::normalize(id, id);
retVal = mods()->Has(
Isolate::current()->context(),
holder()->NewString(id))
.ToChecked();
Isolate::current()->context(),
holder()->NewString(id))
.ToChecked();
return 0;
}

0 comments on commit 70b6a8f

Please sign in to comment.