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

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
chakrabot committed Mar 20, 2018
2 parents aadf3a8 + d74184c commit 8946e05
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 288 deletions.
10 changes: 10 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,15 @@ deprecated if the assigned value is not a string, boolean, or number. In the
future, such assignment may result in a thrown error. Please convert the
property to a string before assigning it to `process.env`.
<a id="DEP0105"></a>
### DEP0105: decipher.finaltol
Type: Runtime
`decipher.finaltol()` has never been documented and is currently an alias for
[`decipher.final()`][]. In the future, this API will likely be removed, and it
is recommended to use [`decipher.final()`][] instead.
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
Expand All @@ -971,6 +980,7 @@ property to a string before assigning it to `process.env`.
[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding
[`crypto.fips`]: crypto.html#crypto_crypto_fips
[`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
[`decipher.final()`]: crypto.html#crypto_decipher_final_outputencoding
[`decipher.setAuthTag()`]: crypto.html#crypto_decipher_setauthtag_buffer
[`domain`]: domain.html
[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_publickey_encoding
Expand Down
5 changes: 2 additions & 3 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ASYNC_ID
} = require('internal/errors').codes;
const async_wrap = process.binding('async_wrap');
const internal_async_hooks = require('internal/async_hooks');

// Get functions
// For userland AsyncResources, make sure to emit a destroy event when the
// resource gets gced.
const { registerDestroyHook } = async_wrap;
const { registerDestroyHook } = internal_async_hooks;
const {
executionAsyncId,
triggerAsyncId,
Expand All @@ -38,7 +37,7 @@ const {
// Get constants
const {
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
} = async_wrap.constants;
} = internal_async_hooks.constants;

// Listener API //

Expand Down
7 changes: 6 additions & 1 deletion lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ const active_hooks = {
tmp_fields: null
};

const { registerDestroyHook } = async_wrap;

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

Expand Down Expand Up @@ -435,6 +436,9 @@ module.exports = {
init_symbol, before_symbol, after_symbol, destroy_symbol,
promise_resolve_symbol
},
constants: {
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve
},
enableHooks,
disableHooks,
clearDefaultTriggerAsyncId,
Expand All @@ -452,4 +456,5 @@ module.exports = {
emitBefore: emitBeforeScript,
emitAfter: emitAfterScript,
emitDestroy: emitDestroyScript,
registerDestroyHook,
};
10 changes: 7 additions & 3 deletions lib/internal/crypto/cipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const LazyTransform = require('internal/streams/lazy_transform');
const { StringDecoder } = require('string_decoder');

const { inherits } = require('util');
const { normalizeEncoding } = require('internal/util');
const { deprecate, normalizeEncoding } = require('internal/util');

function rsaPublic(method, defaultPadding) {
return function(options, buffer) {
Expand Down Expand Up @@ -217,6 +217,10 @@ Cipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;
Cipheriv.prototype.setAAD = Cipher.prototype.setAAD;


const finaltol = deprecate(Cipher.prototype.final,
'crypto.Decipher.finaltol is deprecated. Use ' +
'crypto.Decipher.final instead.', 'DEP0105');

function Decipher(cipher, password, options) {
if (!(this instanceof Decipher))
return new Decipher(cipher, password, options);
Expand Down Expand Up @@ -245,7 +249,7 @@ Decipher.prototype._transform = Cipher.prototype._transform;
Decipher.prototype._flush = Cipher.prototype._flush;
Decipher.prototype.update = Cipher.prototype.update;
Decipher.prototype.final = Cipher.prototype.final;
Decipher.prototype.finaltol = Cipher.prototype.final;
Decipher.prototype.finaltol = finaltol;
Decipher.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
Decipher.prototype.getAuthTag = Cipher.prototype.getAuthTag;
Decipher.prototype.setAuthTag = Cipher.prototype.setAuthTag;
Expand Down Expand Up @@ -288,7 +292,7 @@ Decipheriv.prototype._transform = Cipher.prototype._transform;
Decipheriv.prototype._flush = Cipher.prototype._flush;
Decipheriv.prototype.update = Cipher.prototype.update;
Decipheriv.prototype.final = Cipher.prototype.final;
Decipheriv.prototype.finaltol = Cipher.prototype.final;
Decipheriv.prototype.finaltol = finaltol;
Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
Decipheriv.prototype.getAuthTag = Cipher.prototype.getAuthTag;
Decipheriv.prototype.setAuthTag = Cipher.prototype.setAuthTag;
Expand Down
23 changes: 7 additions & 16 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) {
class PromiseWrap : public AsyncWrap {
public:
PromiseWrap(Environment* env, Local<Object> object, bool silent)
: AsyncWrap(env, object, silent) {
: AsyncWrap(env, object, PROVIDER_PROMISE, -1, silent) {
MakeWeak(this);
}
size_t self_size() const override { return sizeof(*this); }
Expand Down Expand Up @@ -582,32 +582,23 @@ AsyncWrap::AsyncWrap(Environment* env,
Local<Object> object,
ProviderType provider,
double execution_async_id)
: BaseObject(env, object),
provider_type_(provider) {
CHECK_NE(provider, PROVIDER_NONE);
CHECK_GE(object->InternalFieldCount(), 1);
: AsyncWrap(env, object, provider, execution_async_id, false) {}

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

// Use AsyncReset() call to execute the init() callbacks.
AsyncReset(execution_async_id);
}


// This is specifically used by the PromiseWrap constructor.
AsyncWrap::AsyncWrap(Environment* env,
Local<Object> object,
ProviderType provider,
double execution_async_id,
bool silent)
: BaseObject(env, object),
provider_type_(PROVIDER_PROMISE) {
provider_type_(provider) {
CHECK_NE(provider, PROVIDER_NONE);
CHECK_GE(object->InternalFieldCount(), 1);

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

// Use AsyncReset() call to execute the init() callbacks.
AsyncReset(-1, silent);
AsyncReset(execution_async_id, silent);
}


Expand Down
7 changes: 5 additions & 2 deletions src/async_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ class AsyncWrap : public BaseObject {
private:
friend class PromiseWrap;

// This is specifically used by the PromiseWrap constructor.
AsyncWrap(Environment* env, v8::Local<v8::Object> promise, bool silent);
AsyncWrap(Environment* env,
v8::Local<v8::Object> promise,
ProviderType provider,
double execution_async_id,
bool silent);
inline AsyncWrap();
const ProviderType provider_type_;
// Because the values may be Reset(), cannot be made const.
Expand Down
8 changes: 4 additions & 4 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ inline Environment* Environment::AsyncHooks::env() {

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

void Environment::CreateImmediate(native_immediate_callback cb,
void* data,
v8::Local<v8::Object> obj,
bool ref) {
void* data,
v8::Local<v8::Object> obj,
bool ref) {
native_immediate_callbacks_.push_back({
cb,
data,
Expand Down
Loading

0 comments on commit 8946e05

Please sign in to comment.