Bug 559438 - Decompiler bug with JSOP_CONCATN. r=shaver.
authorJason Orendorff <jorendorff@mozilla.com>
Wed, 14 Apr 2010 17:26:44 -0500
changeset 40898 d9e5e022384fbc8c585fa6855110d00ab223c9c3
parent 40897 a9e269df21ade6fa7a29905fc0f9bb559297388f
child 40899 681b0067e61b4f964dfa871dee1747cd7f9e9ed1
push idunknown
push userunknown
push dateunknown
reviewersshaver
bugs559438
milestone1.9.3a5pre
Bug 559438 - Decompiler bug with JSOP_CONCATN. r=shaver.
js/src/jsopcode.cpp
js/src/tests/js1_8_5/regress/jstests.list
js/src/tests/js1_8_5/regress/regress-559438.js
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -3546,17 +3546,17 @@ Decompile(SprintStack *ss, jsbytecode *p
                 js::Vector<char *> argv(cx);
                 if (!argv.resize(argc))
                     return NULL;
 
                 MUST_FLOW_THROUGH("out");
                 ok = JS_FALSE;
 
                 for (i = argc - 1; i >= 0; i--) {
-                    argv[i] = JS_strdup(cx, POP_STR());
+                    argv[i] = JS_strdup(cx, POP_STR_PREC(cs->prec + 1));
                     if (!argv[i])
                         goto out;
                 }
 
                 todo = Sprint(&ss->sprinter, "%s", argv[0]);
                 if (todo < 0)
                     goto out;
                 for (i = 1; i < argc; i++) {
--- a/js/src/tests/js1_8_5/regress/jstests.list
+++ b/js/src/tests/js1_8_5/regress/jstests.list
@@ -5,8 +5,9 @@ script regress-541255-0.js
 script regress-541255-1.js
 script regress-541255-2.js
 script regress-541255-3.js
 script regress-541255-4.js
 script regress-541455.js
 script regress-546615.js
 script regress-555246-0.js
 fails script regress-555246-1.js
+script regress-559438.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/js1_8_5/regress/regress-559438.js
@@ -0,0 +1,10 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Jason Orendorff
+ */
+
+function f(x) { return 1 + "" + (x + 1); }
+reportCompare("12", f(1), "");
+var g = eval(String(f));
+reportCompare("12", f(1), "");