Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit df8d10e

Browse files
author
Jianchun Xu
committed
chakrashim: correct function callback context
A native function callback is expected to be invoked in its creation context. Enter the callee context before invoking native callback. Fixes several 'repl` related tests: - parallel/test-repl-require - parallel/test-repl-syntax-error-stack - addons/repl-domain-abort/test PR-URL: #54 Reviewed-By: Sandeep Agarwal <Agarwal.Sandeep@microsoft.com>
1 parent 41d9652 commit df8d10e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

deps/chakrashim/src/v8functiontemplate.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ struct FunctionCallbackData {
8686
JsValueRef *arguments,
8787
unsigned short argumentCount,
8888
void *callbackState) {
89+
// Script engine could have switched context. Make sure to invoke the
90+
// callback in the current callee context.
91+
ContextShim* contextShim = IsolateShim::GetContextShimOfObject(callee);
92+
ContextShim::Scope contextScope(contextShim);
8993
HandleScope scope(nullptr);
9094

9195
JsValueRef functionCallbackDataRef = JsValueRef(callbackState);

0 commit comments

Comments
 (0)