Bug 1204402 - Fix export-entries.js and module-environment.js to not fail when classes are disabled, r=jorendorff
authorEric Faust <efaustbmo@gmail.com>
Wed, 16 Sep 2015 13:03:00 -0700
changeset 295563 873abbd1dd2356e0f30153f80faaeaadeec7ac85
parent 295562 ac81086dc2671bbfe0ab0305b2cc158b762b5af8
child 295564 0ad965c3605d8dd330c2d7ed1b429e4f80e9fd78
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1204402
milestone43.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 1204402 - Fix export-entries.js and module-environment.js to not fail when classes are disabled, r=jorendorff
js/src/jit-test/tests/modules/export-entries.js
js/src/jit-test/tests/modules/module-environment.js
--- a/js/src/jit-test/tests/modules/export-entries.js
+++ b/js/src/jit-test/tests/modules/export-entries.js
@@ -1,8 +1,10 @@
+load(libdir + "class.js");
+
 // Test localExportEntries property
 
 function testArrayContents(actual, expected) {
     assertEq(actual.length, expected.length);
     for (var i = 0; i < actual.length; i++) {
         for (var property in expected[i]) {
             assertEq(actual[i][property], expected[i][property]);
         }
@@ -25,19 +27,21 @@ testLocalExportEntries(
 testLocalExportEntries(
     'export let x = 1;',
     [{exportName: 'x', moduleRequest: null, importName: null, localName: 'x'}]);
 
 testLocalExportEntries(
     'export const x = 1;',
     [{exportName: 'x', moduleRequest: null, importName: null, localName: 'x'}]);
 
-testLocalExportEntries(
-    'export class foo { constructor() {} };',
-    [{exportName: 'foo', moduleRequest: null, importName: null, localName: 'foo'}]);
+if (classesEnabled()) {
+    testLocalExportEntries(
+        'export class foo { constructor() {} };',
+        [{exportName: 'foo', moduleRequest: null, importName: null, localName: 'foo'}]);
+}
 
 testLocalExportEntries(
     'export default function f() {};',
     [{exportName: 'default', moduleRequest: null, importName: null, localName: 'f'}]);
 
 testLocalExportEntries(
     'export default function() {};',
     [{exportName: 'default', moduleRequest: null, importName: null, localName: '*default*'}]);
--- a/js/src/jit-test/tests/modules/module-environment.js
+++ b/js/src/jit-test/tests/modules/module-environment.js
@@ -1,8 +1,10 @@
+load(libdir + "class.js");
+
 // Test top-level module environment
 
 function testInitialEnvironment(source, expected) {
     print(source);
     let m = parseModule(source);
     let scope = m.initialEnvironment;
     let keys = Object.keys(scope);
     assertEq(keys.length, expected.length);
@@ -12,16 +14,19 @@ function testInitialEnvironment(source, 
 }
 
 testInitialEnvironment('', []);
 testInitialEnvironment('var x = 1;', ['x']);
 testInitialEnvironment('let x = 1;', ['x']);
 testInitialEnvironment("if (true) { let x = 1; }", []);
 testInitialEnvironment("if (true) { var x = 1; }", ['x']);
 testInitialEnvironment('function x() {}', ['x']);
-testInitialEnvironment("class x { constructor() {} }", ['x']);
 testInitialEnvironment('export var x = 1;', ['x']);
 testInitialEnvironment('export let x = 1;', ['x']);
-testInitialEnvironment('export default class x { constructor() {} };', ['x']);
 testInitialEnvironment('export default function x() {};', ['x']);
 testInitialEnvironment('export default 1;', ['*default*']);
-testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
 testInitialEnvironment('export default function() {};', ['*default*']);
+
+if (classesEnabled()) {
+    testInitialEnvironment("class x { constructor() {} }", ['x']);
+    testInitialEnvironment('export default class x { constructor() {} };', ['x']);
+    testInitialEnvironment('export default class { constructor() {} };', ['*default*']);
+}