My favorites | Sign in
Project Home Wiki Issues
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 2244: Some JavaScript 1.7+ features do not work in Console panel
6 people starred this issue and may be notified of changes. Back to list
Reported by, Aug 18, 2009
It seems that there is some scoping issue and JS1.7 array comprehensions
are not correctly interpreted in the console. Try some of these inputs:

> [a for each (a in [0,1])]

I get 'ReferenceError: a is not defined'

> var a = null; [a for each (a in [0,1])]

returns [null,null,null]. Incorrect. The variable a in the comprehension
should be given let (local) scope.

> eval("[b for each (b in [0,1])]")

This works: [0,1]. But if the console input is eval'ed anyway, how does
eval(eval()) magically make it work? Is it a scoping issue? Or a problem
with js1.7 code?

This is happening in Firefox 3.5.2, Firebug 1.4.2, though I have seen it on
other combinations before as well.

Aug 18, 2009

> var a = null; [a for each (a in [0,1])]

returns [null,null], which makes a little more sense. The third element was a
different issue.
Aug 18, 2009
Project Member #2 this a bug or not?

Command line works by eval in the web page in side of a block.  That aspect is
slightly wrong but we don't fix it since we will completely re-write the console.
Status: NeedInfo
Aug 18, 2009
John, I think it is clear that this is a bug. It is not interpreting the array
comprehension correctly at all, and I don't know why that would be, given that it's
being eval'ed.

If you're going to be rewriting the console, I guess maybe it's not of immediate
concern. :/
Aug 19, 2009
Project Member #4
For the test case in comment 1, what would be the correct answer? [0,1]?
Labels: Type-Enhancement commandLine 1.4 Test-case-available
Aug 19, 2009
Indeed. [0,1] is the correct answer, and is what you get when you wrap it in an eval
or execute in a regular script rather than the console.
Aug 25, 2009
Project Member #6
(No comment was entered for this change.)
Status: Triaged
Oct 13, 2009
#7 brianpeiris
According to MDC[1][2] you need to change the `type` attribute of your
`<script></script>` tag in order to use some of the new features added in JavaScript
1.7 and 1.8.
It took some Googling but I found a blog post[3] about the issue and it seems (from
what I can understand from the translated Japanese) you have to modify Firebug to use
the appropriate version setting before you can use the new features in the console:
<     element.setAttribute("type", "text/javascript");
>     element.setAttribute("type", "application/javascript;version=1.8");

Of course, more general solution would probably allow the user to opt-in to newer
versions of JavaScript via a menu option or perhaps Firebug could scan a page's
existing `type` attributes for the highest/lowest version and use whatever is
appropriate in the console.

I think this issue applies to Firebug 1.5 as well.

Oct 13, 2009
Project Member #8
From one cryptic comment in an obscure file I guess that the current code should work
if the page itself uses js 1.8.

Based on your suggestion, we need a page with 1.8 code to test.
Labels: -Test-case-available Test-case-needed
Nov 14, 2011
I finally created a test case for this issue, which should be available soon at For the case the server sync takes too long I also attached the file here.
1.7 KB   View   Download
Labels: -Test-case-needed Test-case-in-suite
Nov 20, 2011
Not having access to the new javascript features drives me nuts.
Nov 20, 2011
This is duplicated by  Issue 3358 .
Nov 20, 2011
 Issue 3358  has been merged into this issue.
Nov 20, 2011
I generalized this issue, because not just array comprehensions are affected by this, but several other features like e.g. the 'let' statement and expression closures, too. See also  issue 3358 .
This seems to need platform support:

@Honza: Because we don't want the Console panel to activate JSD by default ( issue 4978 ), how can this be achieved?

Summary: Some JavaScript 1.7+ features do not work in Console panel
Labels: platform
Mar 23, 2013
Project Member #14
(No comment was entered for this change.)
Mar 23, 2013
Project Member #15
(No comment was entered for this change.)
Sign in to add a comment

Powered by Google Project Hosting