Hello!

I'm trying to implement a replacement for the eval call
<https://source.chromium.org/chromium/chromium/src/+/main:content/public/test/browser_test_utils.cc;l=1826;drc=7fb345a0da63049b102e1c0bcdc8d7831110e324>
in
EvalJs that won't be blocked by CSP. To do this, I'm reimplementing the JS
wrapper (see the previous link) in C++ and having the ClassicScript run the
test-provided JS unmodified without an eval.

This mostly works, but the scoping behavior is different than eval's, which
is causing issues. I want vars to be defined in the global scope, but
let/const to be scoped to the JS being executed. I tried creating a new
Context that shared a global object with the existing one (my understanding
is that scopes map to Contexts), but Chrome was unhappy about defining a
new Context for the main world, and I'm not sure that would make vars
behave correctly.

Is there a way to get the scoping behavior I want, or a better approach to
work around CSP?


Thanks!
  Robbie

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CANtkjcRi8O3Z9aPzeEX0sFPmCfdhbB1%2Bp-zKnYVnFHnry1D3NA%40mail.gmail.com.

Reply via email to