Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d623d8

Browse filesBrowse files
mhdawsoncodebytere
authored andcommitted
n-api: improve consistency of how we get context
Refs: nodejs/node-addon-api#764 Improve the consistency of how we get a context when needed. We generally used env->context() in N-API but there were are few exceptions that this PR addresses. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: #36068 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent f9bbd35 commit 3d623d8
Copy full SHA for 3d623d8

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎src/js_native_api_v8.cc‎

Copy file name to clipboardExpand all lines: src/js_native_api_v8.cc
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ inline static napi_status ConcludeDeferred(napi_env env,
169169
NAPI_PREAMBLE(env);
170170
CHECK_ARG(env, result);
171171

172-
v8::Local<v8::Context> context = env->isolate->GetCurrentContext();
172+
v8::Local<v8::Context> context = env->context();
173173
v8impl::Persistent<v8::Value>* deferred_ref =
174174
NodePersistentFromJsDeferred(deferred);
175175
v8::Local<v8::Value> v8_deferred =
@@ -385,8 +385,7 @@ inline static napi_status Unwrap(napi_env env,
385385
CHECK_ARG(env, result);
386386
}
387387

388-
v8::Isolate* isolate = env->isolate;
389-
v8::Local<v8::Context> context = isolate->GetCurrentContext();
388+
v8::Local<v8::Context> context = env->context();
390389

391390
v8::Local<v8::Value> value = v8impl::V8LocalValueFromJsValue(js_object);
392391
RETURN_STATUS_IF_FALSE(env, value->IsObject(), napi_invalid_arg);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.