Re: [v8-users] Is it safe to consume v8::Private methods?
Gautham, I think you might be misunderstanding how the Maybe<> API is supposed to be used. When used correctly, it is absolutely safe and will never crash. - Maybe::FromJust() / MaybeLocal::ToLocalChecked() are intended for when you know for sure that the Maybe / MaybeLocal is not empty. Usually, the only case when you would know that is when you've just checked. - Maybe::IsNothing() / Maybe::IsJust() / MaybeLocal::IsEmpty() are intended for doing precisely that check. Typical usage looks like: MaybeLocal result = ...; if (result.IsEmpty()) { // Handle error case, e.g. print a warning. return false; } else { // .ToLocalChecked is safe to use here :-) do_something_with(result.ToLocalChecked()); } For convenience, there are also the Maybe::FromMaybe() / MaybeLocal::ToLocal() helpers: Maybe maybe_x = ...; int x = maybe_x.FromMaybe(-1); // same as: // int x = maybe_x.IsJust() ? maybe_x.FromJust() : -1; Of course you can also use Private Symbols if you prefer; but there's really no reason to avoid private fields for stability reasons. Hope this helps, Jakob On Fri, Jul 14, 2017 at 12:00 AM, Ben Noordhuiswrote: > On Fri, Jul 14, 2017 at 5:52 AM, Gautham B A > wrote: > > No, .ToLocalChecked() is called by my code, not from V8. > > > > I would like to know if the APIs under v8::Private namespace has been > battle > > tested. > > Node.js uses them and I'm fairly sure Chromium does too, so yes, I > think you can say it's battle tested. > > -- > -- > 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.
[v8-users] Intent to ship: allowing invalid escape sequences in tagged template literals
Contact email: bak...@gmail.com Spec: https://tc39.github.io/proposal-template-literal-revision/ This feature is stage 4 and will be included in the 2018 edition of ECMA-262. Summary: ES6 template literals forbid certain escape sequences, like `\u{not hex}`. But tagged templates expose to user code the raw code points of the template literal, and some applications only care about those. As such, this stage 4 TC39 proposal allows such invalid escape sequences in tagged template literals. The "cooked" value of such a template (that is to say, with escape sequences interpreted), which is also exposed to user code, is `undefined`. Interop risk: This new language feature allows syntax that was previously a SyntaxError, so compatibility risk is low. Firefox has shipped this feature ( https://bugzilla.mozilla.org/show_bug.cgi?id=1317375 ). Safari has implemented this feature ( https://bugs.webkit.org/show_bug.cgi?id=166871 ) and shipped it in at least Tech Preview. Edge has not implemented this feature ( https://github.com/Microsoft/ChakraCore/issues/2344 ). Tracking bug: https://bugs.chromium.org/p/v8/issues/detail?id=5546 -- -- 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] How to call js function from C++ with default recv value?
Hi, I'm trying to deal with a case when user pass Function callback to C++ and it needs to be invoked from that C++ respecting this value, So Function::Call() does not fulfill this requirement. Are there any change to achieve that without creating new Script and run it within a new Context with, e.g. 'fnc(...args)' where fnc is callback user provided and args are function arguments to call it with, both set on global object of this context? -- -- 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.
Re: [v8-users] Is it safe to consume v8::Private methods?
On Fri, Jul 14, 2017 at 5:52 AM, Gautham B Awrote: > No, .ToLocalChecked() is called by my code, not from V8. > > I would like to know if the APIs under v8::Private namespace has been battle > tested. Node.js uses them and I'm fairly sure Chromium does too, so yes, I think you can say it's battle tested. -- -- 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.