report: get stack trace with cross origin contexts

When a new context with a different security token is entered, or
when no context is entered, `StackTrace::CurrentStackTrace` need to
be explicitly set with flag `kExposeFramesAcrossSecurityOrigins` to
avoid crashing.

PR-URL: https://github.com/nodejs/node/pull/44398
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Chengzhong Wu authored and Juan José Arboleda committed 2022-10-11 14:45:22 -05:00
1 parent 5355a46840
commit 0e2c2064bb
4 files changed
+57 -12

No files matched your search

+5
View File
@@ -471,6 +471,11 @@ void OOMErrorHandler(const char* location, bool is_heap_oom) {
}
if (report_on_fatalerror) {
// Trigger report with the isolate. Environment::GetCurrent may return
// nullptr here:
// - If the OOM is reported by a young generation space allocation,
// Isolate::GetCurrentContext returns an empty handle.
// - Otherwise, Isolate::GetCurrentContext returns a non-empty handle.
TriggerNodeReport(isolate, message, "OOMError", "", Local<Object>());
}