Real World Func Decl in Block Scope Breakages

Brendan Eich brendan at mozilla.com
Wed Dec 26 23:01:05 PST 2012


Boris Zbarsky mailed that this is fixed in Firefox Nightly, Brandon was 
in on that email, but I just wanted to confirm that I was testing 
Firefox 17.0.1 and it swallowed the ReferenceError, but my fresh test in 
Firefox Nightly logs the ReferenceError as expected (alerts with the 
onerror mod I show below).

All's well that ends well, but I'd still like to be cc'ed on that bug.

/be

Brendan Eich wrote:
>
> Best to test other ways than consoles, they do odd things in some 
> browsers. But what you see is what I see when I load the content 
> wrapped in script tags from /tmp/foo.html as well:
>
> <script>
>     if (false) { function x(){ console.log('worked') } }
>     x()
> </script>
>
> So Firefox is eating the error just as the console is. Not so a 
> SpiderMonkey shell:
>
> js> if (false) { function x(){ console.log('worked') } } x()
> typein:1:53 ReferenceError: x is not defined
>
> Let's try onerror:
>
> <script>
>     this.onerror = function(s) { alert('onerror: ' + s); }
>     if (false) { function x(){ console.log('worked') } }
>     x()
> </script>
>
> Not sure what's up with the non-error, but the REPL shows a 
> ReferenceError as expected. Could you please file a bug cc'ing me, 
> dmandelin at mozilla.com, and :bz? Thanks. 


More information about the es-discuss mailing list