Skip to content

Commit e7f30db

Browse files
committed
deps: cherry-pick 3c8195d from V8 upstream
Original commit message: [map] 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. [email protected], [email protected] Bug: v8:7047 Change-Id: I7ce0253883a21d6059e4e0ed0fc56dc55a0dcba6 Reviewed-on: https://chromium-review.googlesource.com/758372 Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Sathya Gunasekaran <[email protected]> Commit-Queue: Yang Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#49237} PR-URL: #16897 Fixes: #16856 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 2b93151 commit e7f30db

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.10',
30+
'v8_embedder_string': '-node.11',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/src/builtins/builtins-collections-gen.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,11 @@ TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) {
302302

303303
BIND(&if_notobject);
304304
{
305-
Node* const exception = MakeTypeError(
306-
MessageTemplate::kIteratorValueNotAnObject, context, next_value);
307-
var_exception.Bind(exception);
308-
Goto(&if_exception);
305+
Node* ret = CallRuntime(
306+
Runtime::kThrowTypeError, context,
307+
SmiConstant(MessageTemplate::kIteratorValueNotAnObject), next_value);
308+
GotoIfException(ret, &if_exception, &var_exception);
309+
Unreachable();
309310
}
310311
}
311312

deps/v8/test/inspector/debugger/caught-uncaught-exceptions-expected.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ paused in throwCaught
33
uncaught: false
44
paused in throwUncaught
55
uncaught: true
6+
paused in throwInPromiseCaught
7+
uncaught: false
8+
paused in promiseUncaught
9+
uncaught: true
10+
paused in throwInMapConstructor
11+
uncaught: true
12+
paused in throwInAsyncIterator
13+
uncaught: true

deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspecto
77
contextGroup.addScript(
88
`function throwCaught() { try { throw new Error(); } catch (_) {} }
99
function throwUncaught() { throw new Error(); }
10+
function throwInPromiseCaught() {
11+
var reject;
12+
new Promise(function(res, rej) { reject = rej; }).catch(() => {});
13+
reject();
14+
}
15+
function throwInPromiseUncaught() {
16+
new Promise(function promiseUncaught() { throw new Error(); });
17+
}
18+
function throwInMapConstructor() { new Map('a'); }
19+
function throwInAsyncIterator() {
20+
let it = (async function*() {})();
21+
it.next.call({});
22+
}
1023
function schedule(f) { setTimeout(f, 0); }
1124
`);
1225

@@ -22,4 +35,12 @@ Protocol.Debugger.onPaused(message => {
2235
Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" })
2336
.then(() => Protocol.Runtime.evaluate(
2437
{ "expression": "schedule(throwUncaught);" }))
25-
.then(() => InspectorTest.completeTest());
38+
.then(() => Protocol.Runtime.evaluate(
39+
{ "expression": "schedule(throwInPromiseCaught);"}))
40+
.then(() => Protocol.Runtime.evaluate(
41+
{ "expression": "schedule(throwInPromiseUncaught);"}))
42+
.then(() => Protocol.Runtime.evaluate(
43+
{ "expression": "schedule(throwInMapConstructor);"}))
44+
.then(() => Protocol.Runtime.evaluate(
45+
{ "expression": "schedule(throwInAsyncIterator);"}))
46+
.then(() => InspectorTest.completeTest());

0 commit comments

Comments
 (0)