@@ -3835,6 +3835,87 @@ void Context::DetachGlobal() {
3835
3835
}
3836
3836
3837
3837
3838
+ #ifdef QT_BUILD_SCRIPT_LIB
3839
+ Local<Context> v8::Context::NewScopeContext (v8::Handle<Object> scope_object) {
3840
+ i::Isolate* isolate = i::Isolate::Current ();
3841
+ EnsureInitializedForIsolate (isolate, " v8::Context::NewScopeContext()" );
3842
+ ON_BAILOUT (isolate, " v8::Context::NewScopeContext()" , return Local<Context>());
3843
+ LOG_API (isolate, " Context::NewScopeContext" );
3844
+
3845
+ ENTER_V8 (isolate);
3846
+ i::Handle<i::JSObject> obj = Utils::OpenHandle (*scope_object);
3847
+ i::Handle<i::Context> current (isolate->context ());
3848
+ i::Handle<i::Context> context = isolate->factory ()->NewWithContext (current, obj, /* is_catch_context=*/ false );
3849
+ return Utils::ToLocal (context);
3850
+ }
3851
+
3852
+
3853
+ Local<Context> v8::Context::NewFunctionContext () {
3854
+ i::Isolate* isolate = i::Isolate::Current ();
3855
+ EnsureInitializedForIsolate (isolate, " v8::Context::NewFunctionContext()" );
3856
+ ON_BAILOUT (isolate, " v8::Context::NewFunctionContext()" , return Local<Context>());
3857
+ LOG_API (isolate, " Context::NewFunctionContext" );
3858
+
3859
+ ENTER_V8 (isolate);
3860
+ i::Handle<i::JSFunction> closure (isolate->global_context ()->closure ());
3861
+ i::Handle<i::Context> context = isolate->factory ()->NewFunctionContext (i::Context::MIN_CONTEXT_SLOTS,
3862
+ closure);
3863
+ return Utils::ToLocal (context);
3864
+ }
3865
+
3866
+
3867
+ Local<Context> v8::Context::GetPrevious () {
3868
+ i::Isolate* isolate = i::Isolate::Current ();
3869
+ if (IsDeadCheck (isolate, " v8::Context::GetPrevious()" )) return Local<Context>();
3870
+ ENTER_V8 (isolate);
3871
+ i::Handle<i::Context> env = Utils::OpenHandle (this );
3872
+ if (env->IsGlobalContext ()) return Local<Context>();
3873
+ i::Context* previous = 0 ;
3874
+ if (env->is_function_context ())
3875
+ previous = env->closure ()->context ();
3876
+ else
3877
+ previous = env->previous ();
3878
+ if (!previous) return Local<Context>();
3879
+ i::Handle<i::Context> previous_handle (previous);
3880
+ return Utils::ToLocal (previous_handle);
3881
+ }
3882
+
3883
+
3884
+ Local<Object> v8::Context::GetExtensionObject () {
3885
+ i::Isolate* isolate = i::Isolate::Current ();
3886
+ if (IsDeadCheck (isolate, " v8::Context::GetExtensionObject()" )) return Local<Object>();
3887
+ ENTER_V8 (isolate);
3888
+ i::Handle<i::Context> env = Utils::OpenHandle (this );
3889
+ if (!env->has_extension ()) {
3890
+ if (env->is_function_context ()) {
3891
+ // Create extension object on demand.
3892
+ i::Handle<i::JSObject> ext = isolate->factory ()->NewJSObject (
3893
+ isolate->context_extension_function ());
3894
+ env->set_extension (*ext);
3895
+ } else {
3896
+ return Local<Object>();
3897
+ }
3898
+ }
3899
+ i::Handle<i::Object> extension_handle (env->extension ());
3900
+ return Local<v8::Object>(ToApi<Object>(extension_handle));
3901
+ }
3902
+
3903
+
3904
+ v8::Local<v8::Context> Context::GetCallerContext ()
3905
+ {
3906
+ i::JavaScriptFrameIterator it;
3907
+ if (it.done ())
3908
+ return Local<Context>();
3909
+ i::JavaScriptFrame *frame = it.frame ();
3910
+ ASSERT (frame);
3911
+ i::Context *context = (i::Context*)frame->context ();
3912
+ ASSERT (context);
3913
+ i::Handle<i::Context> context_handle (context);
3914
+ return Utils::ToLocal (context_handle);
3915
+ }
3916
+ #endif
3917
+
3918
+
3838
3919
void Context::ReattachGlobal (Handle<Object> global_object) {
3839
3920
i::Isolate* isolate = i::Isolate::Current ();
3840
3921
if (IsDeadCheck (isolate, " v8::Context::ReattachGlobal()" )) return ;
0 commit comments