Bug 35282
Summary: | Old catch-clause scoping bug still unfixed | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mark S. Miller <erights> |
Component: | JavaScriptCore | Assignee: | 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 |
Mark S. Miller
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark S. Miller
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