util: fix isInsideNodeModules() check
This PR reverts away from use of overrideStackTrace
in isInsideNodeModules()
introduced in https://github.com/nodejs/node/pull/29777.
At the moment, Electron uses the v8 version of Error.prepareStackTrace
as defined in v7.9.74
(where https://crbug.com/v8/7848 has been fixed) and not the one polyfilled here: https://github.com/nodejs/node/pull/23926. As a result, we were experiencing failures in parallel/test-buffer-constructor-outside-node-modules.js
because the polyfilled prepareStackTrace
was not being run and thus the following code inside that function would never be executed:
if (overrideStackTrace.has(error)) {
const f = overrideStackTrace.get(error);
overrideStackTrace.delete(error);
return f(error, trace);
}
so isInsideNodeModules()
would always return false.
This change still allows for isInsideNodeModules()
to be tested correctly while retaining correct functionality for Electron. Since isInsideNodeModules()
is only ever invoked when determining whether to print a deprecation warning for new Buffer()
, this change should have no effects on end users.
cc @devsnek @loc
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Co-authored-by: Andy Locascio andy@slack-corp.com