summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2017-11-08 13:06:37 +0100
committerMyles Borins <mylesborins@google.com>2017-11-30 09:47:22 +0900
commit58adb3cedf11800566b62c357fbef78ff8af2b72 (patch)
tree0716c3cedbeaf5e334912843f248d29b876bb8f7
parentf5ec28daac8f70736debfc37447171018f9296f9 (diff)
downloadandroid-node-v8-58adb3cedf11800566b62c357fbef78ff8af2b72.tar.gz
android-node-v8-58adb3cedf11800566b62c357fbef78ff8af2b72.tar.bz2
android-node-v8-58adb3cedf11800566b62c357fbef78ff8af2b72.zip
deps: backport 3c8195d from V8 upstream
Original commit message: Fix map constructor to correctly throw. We need to throw before rethrowing, otherwise the exception does not trigger a debugger event and is not reported if uncaught. R=gsathya@chromium.org, jgruber@chromium.org Bug: v8:7047 Change-Id: I7ce0253883a21d6059e4e0ed0fc56dc55a0dcba6 Reviewed-on: https://chromium-review.googlesource.com/758372 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#49237} Fixes: https://github.com/nodejs/node/issues/17270 PR-URL: https://github.com/nodejs/node/pull/17383 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
-rw-r--r--common.gypi2
-rw-r--r--deps/v8/src/builtins/builtins-collections-gen.cc9
-rw-r--r--deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt6
-rw-r--r--deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js17
4 files changed, 28 insertions, 6 deletions
diff --git a/common.gypi b/common.gypi
index 3b53721cd4..93d9e3ceee 100644
--- a/common.gypi
+++ b/common.gypi
@@ -27,7 +27,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.14',
+ 'v8_embedder_string': '-node.15',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
diff --git a/deps/v8/src/builtins/builtins-collections-gen.cc b/deps/v8/src/builtins/builtins-collections-gen.cc
index 3cb20cd8df..acb4c949ae 100644
--- a/deps/v8/src/builtins/builtins-collections-gen.cc
+++ b/deps/v8/src/builtins/builtins-collections-gen.cc
@@ -302,10 +302,11 @@ TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) {
BIND(&if_notobject);
{
- Node* const exception = MakeTypeError(
- MessageTemplate::kIteratorValueNotAnObject, context, next_value);
- var_exception.Bind(exception);
- Goto(&if_exception);
+ Node* ret = CallRuntime(
+ Runtime::kThrowTypeError, context,
+ SmiConstant(MessageTemplate::kIteratorValueNotAnObject), next_value);
+ GotoIfException(ret, &if_exception, &var_exception);
+ Unreachable();
}
}
diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt
index b784fa549e..039b8bd912 100644
--- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt
+++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt
@@ -3,3 +3,9 @@ paused in throwCaught
uncaught: false
paused in throwUncaught
uncaught: true
+paused in throwInPromiseCaught
+uncaught: false
+paused in promiseUncaught
+uncaught: true
+paused in throwInMapConstructor
+uncaught: true \ No newline at end of file
diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js
index 38b622d3db..8789943a89 100644
--- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js
+++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js
@@ -7,6 +7,15 @@ let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspecto
contextGroup.addScript(
`function throwCaught() { try { throw new Error(); } catch (_) {} }
function throwUncaught() { throw new Error(); }
+ function throwInPromiseCaught() {
+ var reject;
+ new Promise(function(res, rej) { reject = rej; }).catch(() => {});
+ reject();
+ }
+ function throwInPromiseUncaught() {
+ new Promise(function promiseUncaught() { throw new Error(); });
+ }
+ function throwInMapConstructor() { new Map('a'); }
function schedule(f) { setTimeout(f, 0); }
`);
@@ -22,4 +31,10 @@ Protocol.Debugger.onPaused(message => {
Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" })
.then(() => Protocol.Runtime.evaluate(
{ "expression": "schedule(throwUncaught);" }))
- .then(() => InspectorTest.completeTest());
+ .then(() => Protocol.Runtime.evaluate(
+ { "expression": "schedule(throwInPromiseCaught);"}))
+ .then(() => Protocol.Runtime.evaluate(
+ { "expression": "schedule(throwInPromiseUncaught);"}))
+ .then(() => Protocol.Runtime.evaluate(
+ { "expression": "schedule(throwInMapConstructor);"}))
+ .then(() => InspectorTest.completeTest());