diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-06-02 23:49:55 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-08 20:19:35 +0200 |
commit | 6318078d2cb9980c4dc218d7fbe658cb77454165 (patch) | |
tree | 4207b0db17dd59d26a80ffa3b432297887886eb4 /lib/async_hooks.js | |
parent | d0571a926adbed4cc4e8be4329464f3c639ac929 (diff) | |
download | android-node-v8-6318078d2cb9980c4dc218d7fbe658cb77454165.tar.gz android-node-v8-6318078d2cb9980c4dc218d7fbe658cb77454165.tar.bz2 android-node-v8-6318078d2cb9980c4dc218d7fbe658cb77454165.zip |
async_hooks: make sure `.{en|dis}able() === this`
Make sure that `hook.enable()` and `hook.disable()` return `hook`
consistently, as the documentation indicates.
PR-URL: https://github.com/nodejs/node/pull/13418
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'lib/async_hooks.js')
-rw-r--r-- | lib/async_hooks.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/async_hooks.js b/lib/async_hooks.js index aec73ed770..d343a0e3de 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -96,7 +96,7 @@ class AsyncHook { // Each hook is only allowed to be added once. if (hooks_array.includes(this)) - return; + return this; if (!setupHooksCalled) { setupHooksCalled = true; @@ -124,7 +124,7 @@ class AsyncHook { const index = hooks_array.indexOf(this); if (index === -1) - return; + return this; hook_fields[kInit] -= +!!this[init_symbol]; hook_fields[kBefore] -= +!!this[before_symbol]; |