Bug 18735

Summary: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
Product: WebKit Reporter: Cameron Zwarich (cpst) <zwarich>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 18624    
Attachments:
Description Flags
Proposed patch
none
Revised proposed patch ggaren: review+

Cameron Zwarich (cpst)
Reported 2008-04-24 23:22:40 PDT
Consider the following example: --- var text = "PASS"; function a() { var text = "FAIL"; function b() { alert(this.text); } this.c = function() { b(); } b(); } (new a()).c(); --- This code should print PASS twice, but instead prints PASS once and then FAIL. This affects the JavaScriptCore test js1_5/Scope/scope-003.js.
Attachments
Proposed patch (1.67 KB, patch)
2008-04-24 23:28 PDT, Cameron Zwarich (cpst)
no flags
Revised proposed patch (1.72 KB, patch)
2008-04-24 23:32 PDT, Cameron Zwarich (cpst)
ggaren: review+
Cameron Zwarich (cpst)
Comment 1 2008-04-24 23:28:01 PDT
Created attachment 20812 [details] Proposed patch This patch fixes js1_5/Scope/scope-003.js, and it also fixes ecma/String/15.5.4.6-2.js.
Cameron Zwarich (cpst)
Comment 2 2008-04-24 23:32:06 PDT
Created attachment 20813 [details] Revised proposed patch The ecma/String/15.5.4.6-2.js fix doesn't seem legitimate, so I modified the ChangeLog to reflect this.
Cameron Zwarich (cpst)
Comment 3 2008-04-24 23:41:47 PDT
(In reply to comment #2) > Created an attachment (id=20813) [edit] > Revised proposed patch SunSpider shows no change for this patch.
Geoffrey Garen
Comment 4 2008-04-24 23:45:36 PDT
Comment on attachment 20813 [details] Revised proposed patch r=me
Geoffrey Garen
Comment 5 2008-04-24 23:48:19 PDT
Committed revision 32536.
Cameron Zwarich (cpst)
Comment 6 2008-04-24 23:50:29 PDT
Upon further review, this patch really did legitimately fix that test case after all.
Note You need to log in before you can comment on or make changes to this bug.