I've tried to reproduce your issue using d8 Realms, but don't see the same
error:

$ cat /tmp/realmstest.js
function testFunction(){
  let tmpFunc = Function("(function test(\n) {\nreturn 7;\n})\n");
  console.log(typeof tmpFunc);
}
testFunction();

let realm = Realm.createAllowCrossRealmAccess();
Realm.eval(realm, 'Realm.global(0).testFunction();');

$ v8 /tmp/realmstest.js
function
function

Could you please file a bug on https://crbug.com/v8 with a reproducing test
case?

On Thu, Jan 13, 2022 at 1:00 PM victoria yang <[email protected]>
wrote:

> Hi,
>   Recently I encountered an issue in V8.
>
> *Issue*:
> typeof(Function(str)) is undefined
>
> *Env:*
> *Step1*: In One Isolate, I create Context A (Run Common JS bundle ) and
> Context B(Run Business JS Bundle), and set Same SecurityToken.
>
> *Step2*:
> In ContextA  had JS code Below :
>
>
>  testFunction(){
>   let tmpFunc = *Function*("(function test(\n) {\nreturn 7;\n})\n");
>   console.log(*typeof tmpFunc*);
> }
>
>
> on ContextA, run testFunction(), console result is '*function*'
>
> *Step3*:
> In ContextB, call testFunction in ContextA
> console result is '*undefined*',
> and run tmpFunc(), report Exception '* is not a function*'
>
>
> And For Object.create() 、Object.is() and so on shows OK. Only
> StringToFunction shows error.
> Do you know Why it causes such an issue? Any Advice ?
>
>
> Pls,help.
> Thank you for your time and I look forward to your reply.
>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/CAP96edMVUP-58i1wuHsTN3xbUh8iOwTdB2R9k1N4xzVQD3R10Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/v8-dev/CAP96edMVUP-58i1wuHsTN3xbUh8iOwTdB2R9k1N4xzVQD3R10Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAGRskv-0gF8fjWPwuVYe3Eic3AsiL5Cvas95N5h2wdLmQbRuHQ%40mail.gmail.com.

Reply via email to