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

Commit

Permalink
chakrashim: correct function callback context
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jianchun Xu committed Apr 13, 2016
1 parent 41d9652 commit df8d10e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/chakrashim/src/v8functiontemplate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ struct FunctionCallbackData {
JsValueRef *arguments,
unsigned short argumentCount,
void *callbackState) {
// Script engine could have switched context. Make sure to invoke the
// callback in the current callee context.
ContextShim* contextShim = IsolateShim::GetContextShimOfObject(callee);
ContextShim::Scope contextScope(contextShim);
HandleScope scope(nullptr);

JsValueRef functionCallbackDataRef = JsValueRef(callbackState);
Expand Down

0 comments on commit df8d10e

Please sign in to comment.