Commit ae510970 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Re-enable web tests affected by implementing REPL top-level await in V8

This CL re-enables tests that are affected by V8's top-level
await implementation.

Manual wrapping of code in an async arrow function was
removed from the frontend, so the 'unit' test for that wrapping
code is also removed as part of this CL.

Since we also correctly handle the completion value of async scripts,
the top-level-await web test was rebaselined. All other tests
can simply be re-enabled.

Bug: chromium:1021921
Change-Id: I902f36fa5b662f7df549dc233eee94212aaeadb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1962259Reviewed-by: default avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726387}
parent d82423c2
......@@ -2315,20 +2315,6 @@ crbug.com/491764 http/tests/devtools/service-workers/user-agent-override.js [ Pa
crbug.com/492511 [ Mac ] virtual/text-antialias/atsui-negative-spacing-features.html [ Failure ]
crbug.com/492511 [ Mac ] virtual/text-antialias/international/arabic-justify.html [ Failure ]
# Temporarily disable top-level await tests as the implementation moves
# from the DevTools frontend to native V8
crbug.com/1021921 http/tests/devtools/console/console-top-level-await.js [ Skip ]
crbug.com/1021921 http/tests/devtools/unit/preprocess-top-level-awaits.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-eval-exception-report.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-eval-object-literal.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-eval-throw.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-eval-undefined-override.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-group-similar.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/console-xpath.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/exception-objects.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/nested-worker-eval-contains-stack.js [ Skip ]
crbug.com/1021921 http/tests/devtools/console/worker-eval-contains-stack.js [ Skip ]
# Ref tests that fail due to differences in inline box structure, even though they contain the same text.
# This happens because inline box layout uses fixed-point measurements, which can cause rounding differences.
crbug.com/321237 [ Mac ] fast/selectors/007a.html [ Failure ]
......
......@@ -45,13 +45,13 @@ n
`status: ${(await Promise.resolve({status:200})).status}`
"status: 200"
for (let i = 0; i < 2; ++i) await i
undefined
1
for (let i = 0; i < 2; ++i) { await i }
undefined
1
await 0
0
await 0;function foo(){}
undefined
0
foo
ƒ foo(){}
class Foo{}; await 1;
......@@ -59,13 +59,9 @@ class Foo{}; await 1;
Foo
class Foo{}
await 0;function* gen(){}
undefined
for (var i = 0; i < 10; ++i) { await i; }
undefined
i
10
0
for (let j = 0; j < 5; ++j) { await j; }
undefined
4
j
VM:1 Uncaught ReferenceError: j is not defined
at <anonymous>:1:1
......@@ -73,7 +69,7 @@ VM:1 Uncaught ReferenceError: j is not defined
gen
ƒ* gen(){}
await 5; return 42;
VM:1 Uncaught SyntaxError: await is only valid in async function
VM:1 Uncaught SyntaxError: Illegal return statement
let o = await 1, p
undefined
p
......
......@@ -49,8 +49,6 @@
await test('class Foo{}; await 1;');
await test('Foo');
await test('await 0;function* gen(){}');
await test('for (var i = 0; i < 10; ++i) { await i; }')
await test('i');
await test('for (let j = 0; j < 5; ++j) { await j; }')
await test('j');
await test('gen');
......
This tests preprocessTopLevelAwaitExpressions.
--------------
0
was ignored.
--------------
await 0
was processed:
(async () => {return (await 0)
})()
--------------
async function foo() { await 0; }
was ignored.
--------------
async () => await 0
was ignored.
--------------
class A { async method() { await 0 } }
was ignored.
--------------
await 0; return 0;
was ignored.
--------------
var a = await 1
was processed:
(async () => {void (a = await 1)
})()
--------------
let a = await 1
was processed:
(async () => {void (a = await 1)
})()
--------------
const a = await 1
was processed:
(async () => {void (a = await 1)
})()
--------------
for (var i = 0; i < 1; ++i) { await i }
was processed:
(async () => {for (void (i = 0); i < 1; ++i) { await i }
})()
--------------
for (let i = 0; i < 1; ++i) { await i }
was processed:
(async () => {for (let i = 0; i < 1; ++i) { await i }
})()
--------------
var {a} = {a:1}, [b] = [1], {c:{d}} = {c:{d: await 1}}
was processed:
(async () => {void ( ({a} = {a:1}), ([b] = [1]), ({c:{d}} = {c:{d: await 1}}))
})()
--------------
console.log(`${(await {a:1}).a}`)
was processed:
(async () => {return (console.log(`${(await {a:1}).a}`))
})()
--------------
await 0;function foo() {}
was processed:
(async () => {await 0;foo=function foo() {}
})()
--------------
await 0;class Foo {}
was processed:
(async () => {await 0;Foo=class Foo {}
})()
--------------
if (await true) { function foo() {} }
was processed:
(async () => {if (await true) { foo=function foo() {} }
})()
--------------
if (await true) { class Foo{} }
was processed:
(async () => {if (await true) { class Foo{} }
})()
--------------
if (await true) { var a = 1; }
was processed:
(async () => {if (await true) { void (a = 1); }
})()
--------------
if (await true) { let a = 1; }
was processed:
(async () => {if (await true) { let a = 1; }
})()
--------------
var a = await 1; let b = 2; const c = 3;
was processed:
(async () => {void (a = await 1); void (b = 2); void (c = 3);
})()
--------------
let o = await 1, p
was processed:
(async () => {void ( (o = await 1), (p=undefined))
})()
--------------
for await (const number of asyncRandomNumbers()) {}
was processed:
(async () => {for await (const number of asyncRandomNumbers()) {}
})()
--------------
[...(await fetch('url', { method: 'HEAD' })).headers.entries()]
was processed:
(async () => {return ([...(await fetch('url', { method: 'HEAD' })).headers.entries()])
})()
--------------
await 1
//hello
was processed:
(async () => {return (await 1)
//hello
})()
--------------
var {a = await new Promise(resolve => resolve({a:123}))} = {a : 3}
was processed:
(async () => {void ({a = await new Promise(resolve => resolve({a:123}))} = {a : 3})
})()
--------------
await 1; for (var a of [1,2,3]);
was processed:
(async () => {await 1; for (var a of [1,2,3]);
})()
(async function() {
var commands = [
'0',
'await 0',
'async function foo() { await 0; }',
'async () => await 0',
'class A { async method() { await 0 } }',
'await 0; return 0;',
'var a = await 1',
'let a = await 1',
'const a = await 1',
'for (var i = 0; i < 1; ++i) { await i }',
'for (let i = 0; i < 1; ++i) { await i }',
'var {a} = {a:1}, [b] = [1], {c:{d}} = {c:{d: await 1}}',
'console.log(`${(await {a:1}).a}`)',
'await 0;function foo() {}',
'await 0;class Foo {}',
'if (await true) { function foo() {} }',
'if (await true) { class Foo{} }',
'if (await true) { var a = 1; }',
'if (await true) { let a = 1; }',
'var a = await 1; let b = 2; const c = 3;',
'let o = await 1, p',
'for await (const number of asyncRandomNumbers()) {}',
'[...(await fetch(\'url\', { method: \'HEAD\' })).headers.entries()]',
'await 1\n//hello',
'var {a = await new Promise(resolve => resolve({a:123}))} = {a : 3}',
'await 1; for (var a of [1,2,3]);'
];
await TestRunner.loadModule("formatter");
TestRunner.addResult("This tests preprocessTopLevelAwaitExpressions.");
for (var command of commands) {
TestRunner.addResult('--------------');
TestRunner.addResult(command);
let processedText = await Formatter.formatterWorkerPool().preprocessTopLevelAwaitExpressions(command);
if (processedText) {
TestRunner.addResult('was processed:');
TestRunner.addResult(processedText);
} else {
TestRunner.addResult('was ignored.');
}
}
TestRunner.completeTest();
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment