Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Catch Block Scope, Broken Different in IE9pr3 (http://www.velocityreviews.com/forums/t941664-catch-block-scope-broken-different-in-ie9pr3.html)

Garrett Smith 07-12-2010 06:21 AM

Catch Block Scope, Broken Different in IE9pr3
 
In ECMAScript, a catch block augments the current scope chain by pushing
a new Object to the front of the scope chain.

However, official versions of JScript up to and including JScript 5.8
don't do that. Instead, when entering a catch block, these versions of
JScript add the catch block's parameter to the containing scope.

This was fixed in IE9's JScript engine, "JScript 0.9", using, however, I
have noticed that functions defined in the catch block don't get the
catch block's scope that they're defined in.

This is shown in the example below. When augmented is called, `ex` can't
be accessed.

<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test catch scope</title>
</head>
<body>
<script type="text/javascript">
try {
var ex = 12;
x; // throw a ReferenceError
} catch(ex) {
alert(ex.name);
var augmented = function() {
alert(ex);
};
augmented();
}
</script>
</body>
</html>

IE9 Results: "ReferenceError", "12".

Function `augmented` isn't getting the scope chain from the catch block.

Garrett

jdalton 07-12-2010 06:33 AM

Re: Catch Block Scope, Broken Different in IE9pr3
 
Nice find.
Did you report this bug?
The IE dev team has been responsive to my bug reports... ;D

Garrett Smith 07-12-2010 06:58 AM

Re: Catch Block Scope, Broken Different in IE9pr3
 
On 2010-07-11 11:33 PM, jdalton wrote:
> Nice find.
> Did you report this bug?
> The IE dev team has been responsive to my bug reports... ;D


Nope. Been busy. For example, today, my cat peed and pooped on my bed.
What a nice boy.

BTW where do you report IE bugs these days? connect.microsoft.com?

--
Garrett

Garrett Smith 07-12-2010 05:24 PM

Re: Catch Block Scope, Broken Different in IE9pr3
 
On 2010-07-12 09:43 AM, kangax wrote:
> On 7/12/10 2:58 AM, Garrett Smith wrote:
>> On 2010-07-11 11:33 PM, jdalton wrote:
>>> Nice find.
>>> Did you report this bug?
>>> The IE dev team has been responsive to my bug reports... ;D

>>
>> Nope. Been busy. For example, today, my cat peed and pooped on my bed.
>> What a nice boy.
>>
>> BTW where do you report IE bugs these days? connect.microsoft.com?
>>

>
> https://connect.microsoft.com/IE/Feedback
>
> (need to be signed in)
>


And complete a survey.

"Internet Explorer Feedback Participant Survey"

How about I answer every question with please fix your site?

If I had time.
--
Garrett


All times are GMT. The time now is 08:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.