You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to make the ShadowRealm constructor work, it must be possible to create a new realm in the same way as JsRuntime::create_realm, but with a &mut v8::HandleScope rather than a &mut JsRuntime. This implies:
Making JsRuntime::create_realm and the methods it depends on static methods taking a scope or an isolate reference. In the case of create_realm, since it's public, it can stay with the current API, but the implementation would move to JsRuntime::create_realm_from_scope.
The extensions, global_template_middlewares, global_object_middlewares, preserve_snapshotted_modules and init_mode fields of JsRuntime must be available from the JsRuntimeState. @mmastrac suggested making a RuntimeExtensionInfo struct with those fields, which would also make things easier for Create an ExtensionSet to handle logic around multiple extensions #52.
Currently JsRealm::execute_script and module loading and evaluation use the scope returned by JsRealm::handle_scope. However, rusty_v8 needs each scope to take in a reference to the previous scope in order to keep track of the lifetimes, and JsRealm::handle_scope creates a new root scope. If this scope is created when the stack is not empty, as would happen when constructing a new realm from inside a JS execution context, handle_scope will panic. We would need to somehow make these JsRealm methods accept a parent scope, and use v8::ContextScope to switch into the realm.
The text was updated successfully, but these errors were encountered:
In order to make the
ShadowRealm
constructor work, it must be possible to create a new realm in the same way asJsRuntime::create_realm
, but with a&mut v8::HandleScope
rather than a&mut JsRuntime
. This implies:JsRuntime::create_realm
and the methods it depends on static methods taking a scope or an isolate reference. In the case ofcreate_realm
, since it's public, it can stay with the current API, but the implementation would move toJsRuntime::create_realm_from_scope
.extensions
,global_template_middlewares
,global_object_middlewares
,preserve_snapshotted_modules
andinit_mode
fields ofJsRuntime
must be available from theJsRuntimeState
. @mmastrac suggested making aRuntimeExtensionInfo
struct with those fields, which would also make things easier for Create anExtensionSet
to handle logic around multiple extensions #52.JsRuntime::init_extension_js
. fix(realms): Make realm creation not hang with async ops running #99 takes care of this.JsRealm::execute_script
and module loading and evaluation use the scope returned byJsRealm::handle_scope
. However, rusty_v8 needs each scope to take in a reference to the previous scope in order to keep track of the lifetimes, andJsRealm::handle_scope
creates a new root scope. If this scope is created when the stack is not empty, as would happen when constructing a new realm from inside a JS execution context,handle_scope
will panic. We would need to somehow make theseJsRealm
methods accept a parent scope, and usev8::ContextScope
to switch into the realm.The text was updated successfully, but these errors were encountered: