Thanks for you reply, Georg.

How exactly can the *module* local get dereferenced before the call? I 
reckon you mean the FunctionTemplate local?

In any case, moving the FunctionTemplate creation to a separate line before 
that doesn't solve the problem.
I'll file a report with the issue tracker, then :)

On Wednesday, 29 April 2020 16:19:05 UTC+2, Georg Neis wrote:
>
> On Wed, Apr 29, 2020 at 4:02 PM <stijnf...@gmail.com <javascript:>> 
> wrote: 
> > 1. Am I correct in assuming I have to add any exported values in the 
> SyntheticModuleEvaluationSteps function? I can only call 
> SetSyntheticModuleExport() within that call? This isn't clearly documented 
> everywhere. 
>
> It could theoretically also get called later. 
>
> > 2. Exporting simple values like integers works fine, but not functions. 
> Here's my code and the corresponding error: 
> > 
> > v8::MaybeLocal<v8::Value> 
> ScriptEngine::fillModule(v8::Local<v8::Context> context, 
> v8::Local<v8::Module> module) 
> > { 
> >     auto isolate = context->GetIsolate(); 
> > 
> >     auto name = v8::String::NewFromUtf8(isolate, 
> "now").ToLocalChecked(); 
> >     module->SetSyntheticModuleExport(name, 
> v8::FunctionTemplate::New(isolate, 
> &getNow)->GetFunction(context).ToLocalChecked()); 
> > 
> >     return v8::True(context->GetIsolate()); 
> > } 
>
> This code looks unsafe in that the module Local can get dereferenced 
> before the FunctionTemplate allocation, in which case the resulting 
> raw address might be invalid after the allocation. Move the allocation 
> into a separate statement before the call to SetSyntheticModuleExport. 
> If that doesn't solve your problem please file a bug on the V8 issue 
> tracker and include code for reproducing it. 
>
> -- 
> Georg Neis 
> Software Engineer 
>
> Google Germany GmbH 
> Erika-Mann-Straße 33 
> 80636 München 
>
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado 
> Registergericht und -nummer: Hamburg, HRB 86891 
> Sitz der Gesellschaft: Hamburg 
>
> Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise 
> erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes 
> weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich 
> bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 
>
> This e-mail is confidential. If you received this communication by 
> mistake, please don't forward it to anyone else, please erase all 
> copies and attachments, and please let me know that it has gone to the 
> wrong person. 
>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/8f2cc059-50b2-4dc8-bbde-28ce81afa673%40googlegroups.com.

Reply via email to