summaryrefslogtreecommitdiff
path: root/src/node_errors.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-06-02 19:42:22 +0200
committerRich Trott <rtrott@gmail.com>2019-06-12 20:56:44 -0700
commit0640526303bbe9c41801e2ad795f9cccb29f1fa4 (patch)
tree155a1027bf9b28de666f10b756a3c53257988414 /src/node_errors.h
parent25399e4c9cea290e0bb061b0208cb4e9e5e17642 (diff)
downloadandroid-node-v8-0640526303bbe9c41801e2ad795f9cccb29f1fa4.tar.gz
android-node-v8-0640526303bbe9c41801e2ad795f9cccb29f1fa4.tar.bz2
android-node-v8-0640526303bbe9c41801e2ad795f9cccb29f1fa4.zip
worker: make MessagePort constructor non-callable
Refactor the C++ code for creating `MessagePort`s to skip calling the constructor and instead directly instantiating the `InstanceTemplate`, and always throw an error from the `MessagePort` constructor. This aligns behaviour with the web, and creating single `MessagePort`s does not make sense anyway. PR-URL: https://github.com/nodejs/node/pull/28032 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_errors.h')
-rw-r--r--src/node_errors.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_errors.h b/src/node_errors.h
index 0dad93f31f..689911f996 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -54,7 +54,8 @@ void FatalException(v8::Isolate* isolate,
V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, Error) \
V(ERR_BUFFER_OUT_OF_BOUNDS, RangeError) \
V(ERR_BUFFER_TOO_LARGE, Error) \
- V(ERR_CONSTRUCT_CALL_REQUIRED, Error) \
+ V(ERR_CONSTRUCT_CALL_REQUIRED, TypeError) \
+ V(ERR_CONSTRUCT_CALL_INVALID, TypeError) \
V(ERR_INVALID_ARG_VALUE, TypeError) \
V(ERR_INVALID_ARG_TYPE, TypeError) \
V(ERR_INVALID_MODULE_SPECIFIER, TypeError) \
@@ -99,6 +100,7 @@ void FatalException(v8::Isolate* isolate,
#define PREDEFINED_ERROR_MESSAGES(V) \
V(ERR_BUFFER_CONTEXT_NOT_AVAILABLE, \
"Buffer is not available for the current Context") \
+ V(ERR_CONSTRUCT_CALL_INVALID, "Constructor cannot be called") \
V(ERR_CONSTRUCT_CALL_REQUIRED, "Cannot call constructor without `new`") \
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \