Bug 97526

Summary: Bug in numeric accessors on global environment
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix ggaren: review+

Description Gavin Barraclough 2012-09-24 22:53:10 PDT
I've hit this assert in test262 in browser, but haven't yet worked out how to repro in a test case :-/
The sparsemap is failing to map back from the global object to the window shell.
A test case would need to resolve a numeric property name against the global environment.
Comment 1 Gavin Barraclough 2012-09-24 22:55:25 PDT
Created attachment 165526 [details]
Fix
Comment 2 Geoffrey Garen 2012-09-24 23:03:07 PDT
To do an assignment directly to the global object, you need to do it lexically, and not using "this" or "window". Perhaps calling bare __defineSetter__() and __defineGetter__() with a numeric property will do it.
Comment 3 Geoffrey Garen 2012-09-24 23:03:37 PDT
Comment on attachment 165526 [details]
Fix

r=me
Comment 4 Gavin Barraclough 2012-09-24 23:10:59 PDT
(In reply to comment #2)
> To do an assignment directly to the global object, you need to do it lexically, and not using "this" or "window". Perhaps calling bare __defineSetter__() and __defineGetter__() with a numeric property will do it.

Sadly __defineSetter__/__defineGetter__ will replace the current getter/setter, rather than calling it. :-/

I need something equivalent to
    window[0] = foo;
i.e. something that will do a [[Put]] rather than a [[DefineOwnProperty]], but where the base is the global environment.  Still haven't worked out how to do this for a numeric name.
Comment 5 Gavin Barraclough 2012-09-24 23:38:13 PDT
Fixed in r129458