Permalink
Browse files

core, feat: disable code coverage for embed script module.

  • Loading branch information...
xicilion committed Dec 20, 2017
1 parent 2e6e961 commit 9abe80fe9d70154b703f5b1f1029a3d40e481649
Showing with 14 additions and 0 deletions.
  1. +1 −0 fibjs/include/v8_api.h
  2. +5 −0 fibjs/src/base/v8_api.cpp
  3. +8 −0 fibjs/src/sandbox/SandBox.cpp
View
@@ -23,6 +23,7 @@ exlib::string traceInfo(v8::Isolate* isolate, int32_t deep, void* entry_fp, void
exlib::string traceInfo(v8::Isolate* isolate, int32_t deep);
void beginCoverage(v8::Isolate* isolate);
void pauseCoverage(v8::Isolate* isolate);
void WriteLcovData(v8::Isolate* isolate, FILE* file);
} /* namespace fibjs */
@@ -117,6 +117,11 @@ void beginCoverage(v8::Isolate* isolate)
v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kBlockCount);
}
void pauseCoverage(v8::Isolate* isolate)
{
v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kBestEffort);
}
inline std::string ToSTLString(v8::Isolate* isolate, v8::Local<v8::String> v8_str)
{
v8::String::Utf8Value utf8(isolate, v8_str);
@@ -14,6 +14,8 @@
#include "ifs/Buffer.h"
#include "ifs/EventEmitter.h"
#include "loaders/loaders.h"
#include "v8_api.h"
#include "options.h"
namespace fibjs {
@@ -113,6 +115,9 @@ void SandBox::initRoot()
Isolate* isolate = holder();
if (g_cov && isolate->m_id == 1)
pauseCoverage(isolate->m_isolate);
RootModule* pModule = RootModule::g_root;
while (pModule) {
@@ -130,6 +135,9 @@ void SandBox::initRoot()
run_module("stream.js", "/", m);
m_init = false;
if (g_cov && isolate->m_id == 1)
beginCoverage(isolate->m_isolate);
}
result_t SandBox::add(exlib::string id, v8::Local<v8::Value> mod)

0 comments on commit 9abe80f

Please sign in to comment.