console javascript version

201 views
Skip to first unread message

Stefan Fruehwirth

unread,
Jul 17, 2011, 7:23:47 AM7/17/11
to Firebug
In Firebug 1.7.3 I can't use features of Javascript 1.7 like
generators. I found this posts: http://groups.google.com/group/firebug/browse_thread/thread/bb346574bf10e39d
and http://groups.google.com/group/firebug/browse_thread/thread/036e57d497208a24
where the same question has been asked, but nobody seems to be able to
answer to it. It is just a simple question: is Javascript 1.7+
supported or not - yes or no? And if yes, how do I tell the console to
use a specific version.

For example this code throws a "SyntaxError: missing ; before
statement":

function a(){yield "doh!";};

Thanks,
Stefan

pedz

unread,
Jul 17, 2011, 4:39:54 PM7/17/11
to fir...@googlegroups.com
My guess is "no".  But I think you are slightly asking the wrong question.  I bet firebug is just using the javascript of the browser.  So all of the backward compatible features are there.  It is only the yield and let keywords that need to be enabled.  Seems like there needs to be an option to do that.  I looked at the source and didn't find anything but I'm new to the source.

I did try sending over version=1.7 enabled script files hoping that might trigger FB into 1.7 mode but it did not.  I guess the mode is per file and the firebug console is its own separate "file" -- parsing instance probably.


Jan Honza Odvarko

unread,
Jul 18, 2011, 7:31:30 AM7/18/11
to Firebug
Expression executed within Firebug command line (e.g. available on the
Console panel) are evaluated within the current page (using eval()
API). So, it uses Firefox's default JavaScript version.

Follow this issue to get more info:
http://code.google.com/p/fbug/issues/detail?id=3358

The summary is that eval() doesn't allow to specify JS version, this
problem is reported here and I hope will be fixed in JSD2
https://bugzilla.mozilla.org/show_bug.cgi?id=591961

Honza

On Jul 17, 1:23 pm, Stefan Fruehwirth <stefan.fruehwi...@uni-graz.at>
wrote:
> In Firebug 1.7.3 I can't use features of Javascript 1.7 like
> generators. I found this posts:http://groups.google.com/group/firebug/browse_thread/thread/bb346574b...
> andhttp://groups.google.com/group/firebug/browse_thread/thread/036e57d49...

pedz

unread,
Jul 18, 2011, 9:32:20 PM7/18/11
to fir...@googlegroups.com
Suggestion:

I was having trouble using eval.  What I ended up doing is putting the javascript into a script tag and appending it to the head element.  In my case, it was a much nicer way of doing things.  In firebug's case, it may be kinda hacky because you would have to set some global with the result and then fetch the result plus there might be synchronizing problems.  But if you did something like that, you could append the version to the type attribute of the script tag.

pedz

Jan Honza Odvarko

unread,
Jul 19, 2011, 4:16:25 AM7/19/11
to Firebug
We did use this solution (appending a <script> tag into the current
page)
in the past, but it was very problematic solution. In fact, we tried
several
different approaches to implement the console/commandline.

In general, injecting anything (script or any other elements) into
every page is faulty.

According to all the experience we have - fixing the bug 591961 is the
best solution.
Or if anybody want to contribute to Firebug, issue 3358 suggests a
workaround.

Honza

Stefan Fruehwirth

unread,
Jul 20, 2011, 12:51:56 PM7/20/11
to Firebug

On 18 Jul., 13:31, Jan Honza Odvarko <odva...@gmail.com> wrote:
> Expression executed within Firebug command line (e.g. available on the
> Console panel) are evaluated within the current page (using eval()
> API). So, it uses Firefox's default JavaScript version.
>
> Follow this issue to get more info:http://code.google.com/p/fbug/issues/detail?id=3358
>
> The summary is that eval() doesn't allow to specify JS version, this
> problem is reported here and I hope will be fixed in JSD2https://bugzilla.mozilla.org/show_bug.cgi?id=591961

Thank you both for clarifying this! Now I know that there is no
"button" I completely missed. Can't work my way through this at the
moment but I guess it will change sometime in future releases.

SF
Reply all
Reply to author
Forward
0 new messages