The whole point of a MaybeLocal is that it *may *(or may not) contain a
value. Calling .ToLocalChecked() on it is unsafe, unless you happen to know
that it can't be empty. shell.cc:416
<https://chromium.googlesource.com/v8/v8/+/master/samples/shell.cc#416> is
doing it wrong. d8.cc:883
<https://chromium.googlesource.com/v8/v8/+/master/src/d8.cc#883> is doing
it right.

A callback throwing an exception is the canonical example of a function
that possibly returns no value, in which case its MaybeLocal return value
is empty. The reason we've introduced MaybeLocals is so embedders can be
sure they've covered all the places where they have to check for exceptions
being thrown, since they can't accidentally convert from MaybeLocal to
Local without explicitly checking for emptiness.


On Mon, Oct 5, 2015 at 9:25 PM, Jane Chen <jxche...@gmail.com> wrote:

> [jchen@jchen-z620 x64.release]$ ./shell
> V8 version 4.7.0 (candidate) [sample shell]
> > read();
> (shell):1: Bad parameters
> read();
> ^
>
> #
> # Fatal error in v8::ToLocalChecked
> # Empty MaybeLocal.
> #
>
> Illegal instruction (core dumped)
>
> This is with a build made with either:
>
> make -j8 x64.debug -werror=no GYPFLAGS="-Dv8_use_external_startup_data=0
> -Dcomponent=shared_library"
>
> or:
>
> make -j8 x64.release -werror=no GYPFLAGS="-Dv8_use_external_startup_data=0
> -Dcomponent=shared_library"
>
> I see this with my embedding application as well as long as I throw an
> exception from a callback.  Am I missing something or should I use a more
> stable branch?  If so, which branch of v8 works with the above?
>
> Thanks in advance.
>
> --
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to