Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 8946e05

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge d74184c as of 2018-03-18 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
2 parents aadf3a8 + d74184c commit 8946e05

File tree

10 files changed

+238
-288
lines changed

10 files changed

+238
-288
lines changed

doc/api/deprecations.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,15 @@ deprecated if the assigned value is not a string, boolean, or number. In the
950950
future, such assignment may result in a thrown error. Please convert the
951951
property to a string before assigning it to `process.env`.
952952
953+
<a id="DEP0105"></a>
954+
### DEP0105: decipher.finaltol
955+
956+
Type: Runtime
957+
958+
`decipher.finaltol()` has never been documented and is currently an alias for
959+
[`decipher.final()`][]. In the future, this API will likely be removed, and it
960+
is recommended to use [`decipher.final()`][] instead.
961+
953962
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
954963
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
955964
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
@@ -971,6 +980,7 @@ property to a string before assigning it to `process.env`.
971980
[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding
972981
[`crypto.fips`]: crypto.html#crypto_crypto_fips
973982
[`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
983+
[`decipher.final()`]: crypto.html#crypto_decipher_final_outputencoding
974984
[`decipher.setAuthTag()`]: crypto.html#crypto_decipher_setauthtag_buffer
975985
[`domain`]: domain.html
976986
[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_publickey_encoding

lib/async_hooks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ const {
55
ERR_INVALID_ARG_TYPE,
66
ERR_INVALID_ASYNC_ID
77
} = require('internal/errors').codes;
8-
const async_wrap = process.binding('async_wrap');
98
const internal_async_hooks = require('internal/async_hooks');
109

1110
// Get functions
1211
// For userland AsyncResources, make sure to emit a destroy event when the
1312
// resource gets gced.
14-
const { registerDestroyHook } = async_wrap;
13+
const { registerDestroyHook } = internal_async_hooks;
1514
const {
1615
executionAsyncId,
1716
triggerAsyncId,
@@ -38,7 +37,7 @@ const {
3837
// Get constants
3938
const {
4039
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
41-
} = async_wrap.constants;
40+
} = internal_async_hooks.constants;
4241

4342
// Listener API //
4443

lib/internal/async_hooks.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ const active_hooks = {
6565
tmp_fields: null
6666
};
6767

68+
const { registerDestroyHook } = async_wrap;
6869

6970
// Each constant tracks how many callbacks there are for any given step of
7071
// async execution. These are tracked so if the user didn't include callbacks
7172
// for a given step, that step can bail out early.
72-
const { kInit, kBefore, kAfter, kDestroy, kPromiseResolve,
73+
const { kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
7374
kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
7475
kDefaultTriggerAsyncId, kStackLength } = async_wrap.constants;
7576

@@ -435,6 +436,9 @@ module.exports = {
435436
init_symbol, before_symbol, after_symbol, destroy_symbol,
436437
promise_resolve_symbol
437438
},
439+
constants: {
440+
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve
441+
},
438442
enableHooks,
439443
disableHooks,
440444
clearDefaultTriggerAsyncId,
@@ -452,4 +456,5 @@ module.exports = {
452456
emitBefore: emitBeforeScript,
453457
emitAfter: emitAfterScript,
454458
emitDestroy: emitDestroyScript,
459+
registerDestroyHook,
455460
};

lib/internal/crypto/cipher.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const LazyTransform = require('internal/streams/lazy_transform');
3030
const { StringDecoder } = require('string_decoder');
3131

3232
const { inherits } = require('util');
33-
const { normalizeEncoding } = require('internal/util');
33+
const { deprecate, normalizeEncoding } = require('internal/util');
3434

3535
function rsaPublic(method, defaultPadding) {
3636
return function(options, buffer) {
@@ -217,6 +217,10 @@ Cipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;
217217
Cipheriv.prototype.setAAD = Cipher.prototype.setAAD;
218218

219219

220+
const finaltol = deprecate(Cipher.prototype.final,
221+
'crypto.Decipher.finaltol is deprecated. Use ' +
222+
'crypto.Decipher.final instead.', 'DEP0105');
223+
220224
function Decipher(cipher, password, options) {
221225
if (!(this instanceof Decipher))
222226
return new Decipher(cipher, password, options);
@@ -245,7 +249,7 @@ Decipher.prototype._transform = Cipher.prototype._transform;
245249
Decipher.prototype._flush = Cipher.prototype._flush;
246250
Decipher.prototype.update = Cipher.prototype.update;
247251
Decipher.prototype.final = Cipher.prototype.final;
248-
Decipher.prototype.finaltol = Cipher.prototype.final;
252+
Decipher.prototype.finaltol = finaltol;
249253
Decipher.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
250254
Decipher.prototype.getAuthTag = Cipher.prototype.getAuthTag;
251255
Decipher.prototype.setAuthTag = Cipher.prototype.setAuthTag;
@@ -288,7 +292,7 @@ Decipheriv.prototype._transform = Cipher.prototype._transform;
288292
Decipheriv.prototype._flush = Cipher.prototype._flush;
289293
Decipheriv.prototype.update = Cipher.prototype.update;
290294
Decipheriv.prototype.final = Cipher.prototype.final;
291-
Decipheriv.prototype.finaltol = Cipher.prototype.final;
295+
Decipheriv.prototype.finaltol = finaltol;
292296
Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
293297
Decipheriv.prototype.getAuthTag = Cipher.prototype.getAuthTag;
294298
Decipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;

src/async_wrap.cc

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) {
228228
class PromiseWrap : public AsyncWrap {
229229
public:
230230
PromiseWrap(Environment* env, Local<Object> object, bool silent)
231-
: AsyncWrap(env, object, silent) {
231+
: AsyncWrap(env, object, PROVIDER_PROMISE, -1, silent) {
232232
MakeWeak(this);
233233
}
234234
size_t self_size() const override { return sizeof(*this); }
@@ -582,32 +582,23 @@ AsyncWrap::AsyncWrap(Environment* env,
582582
Local<Object> object,
583583
ProviderType provider,
584584
double execution_async_id)
585-
: BaseObject(env, object),
586-
provider_type_(provider) {
587-
CHECK_NE(provider, PROVIDER_NONE);
588-
CHECK_GE(object->InternalFieldCount(), 1);
585+
: AsyncWrap(env, object, provider, execution_async_id, false) {}
589586

590-
// Shift provider value over to prevent id collision.
591-
persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider);
592-
593-
// Use AsyncReset() call to execute the init() callbacks.
594-
AsyncReset(execution_async_id);
595-
}
596-
597-
598-
// This is specifically used by the PromiseWrap constructor.
599587
AsyncWrap::AsyncWrap(Environment* env,
600588
Local<Object> object,
589+
ProviderType provider,
590+
double execution_async_id,
601591
bool silent)
602592
: BaseObject(env, object),
603-
provider_type_(PROVIDER_PROMISE) {
593+
provider_type_(provider) {
594+
CHECK_NE(provider, PROVIDER_NONE);
604595
CHECK_GE(object->InternalFieldCount(), 1);
605596

606597
// Shift provider value over to prevent id collision.
607598
persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider_type_);
608599

609600
// Use AsyncReset() call to execute the init() callbacks.
610-
AsyncReset(-1, silent);
601+
AsyncReset(execution_async_id, silent);
611602
}
612603

613604

src/async_wrap.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ class AsyncWrap : public BaseObject {
185185
private:
186186
friend class PromiseWrap;
187187

188-
// This is specifically used by the PromiseWrap constructor.
189-
AsyncWrap(Environment* env, v8::Local<v8::Object> promise, bool silent);
188+
AsyncWrap(Environment* env,
189+
v8::Local<v8::Object> promise,
190+
ProviderType provider,
191+
double execution_async_id,
192+
bool silent);
190193
inline AsyncWrap();
191194
const ProviderType provider_type_;
192195
// Because the values may be Reset(), cannot be made const.

src/env-inl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ inline Environment* Environment::AsyncHooks::env() {
121121

122122
// Remember to keep this code aligned with pushAsyncIds() in JS.
123123
inline void Environment::AsyncHooks::push_async_ids(double async_id,
124-
double trigger_async_id) {
124+
double trigger_async_id) {
125125
// Since async_hooks is experimental, do only perform the check
126126
// when async_hooks is enabled.
127127
if (fields_[kCheck] > 0) {
@@ -498,9 +498,9 @@ Environment::file_handle_read_wrap_freelist() {
498498
}
499499

500500
void Environment::CreateImmediate(native_immediate_callback cb,
501-
void* data,
502-
v8::Local<v8::Object> obj,
503-
bool ref) {
501+
void* data,
502+
v8::Local<v8::Object> obj,
503+
bool ref) {
504504
native_immediate_callbacks_.push_back({
505505
cb,
506506
data,

0 commit comments

Comments
 (0)