Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] n-api: backport changes from master #19265

Commits on Apr 12, 2018

  1. test: add unhandled rejection guard

    Add an unhandled rejection function in
    addons-napi/test_promise/test.js. Also, add a
    rejection handler to catch the unhandled rejection
    after introducing the guard and test the reason
    code.
    
    PR-URL: nodejs#17275
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    babygoat authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    e304c42 View commit details
    Browse the repository at this point in the history
  2. test: remove literals that obscure assert messages

    Remove string literals as messages to `assert.strictEqual()`. They can
    be misleading here (where perhaps the reason an assertino failed isn't
    that the deleter wasn't called but rather was called too many times.
    
    PR-URL: nodejs#17642
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Trott authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    887dcb9 View commit details
    Browse the repository at this point in the history
  3. n-api: fix memory leak in napi_async_destroy()

    PR-URL: nodejs#17714
    Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Timothy Gu <timothygu99@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    alnyan authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    bba1442 View commit details
    Browse the repository at this point in the history
  4. test: remove ambiguous error messages from test_error

    assert.strictEqual accepts 3 arguments, the last of which allows for
    user-specified error message to be thrown when the assertion fails.
    Unfortunately, this error message is less helpful than the default when
    it is vague. This commit removes vague, user-specified error messages,
    instead relying on clearer, default error messages.
    
    PR-URL: nodejs#17812
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    nadrane authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    bcbb7af View commit details
    Browse the repository at this point in the history
  5. doc: updates examples to use NULL

    Examples in the N-API doc used a mix of nullptr and NULL.
    We should be consistent and because N-API is a 'C' API I believe
    using NULL is better.  This will avoid any potential confusion
    as to whether N-API can be used with plain C.
    
    PR-URL: nodejs#18008
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    6bf3769 View commit details
    Browse the repository at this point in the history
  6. n-api: throw RangeError in napi_create_dataview() with invalid range

    The API is required that `byte_length + byte_offset` is less than or
    equal to the size in bytes of the array passed in. If not, a RangeError
    exception is raised[1].
    
    [1] https://nodejs.org/api/n-api.html#n_api_napi_create_dataview
    
    PR-URL: nodejs#17869
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    romandev authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    f81330f View commit details
    Browse the repository at this point in the history
  7. n-api: expose n-api version in process.versions

    Expose n-api version in process.versions so that it is
    available for use in javascript by external modules
    like node-pre-gyp. It was previously accessible through
    a functon available in the N-API.
    
    PR-URL: nodejs#18067
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
    Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
    Reviewed-By: Tobias Nießn <tniessen@tnie.de>
    Reviewed-By: Richard Lau <riclau@uk.ibm.com>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    6d23c24 View commit details
    Browse the repository at this point in the history
  8. doc: napi: fix unbalanced emphasis

    Some of the section headers had unbalanced emphasis.
    
    PR-URL: nodejs#18122
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    ofrobots authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    40ce083 View commit details
    Browse the repository at this point in the history
  9. doc: napi: make header style consistent

    Some of the API section headers had emphasis, while others did not.
    Use a consistent style (no emphasis) for all of them, as that matches
    our other API docs.
    
    PR-URL: nodejs#18122
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    ofrobots authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    621117e View commit details
    Browse the repository at this point in the history
  10. n-api: throw RangeError napi_create_typedarray()

    According to the ECMA spec, we should throw a RangeError in the
    following cases:
      - `(length * elementSize) + offset` > the size of the array passed in
      - `offset % elementSize` != `0`
    
    In the current implementation, this check was omitted. So, the following
    code will cause a crash.
      ```
      napi_create_typedarray(env, napi_uint16_array, 2 /* length */,
                             buffer, 1 /* byte_offset */, &output_array);
      ```
    
    This change fixes the problem and write some related tests.
    
    Refs:
    https://tc39.github.io/ecma262/#sec-typedarray-buffer-byteoffset-length
    
    PR-URL: nodejs#18037
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    romandev authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    111678b View commit details
    Browse the repository at this point in the history
  11. test: fixed typos in napi test

    PR-URL: nodejs#18148
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    furstenheim authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    94618a5 View commit details
    Browse the repository at this point in the history
  12. doc: remove uannecessary Require

    This was the only instance were we said a parameter
    was required.  It is assumed parameters are required unless
    the doc says they are option.  Remove `Required` to make
    consistent with the rest of the doc
    
    PR-URL: nodejs#18184
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    375d043 View commit details
    Browse the repository at this point in the history
  13. timers: allow Immediates to be unrefed

    Refactor Immediates handling to allow for them to be unrefed, similar
    to setTimeout, but without extra handles.
    
    Document the new `immediate.ref()` and `immediate.unref()` methods.
    
    Add SetImmediateUnref on the C++ side.
    
    PR-URL: nodejs#18139
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    apapirovski authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    f7fb0c3 View commit details
    Browse the repository at this point in the history
  14. test: refactor addons-napi/test_exception/test.js

    * provide block scoping to prevent unintended side effects
    * remove confusing and unnecessary assertion message
    * use consisitent `actual, expected` argument order for assertions
    
    PR-URL: nodejs#18340
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Trott authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    23fd460 View commit details
    Browse the repository at this point in the history
  15. n-api: change assert ok check to notStrictEqual.

    PR-URL: nodejs#18414
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    nbdaaron authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    021e4a4 View commit details
    Browse the repository at this point in the history
  16. test: show pending exception error in napi tests

    Shows the result of the wasPending in the error message if the
    assertion fails.
    
    PR-URL: nodejs#18413
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    reccanti authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    bf96235 View commit details
    Browse the repository at this point in the history
  17. n-api: implement wrapping using private properties

    PR-URL: nodejs#18311
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Fixes: nodejs#14367
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    17862cd View commit details
    Browse the repository at this point in the history
  18. n-api: wrap control flow macro in do/while

    Make CHECK_ENV() safe to use in the following context:
    
        if (condition)
          CHECK_ENV(env);
        else
          something_else();
    
    PR-URL: nodejs#18532
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    bnoordhuis authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    29bbf0c View commit details
    Browse the repository at this point in the history
  19. doc: remove usage of you in n-api doc

    We avoid using 'you' in the documentation based on our
    guidelines. Remove usage in the n-api doc.
    
    PR-URL: nodejs#18528
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    6619a1b View commit details
    Browse the repository at this point in the history
  20. doc: small typo in n-api.md

    PR-URL: nodejs#18555
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Evan Lucas <evanlucas@me.com>
    iSkore authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    8923ad5 View commit details
    Browse the repository at this point in the history
  21. n-api: add methods to open/close callback scope

    Add support for the following methods;
      napi_open_callback_scope
      napi_close_callback_scope
    
    These are needed when running asynchronous methods directly
    using uv.
    
    PR-URL: nodejs#18089
    Fixes: nodejs#15604
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    ed8ac32 View commit details
    Browse the repository at this point in the history
  22. n-api: remove extra reference from test

    PR-URL: nodejs#18542
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    01b28fa View commit details
    Browse the repository at this point in the history
  23. doc: fix typo in n-api.md

    PR-URL: nodejs#18590
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Weijia Wang <starkwang@126.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
    vsemozhetbyt authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    d2f0672 View commit details
    Browse the repository at this point in the history
  24. test: improve error message output

    PR-URL: nodejs#18498
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    bshankar authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    9c20b87 View commit details
    Browse the repository at this point in the history
  25. test: convert new tests to use error types

    PR-URL: nodejs#18581
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    jackhorton authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    ef50323 View commit details
    Browse the repository at this point in the history
  26. doc: fix exporting a function example

    Missing the length argument in napi_create_function.
    
    PR-URL: nodejs#18661
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Aonghus O Nia authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    c4592e6 View commit details
    Browse the repository at this point in the history
  27. doc: mark NAPI_AUTO_LENGTH as code

    PR-URL: nodejs#18697
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    tniessen authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    5ab4d31 View commit details
    Browse the repository at this point in the history
  28. test: remove unnecessary timer

    The timer in NAPI's test_callback_scope/test-resolve-async.js
    can be removed. If the test fails, it will timeout on its own.
    The extra timer increases the chances of the test being
    flaky.
    
    PR-URL: nodejs#18719
    Fixes: nodejs#18702
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    cjihrig authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    a1df466 View commit details
    Browse the repository at this point in the history
  29. n-api: fix object test

    Passing a pointer to a static integer is sufficient for the test.
    
    PR-URL: nodejs#19039
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    eb85cd8 View commit details
    Browse the repository at this point in the history
  30. doc: fix n-api asynchronous threading docs

    Documentation for N-API Custom Asynchronous Operations incorrectly
    stated that async execution happens on the main event loop.
    Added details to napi_create_async_work about which threads are
    used to invoke the execute and complete callbacks.
    
    Changed 'async' to 'asynchronous' in the documentation for Custom
    Asynchronous Operations. Changed "executes in parallel" to "can
    execute in parallel" for the documentation of napi_create_async_work
    execute parameter.
    
    PR-URL: nodejs#19073
    Fixes: nodejs#19071
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    ebickle authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    2b3207d View commit details
    Browse the repository at this point in the history
  31. n-api: update reference test

    Remove the necessity for allocating on the heap, and assert that the
    correct pointer gets passed to the finalizer.
    
    PR-URL: nodejs#19086
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    7a80a8d View commit details
    Browse the repository at this point in the history
  32. n-api: update documentation

    Document which APIs work while an exception is pending. This is the
    list of all APIs which do not start with `NAPI_PREAMBLE(env)`.
    
    Fixes: nodejs/abi-stable-node#257
    PR-URL: nodejs#19078
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    de2d3a6 View commit details
    Browse the repository at this point in the history
  33. n-api: resolve promise in test

    The last promise created by the test for the purposes of making sure
    that its type is indeed a promise needs to be resolved so as to avoid
    having it left in the pending state at the end of the test.
    
    PR-URL: nodejs#19245
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    a92796e View commit details
    Browse the repository at this point in the history
  34. n-api,test: add a new.target test to addons-napi

    Added a N-API test to verify new.target behavior.
    
    PR-URL: nodejs#19236
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    boingoing authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    2cfd4fe View commit details
    Browse the repository at this point in the history
  35. n-api,test: add int64 bounds tests

    Added some simple tests to verify that the int64 API is correctly
    handling numbers greater than 32-bits. This is a basic test, but
    verifies that an implementer hasn't truncated back to 32-bits.
    
    Refs: nodejs/node-chakracore#496
    
    PR-URL: nodejs#19309
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    kfarnung authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    4a0fc8a View commit details
    Browse the repository at this point in the history
  36. doc: fix typos on n-api

    PR-URL: nodejs#19385
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: Richard Lau <riclau@uk.ibm.com>
    Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    shama authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    ff968b7 View commit details
    Browse the repository at this point in the history
  37. n-api: add missing exception checking

    Add checks for a pending exception in napi_make_callback
    after the callback has been invoked.  If there is a pending
    exception then we need to avoid checking the result as that
    will not be able to complete properly.
    
    Add additional checks to the unit test for napi_make_callback
    to catch this case.
    
    PR-URL: nodejs#19362
    Fixes: nodejs/node-addon-api#235
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    01790d4 View commit details
    Browse the repository at this point in the history
  38. n-api: separate out async_hooks test

    Place the test_make_callback async_hooks-related test into its own file.
    
    PR-URL: nodejs#19392
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    a19b829 View commit details
    Browse the repository at this point in the history
  39. n-api: add napi_fatal_exception

    Add function to trigger and uncaught exception.
    Useful if an async callback throws an exception with
    no way to recover.
    
    PR-URL: nodejs#19337
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    mafintosh authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    9b1b810 View commit details
    Browse the repository at this point in the history
  40. n-api: re-write test_make_callback

    This re-writes the test in C by dropping std::vector<napi_value> in
    favour of a C99 variable length array, and by dropping the anonymous
    namespace in favour of static function declarations.
    
    PR-URL: nodejs#19448
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    3a50835 View commit details
    Browse the repository at this point in the history
  41. doc: Add a missing comma

    PR-URL: nodejs#19555
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    leaves4j authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    b25dec8 View commit details
    Browse the repository at this point in the history
  42. n-api: bump version of n-api supported

    Bump the version due to additions to the api.
    
    PR-URL: nodejs#19497
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    mhdawson authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    c33daa4 View commit details
    Browse the repository at this point in the history
  43. n-api: ensure in-module exceptions are propagated

    Whenever we call into an addon, whether it is for a callback, for
    module init, or for async work-related reasons, we should make sure
    that
    
    * the last error is cleared,
    * the scopes before the call are the same as after, and
    * if an exception was thrown and captured inside the module, then it is
      re-thrown after the call.
    
    Therefore we should call into the module in a unified fashion. This
    change introduces the macro NAPI_CALL_INTO_MODULE() which should be
    used whenever invoking a callback provided by the module.
    
    Fixes: nodejs#19437
    PR-URL: nodejs#19537
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    65b06de View commit details
    Browse the repository at this point in the history
  44. n-api: back up env before finalize

    Heed the comment to not use fields of a Reference after calling its
    finalize callback, because such a call may destroy the Reference.
    
    Fixes: nodejs#19673
    PR-URL: nodejs#19718
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    e3a2737 View commit details
    Browse the repository at this point in the history
  45. n-api: add more int64_t tests

    * Updated tests for `Number` and `int32_t`
    * Added new tests for `int64_t`
    * Updated N-API `int64_t` behavior to return zero for all non-finite
      numbers
    * Clarified the documentation for these calls.
    
    PR-URL: nodejs#19402
    Refs: nodejs/node-chakracore#500
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    kfarnung authored and Gabriel Schulhof committed Apr 12, 2018
    Configuration menu
    Copy the full SHA
    d73e802 View commit details
    Browse the repository at this point in the history