Enable --harmony-function-tostring by default

Update tests to work with new behavior.

This feature is shipping in Firefox 54, so compatibility risk is low.

R=littledan@chromium.org, adamk@chromium.org, caitp@igalia.com
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Bug: v8:4958
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: Ib16d19468cf935f961d7bcd856ebbeb5692d3e61
Reviewed-on: https://chromium-review.googlesource.com/546941
Commit-Queue: Josh Wolfe <jwolfe@igalia.com>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50178}
This commit is contained in:
Josh Wolfe 2017-12-18 14:35:06 -07:00 committed by Commit Bot
parent 6767c3dec2
commit c3dda0bbac
7 changed files with 20 additions and 15 deletions

View File

@ -210,7 +210,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
// Features that are complete (but still behind --harmony/es-staging flag).
#define HARMONY_STAGED(V) \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_restrict_constructor_return, \
"harmony disallow non undefined primitive return value from class " \
"constructor") \
@ -222,6 +221,7 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony Unicode regexp property classes") \
V(harmony_async_iteration, "harmony async iteration") \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_promise_finally, "harmony Promise.prototype.finally")
#ifdef V8_INTL_SUPPORT

View File

@ -1,6 +1,6 @@
*%(basename)s:29: SyntaxError: Function arg string contains parenthesis
var paren_in_arg_string_bad = new Function(')', 'return;');
^
SyntaxError: Function arg string contains parenthesis
undefined:1: SyntaxError: Arg string terminates parameters early
(function anonymous()
^
SyntaxError: Arg string terminates parameters early
at new Function (<anonymous>)
at *%(basename)s:29:31

View File

@ -153,7 +153,7 @@ async function* asyncGeneratorForToString() {}
assertEquals("async function* asyncGeneratorForToString() {}",
asyncGeneratorForToString.toString());
assertEquals("async function* () {}", async function*() {}.toString());
assertEquals("async function*() {}", async function*() {}.toString());
assertEquals("async function* namedAsyncGeneratorForToString() {}",
async function* namedAsyncGeneratorForToString() {}.toString());
@ -164,9 +164,9 @@ assertEquals("async *method() { }",
assertEquals("async *method() { }",
(new (class { async *method() { } })).method.toString());
assertEquals("async function* anonymous() {\n\n}",
assertEquals("async function* anonymous(\n) {\n\n}",
AsyncGeneratorFunction().toString());
assertEquals("async function* anonymous() {\n\n}",
assertEquals("async function* anonymous(\n) {\n\n}",
(new AsyncGeneratorFunction()).toString());
// ----------------------------------------------------------------------------

View File

@ -46,4 +46,4 @@ assertThrows('Function("a", "", "//", "//")', SyntaxError);
// Some embedders rely on the string representation of the resulting
// function in cases where no formal parameters are specified.
var asString = Function("return 23").toString();
assertSame("function anonymous() {\nreturn 23\n}", asString);
assertSame("function anonymous(\n) {\nreturn 23\n}", asString);

View File

@ -14,15 +14,16 @@ function test(expectation, f) {
}
/*
(function() {
(function(
) {
1 + reference_error //@ sourceURL=evaltest
})
*/
test("2:5", new Function(
test("3:5", new Function(
'1 + reference_error //@ sourceURL=evaltest'));
/*
(function(x
/\**\/) {
) {
1 + reference_error //@ sourceURL=evaltest
})
@ -34,7 +35,7 @@ test("4:6", new Function(
,z//
,y
/\**\/) {
) {
1 + reference_error //@ sourceURL=evaltest
})
@ -44,7 +45,7 @@ test("7:6", new Function(
/*
(function(x/\*,z//
,y*\/
/\**\/) {
) {
1 + reference_error //@ sourceURL=evaltest
})
*/

View File

@ -4,5 +4,5 @@
function alert(x) {};
assertThrows(
Function("a=`","`,xss=1){alert(xss)")
'Function("a=`","`,xss=1){alert(xss)")'
);

View File

@ -118,6 +118,10 @@
# Invalid according to ES2015 syntax. (Details: crbug.com/726625)
'ecma_3/extensions/regress-368516': [FAIL],
# Function.prototype.toString revision.
# (https://chromium-review.googlesource.com/c/546941#message-5dc0f5efe277388501e8870e39ec70383dfc7db8)
'js1_5/Scope/regress-185485': [FAIL],
##################### SKIPPED TESTS #####################
# This test checks that we behave properly in an out-of-memory