| 14 | } |
| 15 | |
| 16 | static void RunInCallbackScopeFromExisting(const CallbackInfo& info) { |
| 17 | Function callback = info[0].As<Function>(); |
| 18 | Env env = info.Env(); |
| 19 | |
| 20 | AsyncContext ctx(env, "existing_callback_scope_test"); |
| 21 | napi_callback_scope scope; |
| 22 | napi_open_callback_scope(env, Object::New(env), ctx, &scope); |
| 23 | |
| 24 | CallbackScope existingScope(env, scope); |
| 25 | assert(existingScope.Env() == env); |
| 26 | |
| 27 | callback.Call({}); |
| 28 | } |
| 29 | |
| 30 | } // namespace |
| 31 |