diff --git a/deps/chakrashim/chakrashim.gyp b/deps/chakrashim/chakrashim.gyp index dc087e7f9e4..557d2ddd9a7 100644 --- a/deps/chakrashim/chakrashim.gyp +++ b/deps/chakrashim/chakrashim.gyp @@ -147,6 +147,7 @@ 'src/v8persistent.cc', 'src/v8private.cc', 'src/v8promise.cc', + 'src/v8resolver.cc', 'src/v8propertydescriptor.cc', 'src/v8proxy.cc', 'src/v8regexp.cc', diff --git a/deps/chakrashim/include/v8.h b/deps/chakrashim/include/v8.h index 9fb40e7d6e9..b5b226681c0 100644 --- a/deps/chakrashim/include/v8.h +++ b/deps/chakrashim/include/v8.h @@ -992,6 +992,12 @@ class V8_EXPORT StackFrame { bool IsConstructor() const; }; +enum class PromiseHookType { kInit, kResolve, kBefore, kAfter }; + +typedef void(*PromiseHook)(PromiseHookType type, Local promise, + Local parent); + + class V8_EXPORT Value : public Data { public: bool IsUndefined() const; @@ -1016,6 +1022,7 @@ class V8_EXPORT Value : public Data { bool IsSymbolObject() const; bool IsNativeError() const; bool IsRegExp() const; + bool IsAsyncFunction() const; bool IsGeneratorObject() const; bool IsExternal() const; bool IsArrayBuffer() const; @@ -1810,10 +1817,16 @@ class V8_EXPORT Promise : public Object { class V8_EXPORT Resolver : public Object { public: - static Local New(Isolate* isolate); + static V8_DEPRECATE_SOON("Use maybe version", + Local New(Isolate* isolate)); + static V8_WARN_UNUSED_RESULT MaybeLocal New( + Local context); Local GetPromise(); - void Resolve(Handle value); - void Reject(Handle value); + V8_DEPRECATE_SOON("Use maybe version", void Resolve(Local value)); + Maybe Resolve(Local context, Local value); + + V8_DEPRECATE_SOON("Use maybe version", void Reject(Local value)); + Maybe Reject(Local context, Local value); static Resolver* Cast(Value* obj); private: Resolver(); @@ -2550,6 +2563,7 @@ class V8_EXPORT Isolate { static uint32_t GetNumberOfDataSlots(); bool InContext(); Local GetCurrentContext(); + void SetPromiseHook(PromiseHook hook); void SetPromiseRejectCallback(PromiseRejectCallback callback); void RunMicrotasks(); void SetAutorunMicrotasks(bool autorun); diff --git a/deps/chakrashim/lib/chakra_shim.js b/deps/chakrashim/lib/chakra_shim.js index d44468f0d3c..e041b612abc 100644 --- a/deps/chakrashim/lib/chakra_shim.js +++ b/deps/chakrashim/lib/chakra_shim.js @@ -548,6 +548,10 @@ utils.isRegExp = function(obj) { return compareType(obj, 'RegExp'); }; + utils.isAsyncFunction = function(obj) { + // CHAKRA-TODO + return false; + }; utils.isSet = function(obj) { return compareType(obj, 'Set'); }; diff --git a/deps/chakrashim/src/jsrtcachedpropertyidref.inc b/deps/chakrashim/src/jsrtcachedpropertyidref.inc index bc3819f6c2e..01bf734dba6 100644 --- a/deps/chakrashim/src/jsrtcachedpropertyidref.inc +++ b/deps/chakrashim/src/jsrtcachedpropertyidref.inc @@ -99,6 +99,7 @@ DEF_IS_TYPE(isNativeError) DEF_IS_TYPE(isPromise) DEF_IS_TYPE(isProxy) DEF_IS_TYPE(isRegExp) +DEF_IS_TYPE(isAsyncFunction) DEF_IS_TYPE(isSet) DEF_IS_TYPE(isStringObject) DEF_IS_TYPE(isNumberObject) diff --git a/deps/chakrashim/src/v8isolate.cc b/deps/chakrashim/src/v8isolate.cc index 934c68c7d07..0eca3f00afe 100644 --- a/deps/chakrashim/src/v8isolate.cc +++ b/deps/chakrashim/src/v8isolate.cc @@ -116,6 +116,10 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { // CHAKRA does not support this explicit callback } +void Isolate::SetPromiseHook(PromiseHook hook) { + // CHAKRA-TODO: Unimplemented +} + bool Isolate::AddMessageListener(MessageCallback that, Handle data) { // Ignore data parameter. Node doesn't use it. return jsrt::IsolateShim::FromIsolate(this)->AddMessageListener( diff --git a/deps/chakrashim/src/v8resolver.cc b/deps/chakrashim/src/v8resolver.cc new file mode 100644 index 00000000000..f76eb76174b --- /dev/null +++ b/deps/chakrashim/src/v8resolver.cc @@ -0,0 +1,43 @@ +// Copyright Microsoft. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and / or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + +#include "v8chakra.h" +#include "jsrtutils.h" + +namespace v8 { + using Resolver = Promise::Resolver; + // CHAKRA-TODO: Unimplemented completely + MaybeLocal Resolver::New( + Local context) { + return Local(); + } + + Resolver* Resolver::Cast(Value* obj) { + return static_cast(obj); + } + + Maybe Resolver::Resolve(Local context, Local value) { + return Just(false); + } + + Maybe Resolver::Reject(Local context, Local value) { + return Just(false); + } +} // namespace v8 diff --git a/deps/chakrashim/src/v8value.cc b/deps/chakrashim/src/v8value.cc index 94bb9ac408c..a1ca1b2f247 100644 --- a/deps/chakrashim/src/v8value.cc +++ b/deps/chakrashim/src/v8value.cc @@ -190,6 +190,7 @@ IS_TYPE_FUNCTION(IsNativeError, isNativeError) IS_TYPE_FUNCTION(IsPromise, isPromise) IS_TYPE_FUNCTION(IsProxy, isProxy) IS_TYPE_FUNCTION(IsRegExp, isRegExp) +IS_TYPE_FUNCTION(IsAsyncFunction, isAsyncFunction) IS_TYPE_FUNCTION(IsSet, isSet) IS_TYPE_FUNCTION(IsStringObject, isStringObject) IS_TYPE_FUNCTION(IsNumberObject, isNumberObject) diff --git a/lib/trace_mgr.js b/lib/trace_mgr.js index a9cbf3dcec9..7572e77f3cd 100644 --- a/lib/trace_mgr.js +++ b/lib/trace_mgr.js @@ -97,7 +97,7 @@ function emitSyncTraceKind(emitKind, optInfo) { return buildTraceResult('fail'); } - var action = function() { + function action() { try { process.stderr.write(` Write error trace to: ${resolvedPath}\n`); global.emitTTDLog(resolvedPath); @@ -109,7 +109,7 @@ function emitSyncTraceKind(emitKind, optInfo) { } catch (ex) { process.stderr.write('Failed in emitTrace with: ' + ex); } - }; + } return buildTraceResult('success', action); } @@ -133,7 +133,7 @@ function emitAsyncTraceKind(emitKind) { return buildTraceResult('fail'); } - var action = function() { + function action() { try { process.stderr.write(` Write error trace to: ${resolvedPath}\n`); global.emitTTDLog(resolvedPath); @@ -145,7 +145,7 @@ function emitAsyncTraceKind(emitKind) { } catch (ex) { process.stderr.write('Failed in emitTrace with: ' + ex); } - }; + } //update the bin stats as needed updateEmitInfo(entry, resolvedPath); diff --git a/src/node.cc b/src/node.cc index ebf1b399037..7da7717f0d3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4933,8 +4933,7 @@ int Start(int argc, char** argv) { v8_initialized = true; #if ENABLE_TTD_NODE - bool chk_debug_enabled = debug_options.debugger_enabled() - || debug_options.inspector_enabled(); + bool chk_debug_enabled = debug_options.inspector_enabled(); TTDFlagWarning_Cond(!s_doTTRecord || !s_doTTReplay, "Cannot enable record & replay at same time.\n"); diff --git a/test/message/error_exit.chakracore.out b/test/message/error_exit.chakracore.out index ec2d377e757..1b83e45425d 100644 --- a/test/message/error_exit.chakracore.out +++ b/test/message/error_exit.chakracore.out @@ -1,5 +1,5 @@ Exiting with code=1 -AssertionError: 1 === 2 +AssertionError [ERR_ASSERTION]: 1 === 2 at Anonymous function (*test*message*error_exit.js:*:*) at Module.prototype._compile (module.js:*:*) at Module._extensions[.js] (module.js:*:*) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 5612eb6c513..0a96f648d58 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -28,8 +28,10 @@ test-fs-watch-encoding : FAIL, PASS [$jsEngine==chakracore] test-assert-checktag : PASS,FLAKY +test-async-wrap-getasyncid : PASS,FLAKY test-buffer-bindingobj-no-zerofill : PASS,FLAKY test-buffer-sharedarraybuffer : PASS,FLAKY +test-child-process-promisified : PASS,FLAKY test-cluster-inspector-debug-port : PASS,FLAKY test-crypto-dh : PASS,FLAKY test-debugger-repeat-last : PASS,FLAKY @@ -43,6 +45,8 @@ test-domain-no-error-handler-abort-on-uncaught-6 : PASS,FLAKY test-domain-no-error-handler-abort-on-uncaught-7 : PASS,FLAKY test-domain-no-error-handler-abort-on-uncaught-8 : PASS,FLAKY test-domain-no-error-handler-abort-on-uncaught-9 : PASS,FLAKY +test-domain-promise : PASS,FLAKY +test-fs-promisified : PASS,FLAKY test-fs-stat : PASS,FLAKY test-http-pipeline-flood : PASS,FLAKY test-http-same-map : PASS,FLAKY @@ -50,18 +54,22 @@ test-intl : PASS,FLAKY test-intl-no-icu-data : PASS,FLAKY test-memory-usage : PASS,FLAKY test-process-env-symbols : PASS,FLAKY +test-promise-internal-creation : PASS,FLAKY test-promises-unhandled-rejections : PASS,FLAKY +test-promises-unhandled-symbol-rejections : PASS,FLAKY test-promises-warning-on-unhandled-rejection : PASS,FLAKY test-regress-GH-12371 : PASS,FLAKY test-repl : PASS,FLAKY test-repl-mode : PASS,FLAKY test-repl-tab-complete : PASS,FLAKY test-string-decoder : PASS,FLAKY +test-timers-promisified : PASS,FLAKY test-trace-event : PASS,FLAKY test-url-domain-ascii-unicode : PASS,FLAKY test-util : PASS,FLAKY test-util-format-shared-arraybuffer : PASS,FLAKY test-util-inspect-proxy : PASS,FLAKY +test-util-promisify : PASS,FLAKY test-v8-serdes : PASS,FLAKY test-v8-serdes-sharedarraybuffer : PASS,FLAKY test-vm-cached-data : PASS,FLAKY