Skip to content

AppRuntime iOS EnableDebugger #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions Core/AppRuntime/Source/AppRuntime_iOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@
RunEnvironmentTier();
}

void AppRuntime::RunEnvironmentTier(const char*)
{
auto globalContext = JSGlobalContextCreateInGroup(nullptr, nullptr);

if (@available(iOS 16.4, *)) {
JSGlobalContextSetInspectable(globalContext, m_options.EnableDebugger);
}

Napi::Env env = Napi::Attach(globalContext);

Run(env);

JSGlobalContextRelease(globalContext);

// Detach must come after JSGlobalContextRelease since it triggers finalizers which require env.
Napi::Detach(env);
}

Comment on lines +16 to +33
Copy link
Contributor

@bghgary bghgary Jan 21, 2025

Choose a reason for hiding this comment

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

Sorry for the slow response.

RunEnvironmentTier cannot be here as this function is intended to be JS environment specific. I think we need to add some platform specific macros to this code to ensure we don't call this function when it's not available. Availability.h has defines that we can check. Maybe also add a macro to disable this completedly in case someone is building against a version of JSC without this function.

void AppRuntime::Execute(Dispatchable<void()> callback)
{
@autoreleasepool
Expand Down
Loading