Bug 1530084 - Add testcase for unimplemented fields not crashing. r=jorendorff
authorAshley Hauck <khyperia@mozilla.com>
Thu, 28 Feb 2019 17:33:44 +0000
changeset 519687 eb9d835ce817e2b30104a22cfe587436f9ed850d
parent 519686 cdd251b5b7f1f72af1a760b0a01f82cd7129d4b0
child 519688 f8e41c1ad7bab8f5586e6a910c08a114af8619a2
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1530084
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530084 - Add testcase for unimplemented fields not crashing. r=jorendorff Differential Revision: https://phabricator.services.mozilla.com/D21504
js/src/tests/non262/fields/unimplemented.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/non262/fields/unimplemented.js
@@ -0,0 +1,45 @@
+// Note: These tests should pass eventually (and this file deleted): this test
+// is just asserting that fields don't crash the engine, even if disabled.
+
+let source = `class C {
+    x
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    x = 0;
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    0 = 0;
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    [0] = 0;
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    "hi" = 0;
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    "hi" = 0;
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    d = function(){};
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+source = `class C {
+    d = class D { x = 0; };
+}`;
+assertThrowsInstanceOf(() => Function(source), SyntaxError);
+
+if (typeof reportCompare === "function")
+  reportCompare(true, true);