Decompiler bug with CONCATN

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: jorendorff, Assigned: jorendorff)

Tracking

Other Branch
Points:
---

Firefox Tracking Flags

(status1.9.2 wanted)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(2 attachments)

(Assignee)

Description

7 years ago
js> function f() { return "" + 2 + (i + 1); }
js> f
function f() {return "" + 2 + i + 1;}

Note the subtle change in meaning there.
(Assignee)

Comment 1

7 years ago
hasenj, the contributor who originally reported this bug, spent days working with me to reduce it from a complex web application.

The initial bug was simply that the former code was mysteriously behaving like the latter. We suspected the interpreter, the tracer, and ultimately the parser before discovering in a marathon gdb session that the code being handed to the JS compiler was actually subtly different from the script on disk.

hasenj ultimately discovered that the application has module-loading code that takes functions, converts them to strings, and passes the strings back to Function by way of eval, or something.
(Assignee)

Comment 2

7 years ago
Created attachment 439109 [details] [diff] [review]
v1
Assignee: general → jorendorff
Attachment #439109 - Flags: review?(shaver)
Comment on attachment 439109 [details] [diff] [review]
v1

My bad, I bet. r=shaver
Attachment #439109 - Flags: review?(shaver) → review+
There's either a decompilation or extensions directory the test should go in, no?
Why do we care?  We always have to search for them that way (else memorize JS and ECMA version history), and people who want to re-use our test suite can filter out whatever they don't want.  This bug affects web content, so they might well want to include it.
(Assignee)

Comment 6

7 years ago
http://hg.mozilla.org/tracemonkey/rev/d9e5e022384f

Waldo, r=me to move the test wherever you want, if shaver's argument in comment 5 doesn't satisfy you.

The test is a little different from most decompiler tests in that it's directly testing behavior.
Whiteboard: fixed-in-tracemonkey
Asserting that we want to fix this compat bug in the next 3.6 update.
status1.9.2: --- → wanted

Comment 8

7 years ago
http://hg.mozilla.org/mozilla-central/rev/d9e5e022384f

Comment 9

7 years ago
(In reply to comment #8)
> http://hg.mozilla.org/mozilla-central/rev/d9e5e022384f

> +function f(x) { return 1 + "" + (x + 1); }
> +reportCompare("12", f(1), "");
> +var g = eval(String(f));
> +reportCompare("12", f(1), "");
Shouldn’t f(1) on the last line be g(1)?

Comment 10

7 years ago
(In reply to comment #9)
> Shouldn’t f(1) on the last line be g(1)?
Oops, never mind.  Now I see how the test works (the eval redefines the function f).
(Assignee)

Comment 11

7 years ago
fcp: You're right. peterv noticed this yesterday too, and I changed the test.

Comment 12

7 years ago
http://hg.mozilla.org/mozilla-central/rev/9a9694a03441
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Duplicate of this bug: 620567
Jason, we should probably fix this on 1.9.2...  This is breaking greasemonkey users there, at least, plus whatever web app you were looking at, right?
blocking1.9.2: --- → ?

Comment 15

7 years ago
We'd like to take this for 1.9.2.14.
blocking1.9.2: ? → ---

Comment 16

6 years ago
Created attachment 531312 [details]
Demonstrates some failures

The bug still exists.

I can confirm this error on both 3.6.17 and 4.0.1 (tarball from www.firefox.com) running on Ubuntu 10.04.

Comment 17

6 years ago
I must have kept open the wrong window, 4.0.1 is fine, only 3.6.17 is affected (and possibly previous versions).
You need to log in before you can comment on or make changes to this bug.