ShadowRealm for a window context? #1784
Unanswered
tomvanenckevort
asked this question in
Q&A
Replies: 1 comment
-
I actually tried to check how AngleSharp would integrate with Jint 3.x among many other projects, but AngleSharp was most definitely the trickiest. So what I understood from the spec it would probably mean that AngleSharp would create it's own Host which there preliminary support for in Jint. Host would allow creating own global and setup it as wished, then engine instance would be kind of a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There seem to be a few older issues and discussions where it's mentioned that ShadowRealms might be a solution to work around the fact that v3 no longer allows you to create wrapped lexical environments. Is that still the case?
The reason I'm asking is because I'm looking into the migration of AngleSharp.Js to v3, which relies on a global
window
object. In the old code it would enter a new execution context with the "wrapped" lexicals, but that is no longer available.The only hacky way I've sort of seen working so far is to wrap the script inside a
with
statement (e.g.engine.Evaluate($"with (window) {{ {source} }}")
), since that internally still uses the same approach. But I don't think utilising that deprecated JS feature is any good.So far I haven't been able to find any real good example uses of the ShadowRealm that show how to pass in the right context objects in the right places.
Beta Was this translation helpful? Give feedback.
All reactions