Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ if (internalBinding('config').hasInspector) {
profiler = internalBinding('profiler');
}

// HACK(edgejs): Proper fix is to implement the profiler binding instead of patching JS exports.
function noop() {}

const assert = require('internal/assert');
const { inspect } = require('internal/util/inspect');
const { FastBuffer } = require('internal/buffer');
Expand Down Expand Up @@ -505,8 +508,8 @@ module.exports = {
DefaultSerializer,
DefaultDeserializer,
deserialize,
takeCoverage: profiler.takeCoverage,
stopCoverage: profiler.stopCoverage,
takeCoverage: profiler.takeCoverage ?? noop,
stopCoverage: profiler.stopCoverage ?? noop,
Comment on lines 59 to +512

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't modify files on the lib js files.

We should only do modifications on the native side (we can probably mock it on the profiler native binding)

serialize,
writeHeapSnapshot,
promiseHooks,
Expand Down
7 changes: 7 additions & 0 deletions src/internal_binding/binding_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,12 @@ bool IsDisallowedWorkerExecArgvFlag(const std::string& flag) {
flag == "--redirect-warnings";
}

bool IsAlwaysAllowedWorkerExecArgvFlag(const std::string& flag) {
// Node allows source map support in worker execArgv, and userland test
// runners like AVA rely on that behavior for worker startup.
return flag == "--enable-source-maps";
}

std::vector<std::string> ValidateExecArgv(napi_env env,
const std::vector<std::string>& args,
bool explicitly_provided) {
Expand All @@ -489,6 +495,7 @@ std::vector<std::string> ValidateExecArgv(napi_env env,
std::string flag = arg;
const size_t eq = flag.find('=');
if (eq != std::string::npos) flag.resize(eq);
if (IsAlwaysAllowedWorkerExecArgvFlag(flag)) continue;
if (IsDisallowedWorkerExecArgvFlag(flag) || !IsAllowedNodeEnvironmentFlag(env, flag)) {
invalid.push_back(arg);
}
Expand Down
Loading