Closed Bug 805904 Opened 7 years ago Closed 5 years ago

Remove unnecessary javascript function names


(Firefox for Android :: General, defect)

Not set





(Reporter: kats, Unassigned)




(3 files)

As of FF 17, the JS engine can infer function names from "anonymous" functions, so we shouldn't need to duplicate them. i.e. instead of

name: function debug_name(arguments) {

we can just do

name: function(arguments) {

We could probably modify the JS parser to dump function lines and scripts where we name functions, but have sufficient name inference. And then put it on the try server.
I modified the NameFunctions code so it dumps out unnecessary names.
Attached file python data scaper
Running this very ugly python script, produces a list of all functions that could be simplified.
Attached file output
Running the script produces this output. This is only for code in chrome:// that is also hit by mochitests. Now we need start looking at renaming this stuff :)
The output is for desktop, right? Can we get one for Fennec as well?
(Specifically we have a different browser.js than desktop so the output here doesn't apply to Fennec's browser.js)
We can probably parse the result of this try push:
The try push above failed on non-debug builds, and the debug build for Android doesn't run any tests. I'm not sure why the Linux build log itself has the output (does the JS compiler frontend get run during the build process itself?) but the Android one sadly does not.

I tried taking your patch and applying it to my local build which worked fine, but then starting Fennec on a device didn't print out the name info like I thought it would.
Closed: 5 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.