Add a getter for enabling console.createTask (#54283)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54283

# Changelog: [Internal]

This will control scenarios when we enable `console.createTask` implementation, and when we just use the stub version.

Reviewed By: huntie

Differential Revision: D85440641

fbshipit-source-id: 61b36a2452c2c656be2865defda25eb472c64d4c
This commit is contained in:
Ruslan Lesiutin authored and meta-codesync[bot] committed 2025-11-06 04:25:36 -08:00
1 parent f1f69462fd
commit 72834e6326
2 files changed
+16

No files matched your search

@@ -248,6 +248,18 @@ bool RuntimeTarget::isDomainEnabled(Domain domain) const {
return threadSafeDomainStatus_[domain];
}
bool RuntimeTarget::isConsoleCreateTaskEnabled() const {
if (isDomainEnabled(Domain::Runtime)) {
return true;
}
if (auto tracingAgent = tracingAgent_.lock()) {
return tracingAgent->isRunningInBackgroundMode();
}
return false;
}
RuntimeTargetController::RuntimeTargetController(RuntimeTarget& target)
: target_(target) {}
@@ -292,6 +292,10 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis<RuntimeTa
* Install the console API handler.
*/
void installConsoleHandler();
/**
* Returns whether console.createTask should actually capture stack traces.
*/
bool isConsoleCreateTaskEnabled() const;
/**
* Installs __DEBUGGER_SESSION_OBSERVER__ object on the JavaScript's global