Bug 35282

Summary: Old catch-clause scoping bug still unfixed
Product: WebKit Reporter: Mark S. Miller <erights>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: erights
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.5   
URL: http://google-caja.googlecode.com/svn/trunk/doc/html/es5-talk/img25.html

Description Mark S. Miller 2010-02-22 20:28:08 PST
The old ES3 behavior

function foo(){this.x = 11;}
var x = 'bar';
try { throw foo; } catch(e) { e(); print(x); }
// prints 11

is still present, despite 1) violating ES5 semantics, and 2) fatally violates ES5-strict semantics, as much of the motivation of ES5-strict is static scoping. This catch bug prevents static scoping.
Comment 1 Mark S. Miller 2010-02-22 21:48:02 PST
Oops. Thanks to Brendan for the correction. I was thinking about the code example in a nested scope as follows, but I hadn't tested that way. Tested nested, it
works fine. Sorry for the misunderstanding.

(function(){
  function foo(){this.x = 11;}
  var x = 'bar';
  try { throw foo; } catch(e) { e(); print(x); }
})();
// prints bar