On Tuesday, October 24, 2017 at 7:38:44 AM UTC-7, Ben Noordhuis wrote:
>
> On Tue, Oct 24, 2017 at 3:32 PM, J Decker <[email protected] <javascript:>>
> wrote:
> >
> > On Tuesday, October 24, 2017 at 3:40:31 AM UTC-7, Ben Noordhuis wrote:
> >>
> >> On Tue, Oct 24, 2017 at 5:53 AM, J Decker <[email protected]> wrote:
> >> >
> >> > On Thursday, August 7, 2014 at 3:52:53 PM UTC-7, Ben Noordhuis wrote:
> >> >>
> >> >> On Fri, Aug 8, 2014 at 12:10 AM, Flying Jester <[email protected]>
>
> >> >> wrote:
> >> >> > What precisely is the difference between using SetAccessor and
> >> >> > SetNativeDataProperty?
> >> >>
> >> >> Nothing, as far as I know. The order of arguments is different but
> >> >> they have identical implementations.
> >> >
> >> > They are not exactly the same... I've been using
> SetNativeDataProperty,
> >> > which works for getters, but when i started to use it for a setter,
> V8
> >> > ended
> >> > up setting a property on the object instead of calling the setter.
> >> > Changing
> >> > to SetAccessor allows the setter to be called correctly.
> >> >
> >> > And while I realize this is a very old thread; it's about the only
> one
> >> > that
> >> > shows up for 'SetNativeDataProperty vs SetAccessor'
> >> >
> >> > I can't find any other information that would indicate that
> >> > setnativedataproperty shouldn't or doesn't work; other than my code.
> >>
> >> Blast from the past!
> >>
> >> I believe what I wrote still holds (or holds again) if you start V8
> >> with `--disable_old_api_accessors`. It's currently off by default but
> >> that will likely change someday.
> >
> >
> > That option makes SetAccessor setter not work. It creates a property on
> the
> > object instead of calling the setter.
> >
> > psiTemplate2->PrototypeTemplate()->SetAccessor( String::NewFromUtf8(
> > isolate, "text" )
> > , ControlObject::getControlText, ControlObject::setControlText );
> >
> > So that's discouraging....
>
> With `--disable_old_api_accessors` they are quite literally the same
> implementation. Something else must be going on. Out-of-date V8
> version?
>
M:\javascript\vfs\native>node
> process.version
'v8.4.0'
> process.versions
{ http_parser: '2.7.0',
node: '8.4.0',
v8: '6.0.286.52',
uv: '1.13.1',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.22.0',
openssl: '1.0.2l',
icu: '59.1',
unicode: '9.0',
cldr: '31.0.1',
tz: '2017b' }
I doubt it. It's not absolute bleeding edge, but it's pretty new.
I was going to include the whole thing I'm trying to test, but expect that
to fail so here's a super simple test
https://github.com/d3x0r/test-accessor
It sets a SetAccessor called 'text' and a SetNativeDataProperty called
'native'
to build
npm install .
test1 : ( only setter called is SetAccessor settter )
npm test
(sample output)
> node test.js
plugin.cc: getter called... default value
Default: default value
plugin.cc: setter called... with newText
plugin.cc: getter called... newText
Default: [] newText
plugin.cc: getter called... newText
Default: newText
Default: [ 'native' ] nativeText
test2 : (passes --disable-old-api-accessors which makes neither setter get
called )
npm run test2
(sample output)
> node --disable-old-api-accessors test.js
plugin.cc: getter called... default value
Default: default value
Default: [ 'text' ] newText
plugin.cc: getter called... default value
Default: default value
Default: [ 'text', 'native' ] nativeText
--------- what I would have sent ---------
This is a node plugin - https://github.com/d3x0r/sack.vfs the new features
I'm extending it with I can only confirm work under Windows.
https://github.com/d3x0r/sack.vfs/blob/master/src/gui/sack_psi_module.cc#L415
configures accessor on prototype here
Which is tested with this
line... https://github.com/d3x0r/sack.vfs/blob/master/tests/sack_test4.js#L28
which should change the text in the resulting gui.
--
--
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.