Bug 84804

Summary: Closure in try {} with catch captures all locals from the enclosing function
Product: WebKit Reporter: Michael Saboff <msaboff>
Component: JavaScriptCoreAssignee: Michael Saboff <msaboff>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed Patch oliver: review+

Michael Saboff
Reported 2012-04-24 17:02:16 PDT
Consider the function: function addActivationWithTry() { try { var someArgs = 'firstArg|secondArg|third', args = someArgs.split('|'), varNotUsedInClosure = 'This is some string', anotherNonClosureVar = [ 'A', 'B', 'C', 'D' ], lastNonClosureVar = { prop1: 22, prop2: 'Yo', prop3: someArgs + '|fourth' } pushFunction(function() { makeCall(args[0], args[1], args[2]); }); } catch (err) { } } When the activation for the closure used as an argument for "pushFunction()" is created and torn off, all of the locals from "addActivationWithTry()" will be captured even though only the array "args" needs to be captured.
Attachments
Proposed Patch (4.88 KB, patch)
2012-04-24 17:34 PDT, Michael Saboff
oliver: review+
Michael Saboff
Comment 1 2012-04-24 17:34:59 PDT
Created attachment 138701 [details] Proposed Patch
WebKit Review Bot
Comment 2 2012-04-24 17:36:17 PDT
Attachment 138701 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1 Source/JavaScriptCore/runtime/JSActivation.h:95: Please declare integral type bitfields with either signed or unsigned. [runtime/bitfields] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Michael Saboff
Comment 3 2012-04-25 09:12:04 PDT
Note You need to log in before you can comment on or make changes to this bug.