Skip to content

Commit a6b3211

Browse files
committed
Also reset context in require when file not found
1 parent 82e0e5c commit a6b3211

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bgjslibrary/jni/bgjs/BGJSContext.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@ Handle<Value> BGJSContext::require(const Arguments& args) {
567567
} else {
568568
LOGE("Cannot find file %s", *basename);
569569
log(LOG_ERROR, args);
570+
context->DetachGlobal();
571+
context->Exit();
572+
context.Dispose();
570573
return v8::Undefined();
571574
}
572575

@@ -777,7 +780,9 @@ Handle<Value> BGJSContext::js_global_requestAnimationFrame(
777780
LOGI("requestAnimationFrame: Not a function");
778781
}
779782
} else {
780-
LOGI("requestAnimationFrame: Wrong number or type of parameters");
783+
return v8::ThrowException(
784+
v8::Exception::ReferenceError(
785+
v8::String::New("requestAnimationFrame: Wrong number or type of parameters")));
781786
return scope.Close(Integer::New(-1));
782787
// return v8::ThrowException(v8::Exception::ReferenceError(v8::String::New("Wrong number of parameters")));
783788
}

0 commit comments

Comments
 (0)