Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various test cases for cross-browser compliance bugs #1532

Merged
merged 1 commit into from
May 3, 2018

Conversation

anba
Copy link
Contributor

@anba anba commented Apr 25, 2018

Some test cases where I observed cross-browser compatibility issues in the past.

@ljharb
Copy link
Member

ljharb commented Apr 25, 2018

It’d be helpful for es6-shim for the API cases if you could comment somehow (in the PR is fine) which engines/browsers fail these tests.

@anba
Copy link
Contributor Author

anba commented Apr 25, 2018

@ljharb

Versions:
V8: b49206ded97c4eaac7c273ce004d840a0185d40e
Chakra: 60b52c56bec9e156b55b558f6d8a7ef7c6ef4810
JSC: r230952

Array/prototype/{filter,map,slice,splice}/target-array-with-non-writable-property.js -> JSC, Chakra
Array/prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js -> JSC, Chakra
Array/prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js -> JSC, Chakra, V8
Array/prototype/splice/property-traps-order-with-species.js -> JSC, Chakra, V8
Function/prototype/bind/length-exceeds-int32.js -> JSC, Chakra
Object/assign/strings-and-symbol-order.js -> Chakra, V8
Object/keys/property-traps-order-with-proxied-array.js -> JSC, V8
Array/prototype/toLocaleString/calls-toLocaleString-number-elements.js -> Chakra, V8
TypedArray/prototype/toLocaleString/calls-toLocaleString-number-elements.js -> JSC, Chakra, V8

SpiderMonkey issues (only the ones I still remember):
https://bugzilla.mozilla.org/show_bug.cgi?id=1121938
https://bugzilla.mozilla.org/show_bug.cgi?id=1130636
https://bugzilla.mozilla.org/show_bug.cgi?id=1323825
https://bugzilla.mozilla.org/show_bug.cgi?id=1364363


a.constructor[Symbol.species] = function(len) {
return new Proxy(new Array(len), new Proxy({}, {
get(t, pk, r) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow!!! this is great!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa.

assert.sameValue(f(), 1);
}

g();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test case has an extra block-statement, which is not present in the linked one. And the linked test succeeds in SM/V8/JSC/Chakra, whereas the new test case only succeeds in V8.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks for the clarification

var f;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also an extra block-statement which makes it different from the existing one. (The existing test case passes in V8/SM and fails in JSC/Chakra, the new one only passes in SM.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


throw "Test262: This statement should not be evaluated.";

async(a = await => {}) => {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test case passes only in Chakra and SM, whereas the existing one passes in all four engines. (The new test case tries to ensure arrow functions with await as the arrow-parameter are correctly handled in async arrow function parameters.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


throw "Test262: This statement should not be evaluated.";

async() => { (a = await/r/g) => {} };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


throw "Test262: This statement should not be evaluated.";

async(a = (await) => {}) => {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


throw "Test262: This statement should not be evaluated.";

async(a = (...await) => {}) => {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

are to appear in a script exactly as written. All terminal symbol code points
specified in this way are to be understood as the appropriate Unicode code points
from the Basic Latin range, as opposed to any similar-looking code points from
other Unicode ranges.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description and info aren't correct for this test.

Given:

async [no LineTerminator here] AsyncArrowBindingIdentifier

The comment in the actual test source is good:

Throws ReferenceError because reference for "async" cannot be resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we should cite both sections? 14.7 for the overall grammar of async arrow functions and 5.1.5 to make clear that \u0061sync shouldn't actually be considered as an async arrow function in the first place.


It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to add this section: https://tc39.github.io/ecma262/#sec-strict-mode-code, but you don't have to do it if it's a pain (I don't mind doing it in a follow up)

info: |
12.1.1 Static Semantics: Early Errors

IdentifierReference : yield
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

info: |
12.1.1 Static Semantics: Early Errors

IdentifierReference : yield
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@leobalter
Copy link
Member

LGTM, waiting for @rwaldron to confirm the changes after his review.

@anba
Copy link
Contributor Author

anba commented May 3, 2018

I've folded the updates in original patch, because it only updated yaml code.

Complete diff.
diff --git a/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js b/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js
index 0182fac..ee3a7a0 100644
--- a/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js
+++ b/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js
@@ -2,10 +2,16 @@
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
-esid: sec-grammar-notation
+esid: sec-async-arrow-function-definitions
 description: >
-  The `async` contextual keyword must not contain Unicode escape sequences.
+  Escaped "async" followed by a line-terminator is not misinterpreted as an AsyncArrowFunction.
 info: |
+  14.7 Async Function Definitions
+
+  async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+
+  5.1.5 Grammar Notation
+
   Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
diff --git a/test/language/expressions/class/class-name-ident-let-escaped.js b/test/language/expressions/class/class-name-ident-let-escaped.js
index 42faf32..e9beb52 100644
--- a/test/language/expressions/class/class-name-ident-let-escaped.js
+++ b/test/language/expressions/class/class-name-ident-let-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/expressions/class/class-name-ident-let.js b/test/language/expressions/class/class-name-ident-let.js
index 2224fa3..d08620f 100644
--- a/test/language/expressions/class/class-name-ident-let.js
+++ b/test/language/expressions/class/class-name-ident-let.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/expressions/class/class-name-ident-static-escaped.js b/test/language/expressions/class/class-name-ident-static-escaped.js
index fb519a1..8680e69 100644
--- a/test/language/expressions/class/class-name-ident-static-escaped.js
+++ b/test/language/expressions/class/class-name-ident-static-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/expressions/class/class-name-ident-static.js b/test/language/expressions/class/class-name-ident-static.js
index 1b8c23f..a914e59 100644
--- a/test/language/expressions/class/class-name-ident-static.js
+++ b/test/language/expressions/class/class-name-ident-static.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/expressions/class/class-name-ident-yield-escaped.js b/test/language/expressions/class/class-name-ident-yield-escaped.js
index 445fe29..6adf12d 100644
--- a/test/language/expressions/class/class-name-ident-yield-escaped.js
+++ b/test/language/expressions/class/class-name-ident-yield-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/expressions/class/class-name-ident-yield.js b/test/language/expressions/class/class-name-ident-yield.js
index 4c69296..ecc3f44 100644
--- a/test/language/expressions/class/class-name-ident-yield.js
+++ b/test/language/expressions/class/class-name-ident-yield.js
@@ -11,6 +11,10 @@ info: |
   IdentifierReference : yield
 
   It is a Syntax Error if the code matched by this production is contained in strict mode code.
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-await-module.js b/test/language/statements/class/class-name-ident-await-module.js
index 6353ac2..ec6af34 100644
--- a/test/language/statements/class/class-name-ident-await-module.js
+++ b/test/language/statements/class/class-name-ident-await-module.js
@@ -8,7 +8,7 @@ description: >
 info: |
   12.1.1 Static Semantics: Early Errors
 
-  IdentifierReference : yield
+  IdentifierReference : await
 
   It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
 negative:
diff --git a/test/language/statements/class/class-name-ident-await.js b/test/language/statements/class/class-name-ident-await.js
index 5deb9af..0237382 100644
--- a/test/language/statements/class/class-name-ident-await.js
+++ b/test/language/statements/class/class-name-ident-await.js
@@ -8,7 +8,7 @@ description: >
 info: |
   12.1.1 Static Semantics: Early Errors
 
-  IdentifierReference : yield
+  IdentifierReference : await
 
   It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
 ---*/
diff --git a/test/language/statements/class/class-name-ident-let-escaped.js b/test/language/statements/class/class-name-ident-let-escaped.js
index b344a1a..eb54d47 100644
--- a/test/language/statements/class/class-name-ident-let-escaped.js
+++ b/test/language/statements/class/class-name-ident-let-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-let.js b/test/language/statements/class/class-name-ident-let.js
index 0e819dc..62da254 100644
--- a/test/language/statements/class/class-name-ident-let.js
+++ b/test/language/statements/class/class-name-ident-let.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-static-escaped.js b/test/language/statements/class/class-name-ident-static-escaped.js
index e1fc8cc..fe1e1e7 100644
--- a/test/language/statements/class/class-name-ident-static-escaped.js
+++ b/test/language/statements/class/class-name-ident-static-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-static.js b/test/language/statements/class/class-name-ident-static.js
index 4548996..43b7c9c 100644
--- a/test/language/statements/class/class-name-ident-static.js
+++ b/test/language/statements/class/class-name-ident-static.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-yield-escaped.js b/test/language/statements/class/class-name-ident-yield-escaped.js
index a94089b..e2992b5 100644
--- a/test/language/statements/class/class-name-ident-yield-escaped.js
+++ b/test/language/statements/class/class-name-ident-yield-escaped.js
@@ -13,6 +13,10 @@ info: |
   It is a Syntax Error if this phrase is contained in strict mode code and the
   StringValue of IdentifierName is: "implements", "interface", "let", "package",
   "private", "protected", "public", "static", or "yield".
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError
diff --git a/test/language/statements/class/class-name-ident-yield.js b/test/language/statements/class/class-name-ident-yield.js
index 6bbb9c0..6ef5165 100644
--- a/test/language/statements/class/class-name-ident-yield.js
+++ b/test/language/statements/class/class-name-ident-yield.js
@@ -11,6 +11,10 @@ info: |
   IdentifierReference : yield
 
   It is a Syntax Error if the code matched by this production is contained in strict mode code.
+
+  10.2.1 Strict Mode Code
+
+  All parts of a ClassDeclaration or a ClassExpression are strict mode code.
 negative:
   phase: parse
   type: SyntaxError

@rwaldron
Copy link
Contributor

rwaldron commented May 3, 2018

Thanks!

@rwaldron rwaldron merged commit 3b7a456 into tc39:master May 3, 2018
@anba anba deleted the compat-new branch June 25, 2020 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants