Closed Bug 719712 Opened 12 years ago Closed 11 years ago

Firefox is isn't returning my original function code

Categories

(Core :: JavaScript Engine, defect)

9 Branch
defect
Not set
trivial

Tracking

()

RESOLVED DUPLICATE of bug 761723

People

(Reporter: aeneasdardanus, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20111220165912

Steps to reproduce:

wrote a function 
and tried to return its source for display purposes 


Actual results:

unexpected strange thing happened! It returned a redacted, "censored", and to somebody else taste a "beautified" internal superficial version of my code. 


Expected results:

It should have returned the original source code, especially my comments. 
My /* comments */ are missing! 
And there are wrong unnecessary semicolon insertions.
Severity: normal → major
Priority: -- → P5
we need steps to reproduce`and a testcase.
Your report is like "I did something and something went wrong" and that is not enough for a useful bug report
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Priority: P5 → --
Resolution: --- → INCOMPLETE
Hello Matt
Thanks for your reply. 
This bug is not procedure dependent.

It is returning an internally edited/redacted; an incomplete superficial code, instead of the expected coders original/authentic source.


Anyway, here is a literal testcase example which I believe is sufficiently explanatory just by reading (since I'm not able to find a way editing one form this page):

The code:
----------------------------8<----------------------- 
function myEmpty(){/*This is an empty function object*/ };

console.log(myEmpty);
//alert(myEmpty);
---------------------------->8----------------------- 

THE RESULT:
-----------
LOG: function myEmpty() {}  //FX [current version]


THE EXPECTED RESULT:
------------------
LOG: function myEmpty(){/*This is an empty function object*/ } IE
LOG: function myEmpty(){/*This is an empty function object*/ } Ch
LOG: function myEmpty(){/*This is an empty function object*/ } Op
LOG: function myEmpty(){/*This is an empty function object*/ } Sa


Hope this helps a little.
Regards
Status: RESOLVED → UNCONFIRMED
Priority: -- → P5
Resolution: INCOMPLETE → ---
Severity: major → normal
Priority: P5 → --
Severity: normal → trivial
Is this DOM, JS or Error console ?
Component: Untriaged → DOM
Product: Firefox → Core
QA Contact: untriaged → general
Component: DOM → Developer Tools
Product: Core → Firefox
QA Contact: general → developer.tools
Actually, this is JS engine.  And a duplicate.  We don't store the original source; we end up serializing the bytecode.
Assignee: nobody → general
Component: Developer Tools → JavaScript Engine
Product: Firefox → Core
QA Contact: developer.tools → general
Whiteboard: DUPEME
ECMA-262 says:

> 15.3.4.2    Function.prototype.toString()
>
> An implementation-dependent representation of the function is returned. 
> This representation has the syntax of a FunctionDeclaration. Note in 
> particular that the use and placement of white space, line terminators, 
> and semicolons within the representation String is implementation-dependent.

So technically this is not a bug. But we are considering switching to storing the original source and returning that in the medium future.
Status: UNCONFIRMED → NEW
Ever confirmed: true
http://pokefarm.org/forum_thread?tid=96850 is another report about not saving the original, developer-provided source but rather decompiling from bytecode.
> But we are considering switching to
> storing the original source and returning that in the medium future.

Bug 718969 is the major part of this.
I would like to bump this up because its quite impossible to write code with annotations to be processed in runtime.

Hope this will be fixed as soon as possible.
I would like to report this [Bug 719712] as Resolved {(at least) since FX v.21.0 release}.
Yes, this has been fixed by removing the decompiler and storing function source code text instead.
Status: NEW → RESOLVED
Closed: 12 years ago11 years ago
OS: Windows 7 → All
Hardware: x86_64 → All
Resolution: --- → FIXED
Whiteboard: DUPEME
Resolution: FIXED → DUPLICATE
You need to log in before you can comment on or make changes to this bug.