Bug 1095439 - Make assignments to a const variable a syntax error. r=efaust
authorTom Schuster <evilpies@gmail.com>
Wed, 19 Nov 2014 01:44:02 +0100
changeset 216322 ef2967c20784
parent 216321 47faf7c36050
child 216323 8a1582c375c2
push id52018
push userevilpies@gmail.com
push dateWed, 19 Nov 2014 00:46:18 +0000
treeherdermozilla-inbound@14a34e921e1b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust
bugs1095439
milestone36.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 1095439 - Make assignments to a const variable a syntax error. r=efaust
js/src/frontend/BytecodeEmitter.cpp
js/src/jit-test/tests/asm.js/testGlobals.js
js/src/jit-test/tests/basic/bug673731.js
js/src/jit-test/tests/basic/bug821470.js
js/src/jit-test/tests/basic/constAssignError.js
js/src/jit-test/tests/basic/constGlobalAssignError.js
js/src/jit-test/tests/basic/testDynamicUsage.js
js/src/jit-test/tests/saved-stacks/gc-frame-cache.js
js/src/js.msg
js/src/tests/js1_5/Regress/regress-383674.js
js/src/tests/js1_5/extensions/regress-452565.js
js/src/tests/js1_6/extensions/regress-465443.js
js/src/tests/js1_7/extensions/regress-470176.js
js/src/tests/js1_8_1/extensions/regress-437288-01.js
js/src/tests/js1_8_1/regress/regress-452498-039.js
js/src/tests/js1_8_1/regress/regress-452498-074.js
js/src/tests/js1_8_1/regress/regress-452498-077.js
js/src/tests/js1_8_1/regress/regress-452498-110.js
js/src/tests/js1_8_1/regress/regress-452498-184.js
js/src/tests/js1_8_1/regress/regress-452498-187.js
js/src/tests/js1_8_5/extensions/compound-assign-const.js
js/src/tests/js1_8_5/regress/regress-383902.js
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1674,40 +1674,28 @@ BindNameToSlotHelper(ExclusiveContext *c
         MOZ_ASSERT(dn->isDefn());
         pn->pn_dflags |= (dn->pn_dflags & PND_CONST);
     } else if (pn->isDefn()) {
         dn = (Definition *) pn;
     } else {
         return true;
     }
 
-    /*
-     * Turn attempts to mutate const-declared bindings into get ops (for
-     * pre-increment and pre-decrement ops, our caller will have to emit
-     * JSOP_POS, JSOP_ONE, and JSOP_ADD as well).
-     *
-     * Turn JSOP_DELNAME into JSOP_FALSE if dn is known, as all declared
-     * bindings visible to the compiler are permanent in JS unless the
-     * declaration originates at top level in eval code.
-     */
+    // Throw an error on attempts to mutate const-declared bindings.
     switch (op) {
       case JSOP_NAME:
       case JSOP_SETCONST:
         break;
       default:
         if (pn->isConst()) {
-            if (bce->sc->needStrictChecks()) {
-                JSAutoByteString name;
-                if (!AtomToPrintableString(cx, pn->pn_atom, &name) ||
-                    !bce->reportStrictModeError(pn, JSMSG_READ_ONLY, name.ptr()))
-                {
-                    return false;
-                }
-            }
-            pn->setOp(op = JSOP_NAME);
+            JSAutoByteString name;
+            if (!AtomToPrintableString(cx, pn->pn_atom, &name))
+                return false;
+            bce->reportError(pn, JSMSG_BAD_CONST_ASSIGN, name.ptr());
+            return false;
         }
     }
 
     if (dn->pn_cookie.isFree()) {
         if (HandleScript caller = bce->evalCaller) {
             MOZ_ASSERT(bce->script->compileAndGo());
 
             /*
@@ -3312,20 +3300,16 @@ EmitDestructuringLHS(ExclusiveContext *c
         MOZ_ASSERT(pn->getOp() == JSOP_SETLOCAL || pn->getOp() == JSOP_INITLEXICAL);
         MOZ_ASSERT(pn->pn_dflags & PND_BOUND);
     } else {
         switch (pn->getKind()) {
           case PNK_NAME:
             if (!BindNameToSlot(cx, bce, pn))
                 return false;
 
-            // Allow 'const [x,y] = o', make 'const x,y; [x,y] = o' a nop.
-            if (pn->isConst() && !pn->isDefn())
-                return Emit1(cx, bce, JSOP_POP) >= 0;
-
             switch (pn->getOp()) {
               case JSOP_SETNAME:
               case JSOP_SETGNAME:
               case JSOP_SETCONST: {
                 // This is like ordinary assignment, but with one difference.
                 //
                 // In `a = b`, we first determine a binding for `a` (using
                 // JSOP_BINDNAME or JSOP_BINDGNAME), then we evaluate `b`, then
@@ -4081,23 +4065,16 @@ EmitAssignment(ExclusiveContext *cx, Byt
         }
         if (Emit1(cx, bce, op) < 0)
             return false;
     }
 
     /* Finally, emit the specialized assignment bytecode. */
     switch (lhs->getKind()) {
       case PNK_NAME:
-        if (lhs->isConst()) {
-            if (!rhs) {
-                bce->reportError(lhs, JSMSG_BAD_FOR_LEFTSIDE);
-                return false;
-            }
-            break;
-        }
         if (lhs->isOp(JSOP_SETARG) || lhs->isOp(JSOP_SETLOCAL) || lhs->isOp(JSOP_SETALIASEDVAR)) {
             if (!EmitVarOp(cx, lhs, lhs->getOp(), bce))
                 return false;
         } else {
             if (!EmitIndexOp(cx, lhs->getOp(), atomIndex, bce))
                 return false;
         }
         break;
--- a/js/src/jit-test/tests/asm.js/testGlobals.js
+++ b/js/src/jit-test/tests/asm.js/testGlobals.js
@@ -8,25 +8,19 @@ assertEq(asmLink(asmCompile(USE_ASM + "v
 assertEq(asmLink(asmCompile(USE_ASM + "const i=42; function f(){ return i|0 } return f"))(), 42);
 assertEq(asmLink(asmCompile(USE_ASM + "var i=4.2; function f(){ return +i } return f"))(), 4.2);
 assertEq(asmLink(asmCompile(USE_ASM + "const i=4.2; function f(){ return +i } return f"))(), 4.2);
 assertAsmTypeFail(USE_ASM + "var i=42; function f(){ return +(i+.1) } return f");
 assertAsmTypeFail(USE_ASM + "const i=42; function f(){ return +(i+.1) } return f");
 assertAsmTypeFail(USE_ASM + "var i=1.2; function f(){ return i|0 } return f");
 assertAsmTypeFail(USE_ASM + "const i=1.2; function f(){ return i|0 } return f");
 assertAsmTypeFail(USE_ASM + "var i=0; function f(e){ e=+e; i=e } return f");
-assertAsmTypeFail(USE_ASM + "const i=0; function f(e){ e=+e; i=e } return f");
 assertAsmTypeFail(USE_ASM + "var d=0.1; function f(i){ i=i|0; d=i } return f");
-assertAsmTypeFail(USE_ASM + "const d=0.1; function f(i){ i=i|0; d=i } return f");
 assertEq(asmLink(asmCompile(USE_ASM + "var i=13; function f(j) { j=j|0; i=j; return i|0 } return f"))(42), 42);
-assertAsmTypeFail(USE_ASM + "const i=13; function f(j) { j=j|0; i=j; return i|0 } return f");
-assertAsmTypeFail(USE_ASM + "const c=0,i=13; function f(j) { j=j|0; i=j; return i|0 } return f");
 assertEq(asmLink(asmCompile(USE_ASM + "var d=.1; function f(e) { e=+e; d=e; return +e } return f"))(42.1), 42.1);
-assertAsmTypeFail(USE_ASM + "const d=.1; function f(e) { e=+e; d=e; return +e } return f");
-assertAsmTypeFail(USE_ASM + "const c=0, d=.1; function f(e) { e=+e; d=e; return +e } return f");
 assertEq(asmLink(asmCompile(USE_ASM + "var i=13; function f(i, j) { i=i|0; j=j|0; i=j; return i|0 } return f"))(42,43), 43);
 assertEq(asmLink(asmCompile(USE_ASM + "var i=13; function f(j) { j=j|0; var i=0; i=j; return i|0 } return f"))(42), 42);
 
 var f = asmLink(asmCompile(USE_ASM + "var i=13; function f(j) { j=j|0; if ((j|0) != -1) { i=j } else { return i|0 } return 0 } return f"));
 assertEq(f(-1), 13);
 assertEq(f(42), 0);
 assertEq(f(-1), 42);
 
@@ -56,17 +50,16 @@ assertAsmTypeFail('global', USE_ASM + "v
 assertAsmTypeFail('global', USE_ASM + "const i=global; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "var i=global|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "const i=global|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "var j=0;var i=j.i|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "var i=global.i|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "const i=global.i|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + "var i=global.i|0; function f() { return i|0 } return f");
 assertAsmTypeFail('global', USE_ASM + 'var i=global.Infinity; function f() { i = 0.0 } return f');
-assertAsmTypeFail('global', USE_ASM + 'const i=global.Infinity; function f() { i = 0.0 } return f');
 assertAsmLinkAlwaysFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), undefined);
 assertAsmLinkAlwaysFail(asmCompile('global', USE_ASM + 'const i=global.Infinity; function f() { return +i } return f'), undefined);
 assertAsmLinkAlwaysFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), null);
 assertAsmLinkAlwaysFail(asmCompile('global', USE_ASM + 'const i=global.Infinity; function f() { return +i } return f'), null);
 assertAsmLinkFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), 3);
 assertAsmLinkFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), {});
 assertAsmLinkFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), {Infinity:NaN});
 assertAsmLinkFail(asmCompile('global', USE_ASM + 'var i=global.Infinity; function f() { return +i } return f'), {Infinity:-Infinity});
--- a/js/src/jit-test/tests/basic/bug673731.js
+++ b/js/src/jit-test/tests/basic/bug673731.js
@@ -1,3 +1,3 @@
 // |jit-test| error: ReferenceError
 
-const IS_TOKEN_ARRAY = [ printBugNumber && IS_TOKEN_ARRAY++ && this() ? this() : this() ];
+const IS_TOKEN_ARRAY = [ printBugNumber && this() ? this() : this() ];
--- a/js/src/jit-test/tests/basic/bug821470.js
+++ b/js/src/jit-test/tests/basic/bug821470.js
@@ -1,8 +1,8 @@
 load(libdir + "asserts.js");
 
 assertThrowsInstanceOf(function () {
     eval("function x() { 'use strict'; const x = 4; x = 3; }");
-}, TypeError);
+}, SyntaxError);
 assertThrowsInstanceOf(function () {
     Function("'use strict'; const x = x = 5;");
-}, TypeError)
+}, SyntaxError)
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/constAssignError.js
@@ -0,0 +1,23 @@
+// Can't assign to const
+
+load(libdir + 'asserts.js');
+
+function assertSyntaxError(str) {
+  assertThrowsInstanceOf(function () { eval(str); }, SyntaxError);
+}
+
+assertSyntaxError("(function() { const x = 3; (function() x++)(); return x })");
+assertSyntaxError("(function() { const x = 3; (function() x++)(); return x++ })");
+assertSyntaxError("(function() { const x = 2; (function() x++)(); return ++x })");
+assertSyntaxError("(function() { const x = 2; (function() x++)(); return x += 1 })");
+
+assertSyntaxError("(function() { const x = 3; x = 1; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; x = 1; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; x++; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; ++x; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; x--; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; --x; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; x += 1; return (function() { return x})() })");
+assertSyntaxError("(function() { const x = 3; x -= 1; return (function() { return x})() })");
+
+assertSyntaxError("(function() { const x = 3; [x] = [1]; })");
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/constGlobalAssignError.js
@@ -0,0 +1,3 @@
+// |jit-test| error: SyntaxError
+
+const x = 1; x = 2;
--- a/js/src/jit-test/tests/basic/testDynamicUsage.js
+++ b/js/src/jit-test/tests/basic/testDynamicUsage.js
@@ -3,30 +3,16 @@ assertEq((function() { var g = function(
 assertEq((function() { var x; x = 3; return (function() { return x } )() })(), 3);
 assertEq((function() { x = 3; var x; return (function() { return x } )() })(), 3);
 assertEq((function() { var x; var g = function() { return x }; x = 3; return g() })(), 3);
 
 assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return (function() f())() })(), 3);
 assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return eval('f()') })(), 3);
 assertEq((function() { function f() { return 3 }; (function() f())(); return f() })(), 3);
 
-assertEq((function() { const x = 3; (function() x++)(); return x })(), 3);
-assertEq((function() { const x = 3; (function() x++)(); return x++ })(), 3);
-assertEq((function() { const x = 2; (function() x++)(); return ++x })(), 3);
-assertEq((function() { const x = 2; (function() x++)(); return x += 1 })(), 3);
-
-assertEq((function() { const x = 3; x = 1; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; x = 1; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; x++; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; ++x; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; x--; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; --x; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; x += 1; return (function() { return x})() })(), 3);
-assertEq((function() { const x = 3; x -= 1; return (function() { return x})() })(), 3);
-
 assertEq((function() { var x = 3; return eval("x") })(), 3);
 assertEq((function() { var x; x = 3; return eval("x") })(), 3);
 assertEq((function() { x = 3; var x; return eval("x") })(), 3);
 
 assertEq((function() { var x; (function() {x = 2})(); return ++x })(), 3);
 assertEq((function() { var x; (function() {x = 2})(); x++; return x })(), 3);
 assertEq((function() { var x; (function() {x = 4})(); return --x })(), 3);
 assertEq((function() { var x; (function() {x = 4})(); x--; return x })(), 3);
--- a/js/src/jit-test/tests/saved-stacks/gc-frame-cache.js
+++ b/js/src/jit-test/tests/saved-stacks/gc-frame-cache.js
@@ -4,17 +4,17 @@
 const FUZZ_FACTOR = 3;
 
 function assertAboutEq(actual, expected) {
   if (Math.abs(actual - expected) > FUZZ_FACTOR)
     throw new Error("Assertion failed: expected about " + expected + ", got " + actual +
                     ". FUZZ_FACTOR = " + FUZZ_FACTOR);
 }
 
-const stacks = [];
+var stacks = [];
 
 stacks.push(saveStack());
 stacks.push(saveStack());
 stacks.push(saveStack());
 stacks.push(saveStack());
 stacks.push(saveStack());
 stacks.push(saveStack());
 stacks.push(saveStack());
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -176,16 +176,17 @@ MSG_DEF(JSMSG_ACCESSOR_WRONG_ARGS,     3
 MSG_DEF(JSMSG_ARGUMENTS_AND_REST,      0, JSEXN_SYNTAXERR, "'arguments' object may not be used in conjunction with a rest parameter")
 MSG_DEF(JSMSG_ARRAY_COMP_LEFTSIDE,     0, JSEXN_SYNTAXERR, "invalid array comprehension left-hand side")
 MSG_DEF(JSMSG_ARRAY_INIT_TOO_BIG,      0, JSEXN_INTERNALERR, "array initialiser too large")
 MSG_DEF(JSMSG_AS_AFTER_RESERVED_WORD,  1, JSEXN_SYNTAXERR, "missing keyword 'as' after reserved word '{0}'")
 MSG_DEF(JSMSG_BAD_ANON_GENERATOR_RETURN, 0, JSEXN_TYPEERR, "anonymous generator function returns a value")
 MSG_DEF(JSMSG_BAD_ARROW_ARGS,          0, JSEXN_SYNTAXERR, "invalid arrow-function arguments (parentheses around the arrow-function may help)")
 MSG_DEF(JSMSG_BAD_BINDING,             1, JSEXN_SYNTAXERR, "redefining {0} is deprecated")
 MSG_DEF(JSMSG_BAD_CONST_DECL,          0, JSEXN_SYNTAXERR, "missing = in const declaration")
+MSG_DEF(JSMSG_BAD_CONST_ASSIGN,        1, JSEXN_SYNTAXERR, "invalid assignment to const {0}")
 MSG_DEF(JSMSG_BAD_CONTINUE,            0, JSEXN_SYNTAXERR, "continue must be inside loop")
 MSG_DEF(JSMSG_BAD_DESTRUCT_ASS,        0, JSEXN_REFERENCEERR, "invalid destructuring assignment operator")
 MSG_DEF(JSMSG_BAD_DESTRUCT_TARGET,     0, JSEXN_SYNTAXERR, "invalid destructuring target")
 MSG_DEF(JSMSG_BAD_DESTRUCT_DECL,       0, JSEXN_SYNTAXERR, "missing = in destructuring declaration")
 MSG_DEF(JSMSG_BAD_DUP_ARGS,            0, JSEXN_SYNTAXERR, "duplicate argument names not allowed in this context")
 MSG_DEF(JSMSG_BAD_FOR_EACH_LOOP,       0, JSEXN_SYNTAXERR, "invalid for each loop")
 MSG_DEF(JSMSG_BAD_FOR_LEFTSIDE,        0, JSEXN_SYNTAXERR, "invalid for/in left-hand side")
 MSG_DEF(JSMSG_BAD_GENERATOR_RETURN,    1, JSEXN_TYPEERR, "generator function {0} returns a value")
--- a/js/src/tests/js1_5/Regress/regress-383674.js
+++ b/js/src/tests/js1_5/Regress/regress-383674.js
@@ -14,42 +14,42 @@ var expect = '';
 test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
-    
+
   options("strict");
   options("werror");
 
   expect = 'toString called';
   actual = 'toString not called';
   try
   {
-    var x = {toString: function() { 
-        actual = 'toString called'; 
-        print(actual); 
-      } 
-    }; 
+    var x = {toString: function() {
+        actual = 'toString called';
+        print(actual);
+      }
+    };
     var f = function() { var j = x; j + ""; }
     f();
     reportCompare(expect, actual, summary + ': 1');
   }
   catch(ex)
   {
     reportCompare("No Error", ex + "", summary + ': 1');
   }
 
   actual = 'toString not called';
   try
   {
-    (function() { const a = 
+    (function() { var a =
          ({toString: function(){
              actual = 'toString called'; print(actual)} }); a += ""; })();
     reportCompare(expect, actual, summary + ': 2');
   }
   catch(ex)
   {
     reportCompare("No Error", ex + "", summary + ': 2');
   }
--- a/js/src/tests/js1_5/extensions/regress-452565.js
+++ b/js/src/tests/js1_5/extensions/regress-452565.js
@@ -9,13 +9,13 @@ var summary = 'Do not assert with JIT: !
 var actual = 'No Crash';
 var expect = 'No Crash';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 jit(true);
 
-const c = undefined; (function() { for (var j=0;j<5;++j) { c = 1; } })();
+var c = undefined; (function() { for (var j=0;j<5;++j) { c = 1; } })();
 
 jit(false);
 
 reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_6/extensions/regress-465443.js
+++ b/js/src/tests/js1_6/extensions/regress-465443.js
@@ -14,18 +14,18 @@ var expect = '';
 test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
- 
-  expect = 'SyntaxError: invalid for/in left-hand side';
+
+  expect = 'SyntaxError: invalid assignment to const b';
 
   jit(true);
 
   try
   {
     eval('(function () { const b = 16; var out = []; for each (b in [true, "", true, "", true, ""]) out.push(b >> 1) })();');
   }
   catch(ex)
deleted file mode 100644
--- a/js/src/tests/js1_7/extensions/regress-470176.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 470176;
-var summary = 'let-fun should not be able to modify constants';
-var actual = '';
-var expect = '';
-
-
-//-----------------------------------------------------------------------------
-test();
-//-----------------------------------------------------------------------------
-
-function test()
-{
-  enterFunc ('test');
-  printBugNumber(BUGNUMBER);
-  printStatus (summary);
- 
-  const e = 8; 
-
-  expect = e;
-
-  jit (true);
-
-  let (f = function() { for (var h=0;h<6;++h) ++e; }) { f(); }
-
-  actual = e;
-
-  jit(false);
-
-  reportCompare(expect, actual, summary);
-
-  exitFunc ('test');
-}
--- a/js/src/tests/js1_8_1/extensions/regress-437288-01.js
+++ b/js/src/tests/js1_8_1/extensions/regress-437288-01.js
@@ -15,17 +15,17 @@ test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
-  expect = 'SyntaxError: invalid for/in left-hand side';
+  expect = 'SyntaxError: invalid assignment to const x';
   try
   {
     eval('(function() { const x = 1; for (x in null); })();');
   }
   catch(ex)
   {
     actual = ex + '';
   }
deleted file mode 100644
--- a/js/src/tests/js1_8_1/regress/regress-452498-039.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 452498;
-var summary = 'TM: upvar2 regression tests';
-var actual = '';
-var expect = '';
-
-
-//-----------------------------------------------------------------------------
-test();
-//-----------------------------------------------------------------------------
-
-function test()
-{
-  enterFunc ('test');
-  printBugNumber(BUGNUMBER);
-  printStatus (summary);
-
-  expect = '10';
-
-// ------- Comment #39 From Jesse Ruderman
-
-  const e = 0;
-  print(actual = ++e);
-
-  actual = String(actual) + e;
-
-  reportCompare(expect, actual, summary);
-
-  exitFunc ('test');
-}
--- a/js/src/tests/js1_8_1/regress/regress-452498-074.js
+++ b/js/src/tests/js1_8_1/regress/regress-452498-074.js
@@ -19,16 +19,16 @@ function test()
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
   expect = '1';
 
 // ------- Comment #74 From Jesse Ruderman
 
-  const [d] = [1]; [d] = [2]; print(actual = d);
+  const [d] = [1]; print(actual = d);
 
   actual = String(actual);
 
   reportCompare(expect, actual, summary);
 
   exitFunc ('test');
 }
deleted file mode 100644
--- a/js/src/tests/js1_8_1/regress/regress-452498-077.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 452498;
-var summary = 'TM: upvar2 regression tests';
-var actual = '';
-var expect = '';
-
-
-//-----------------------------------------------------------------------------
-test();
-//-----------------------------------------------------------------------------
-
-function test()
-{
-  enterFunc ('test');
-  printBugNumber(BUGNUMBER);
-  printStatus (summary);
-
-  expect = '1';
-
-// ------- Comment #77 From Brendan Eich
-
-  (function () { const [d] = [1]; [d] = [2]; print(actual = d);})();
-
-  actual = String(actual);
-
-  reportCompare(expect, actual, summary);
-
-  exitFunc ('test');
-}
deleted file mode 100644
--- a/js/src/tests/js1_8_1/regress/regress-452498-110.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 452498;
-var summary = 'TM: upvar2 regression tests';
-var actual = '';
-var expect = '';
-
-
-//-----------------------------------------------------------------------------
-test();
-//-----------------------------------------------------------------------------
-
-function test()
-{
-  enterFunc ('test');
-  printBugNumber(BUGNUMBER);
-  printStatus (summary);
-
-// ------- Comment #110 From Brendan Eich
-
-// (In reply to comment #107)
-
-  function f(a) { const b = a; print(++b); return b; }
-
-  expect = 'function f(a) { const b = a; print(++b); return b; }';
-  actual = f + '';
-  compareSource(expect, actual, 'function f(a) { const b = a; print(++b); return b; }');
-
-  expect = '01';
-  actual = 0;
-
-  function g(a) { const b = a; print(actual = ++b); return b; }
-  actual = String(actual) + g(1);
-  reportCompare(expect, actual, 'function g(a) { const b = a; print(actual = ++b); return b; }');
-
-  expect = '21';
-  actual = 0;
-
-  const x = 1; print(actual = ++x);
-  actual = String(actual) + x;
-
-  reportCompare(expect, actual, 'const x = 1; print(actual = ++x); ');
-
-  exitFunc ('test');
-}
deleted file mode 100644
--- a/js/src/tests/js1_8_1/regress/regress-452498-184.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 452498;
-var summary = 'TM: upvar2 regression tests';
-var actual = '';
-var expect = '';
-
-//-------  Comment #184  From  Jesse Ruderman
-
-//-----------------------------------------------------------------------------
-test();
-//-----------------------------------------------------------------------------
-
-function test()
-{
-  enterFunc ('test');
-  printBugNumber(BUGNUMBER);
-  printStatus (summary);
-
-  expect = '11';
-
-  const e = 8; print(actual = '' + ((e += 3)));
-
-  reportCompare(expect, actual, summary);
-
-  exitFunc ('test');
-}
--- a/js/src/tests/js1_8_1/regress/regress-452498-187.js
+++ b/js/src/tests/js1_8_1/regress/regress-452498-187.js
@@ -16,17 +16,17 @@ test();
 //-----------------------------------------------------------------------------
 
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
-  expect = 'SyntaxError: invalid for/in left-hand side';
+  expect = 'SyntaxError: invalid assignment to const x';
   try
   {
     eval('const x = undefined; for (x in []);');
   }
   catch(ex)
   {
     actual = ex + '';
   }
deleted file mode 100644
--- a/js/src/tests/js1_8_5/extensions/compound-assign-const.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Any copyright is dedicated to the Public Domain.
-// http://creativecommons.org/licenses/publicdomain/
-
-//-----------------------------------------------------------------------------
-var BUGNUMBER = 730810;
-var summary = "Don't assert on compound assignment to a const";
-
-print(BUGNUMBER + ": " + summary);
-
-/**************
- * BEGIN TEST *
- **************/
-
-const x = 3;
-x += 2;
-assertEq(x, 3);
-
-/******************************************************************************/
-
-if (typeof reportCompare === "function")
-  reportCompare(true, true);
-
-print("Tests complete!");
--- a/js/src/tests/js1_8_5/regress/regress-383902.js
+++ b/js/src/tests/js1_8_5/regress/regress-383902.js
@@ -21,23 +21,23 @@ function f(a) {
 var w = 42;
 f(w);
 
 c = 2;
 try {
   eval('"use strict"; function g(x) { const y = x; y = 1 + x; } c = 3');
   assertEq(0, 1);
 } catch (e) {
-  assertEq(e.name, 'TypeError');
+  assertEq(e.name, 'SyntaxError');
   assertEq(2, c);
 }
 
 c = 4;
 try {
   eval('"use strict"; const z = w; z = 1 + w; c = 5');
   assertEq(0, 1);
 } catch (e) {
-  assertEq(e.name, 'TypeError');
+  assertEq(e.name, 'SyntaxError');
   assertEq(4, c);
   assertEq('z' in this, false);
 }
 
 reportCompare(0, 0, "ok");