V8 - All fields are undefined [closed]












1














I use V8 and I create an object like this :



_template->SetInternalFieldCount(1);
v8::NamedPropertyHandlerConfiguration *handler = new v8::NamedPropertyHandlerConfiguration;
handler->getter = &BSONObject::getter;
handler->setter = &BSONObject::setter;
_template->SetHandler(*handler);
Local<Object> obj = _template->NewInstance();


When I use my getter I put the variable in the JS object like this :



info.GetReturnValue().Set(prop->ToString());


All my fields are undefined but I print prop->ToString() on the line just above and it print the good value.



I don't know why is it undefined...










share|improve this question













closed as off-topic by VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid Nov 19 '18 at 19:06


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid

If this question can be reworded to fit the rules in the help center, please edit the question.


















    1














    I use V8 and I create an object like this :



    _template->SetInternalFieldCount(1);
    v8::NamedPropertyHandlerConfiguration *handler = new v8::NamedPropertyHandlerConfiguration;
    handler->getter = &BSONObject::getter;
    handler->setter = &BSONObject::setter;
    _template->SetHandler(*handler);
    Local<Object> obj = _template->NewInstance();


    When I use my getter I put the variable in the JS object like this :



    info.GetReturnValue().Set(prop->ToString());


    All my fields are undefined but I print prop->ToString() on the line just above and it print the good value.



    I don't know why is it undefined...










    share|improve this question













    closed as off-topic by VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid Nov 19 '18 at 19:06


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid

    If this question can be reworded to fit the rules in the help center, please edit the question.
















      1












      1








      1







      I use V8 and I create an object like this :



      _template->SetInternalFieldCount(1);
      v8::NamedPropertyHandlerConfiguration *handler = new v8::NamedPropertyHandlerConfiguration;
      handler->getter = &BSONObject::getter;
      handler->setter = &BSONObject::setter;
      _template->SetHandler(*handler);
      Local<Object> obj = _template->NewInstance();


      When I use my getter I put the variable in the JS object like this :



      info.GetReturnValue().Set(prop->ToString());


      All my fields are undefined but I print prop->ToString() on the line just above and it print the good value.



      I don't know why is it undefined...










      share|improve this question













      I use V8 and I create an object like this :



      _template->SetInternalFieldCount(1);
      v8::NamedPropertyHandlerConfiguration *handler = new v8::NamedPropertyHandlerConfiguration;
      handler->getter = &BSONObject::getter;
      handler->setter = &BSONObject::setter;
      _template->SetHandler(*handler);
      Local<Object> obj = _template->NewInstance();


      When I use my getter I put the variable in the JS object like this :



      info.GetReturnValue().Set(prop->ToString());


      All my fields are undefined but I print prop->ToString() on the line just above and it print the good value.



      I don't know why is it undefined...







      c++ undefined v8






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 '18 at 14:11









      Aurélien Foucault

      788




      788




      closed as off-topic by VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid Nov 19 '18 at 19:06


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid

      If this question can be reworded to fit the rules in the help center, please edit the question.




      closed as off-topic by VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid Nov 19 '18 at 19:06


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – VTT, Toby Speight, Oussema Aroua, Matthieu Brucher, Killzone Kid

      If this question can be reworded to fit the rules in the help center, please edit the question.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          There are several examples of using SetHandler in various ways in https://chromium.googlesource.com/v8/v8/+/master/test/cctest/test-api-interceptors.cc.






          share|improve this answer




























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            There are several examples of using SetHandler in various ways in https://chromium.googlesource.com/v8/v8/+/master/test/cctest/test-api-interceptors.cc.






            share|improve this answer


























              0














              There are several examples of using SetHandler in various ways in https://chromium.googlesource.com/v8/v8/+/master/test/cctest/test-api-interceptors.cc.






              share|improve this answer
























                0












                0








                0






                There are several examples of using SetHandler in various ways in https://chromium.googlesource.com/v8/v8/+/master/test/cctest/test-api-interceptors.cc.






                share|improve this answer












                There are several examples of using SetHandler in various ways in https://chromium.googlesource.com/v8/v8/+/master/test/cctest/test-api-interceptors.cc.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 19:03









                jmrk

                5,715727




                5,715727















                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith