Catch Block Scope, Broken Different in IE9pr3

Discussion in 'Javascript' started by Garrett Smith, Jul 12, 2010.

  1. 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
    Garrett Smith, Jul 12, 2010
    #1
    1. Advertising

  2. Garrett Smith

    jdalton Guest

    Nice find.
    Did you report this bug?
    The IE dev team has been responsive to my bug reports... ;D
    jdalton, Jul 12, 2010
    #2
    1. Advertising

  3. 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, Jul 12, 2010
    #3
  4. 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
    Garrett Smith, Jul 12, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ann
    Replies:
    13
    Views:
    643
    Patricia Shanahan
    Sep 13, 2005
  2. morrell
    Replies:
    1
    Views:
    925
    roy axenov
    Oct 10, 2006
  3. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    628
  4. Cameron Simpson

    Re: Why are "broken iterators" broken?

    Cameron Simpson, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    556
    Cameron Simpson
    Sep 22, 2008
  5. Steve V
    Replies:
    6
    Views:
    229
    Steve V
    Apr 20, 2005
Loading...

Share This Page