Skip to content

Commit 16b2545

Browse files
Revert detached async bridge tasks
1 parent b67cf24 commit 16b2545

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

Sources/JavaScriptKit/BasicObjects/JSPromise.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public final class JSPromise: JSBridgedClass {
9696
let body: () async throws(JSException) -> JSValue
9797
}
9898
let context = Context(resolver: resolver, body: body)
99-
// Detach the task so the JS bridge does not inherit an arbitrary caller executor.
100-
Task.detached {
99+
Task {
101100
do throws(JSException) {
102101
let result = try await context.body()
103102
context.resolver(.success(result))

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ private func makeAsyncClosure(
353353
let body: (sending [JSValue]) async throws(JSException) -> JSValue
354354
}
355355
let context = Context(resolver: resolver, arguments: arguments, body: body)
356-
Task.detached(priority: priority) {
356+
Task(priority: priority) {
357357
do throws(JSException) {
358358
let result = try await context.body(context.arguments)
359359
context.resolver(.success(result))

0 commit comments

Comments
 (0)