- From: Brendan Eich <brendan@mozilla.org>
- Date: Fri, 10 Aug 2012 06:59:42 -0700
- To: Odin Hørthe Omdal <odinho@opera.com>
- CC: public-webapps@w3.org, Allen Wirfs-Brock <allen@mozilla.com>
Odin Hørthe Omdal wrote: > On Thu, 09 Aug 2012 19:22:48 +0200, Boris Zbarsky <bzbarsky@mit.edu> > wrote: >> On 8/9/12 9:10 AM, Odin Hørthe Omdal wrote: >>> We will get this specific IDB problem too >> Will you? In my testing, Opera seemed to put Window properties >> directly on the global, not on the global's prototype, unlike other >> DOM objects... > > Oh yeah, you're totally correct. Sorry for breaking the 'tubes :-( > > Since everything else is directly on the global I guess it's not > really easy for us to do the right thing. At least not only for > IndexedDB, and _at least_ not when the incentive actually goes the > other way around. If Carakan follows ES5.1, the incentive is no longer perverse. From my testing of Opera 12.01, though, it seems you've not caught up to ES5.1 from ES5: <script> this.__proto__.foo = 42; // var foo; alert(foo); </script> The alert shows 42, but uncommenting the var causes the alert to show undefined. ES5.1 says in 10.5 step 8: 8. For each VariableDeclaration and VariableDeclarationNoIn d in code, in source text order do a. Let dn be the Identifier in d. b. Let varAlreadyDeclared be the result of calling env’s HasBinding concrete method passing dn as the argument. c. If varAlreadyDeclared is false, then i. Call env’s CreateMutableBinding concrete method passing dn and configurableBindings as the arguments. ii. Call env’s SetMutableBinding concrete method passing dn, undefined, and strict as the arguments. The concrete HasBinding method of object environment records (such as the global object's env. rec) is 10.2.1.2.1: 10.2.1.2.1 HasBinding(N) The concrete Environment Record method HasBinding for object environment records determines if its associated binding object has a property whose name is the value of the argument N: 1. Let envRec be the object environment record for which the method was invoked. 2. Let bindings be the binding object for envRec. 3. Return the result of calling the [[HasProperty]] internal method of bindings, passing N as the property name. The [[HasProperty]] internal method is: 8.12.6 [[HasProperty]] (P) When the [[HasProperty]] internal method of O is called with property name P, the following steps are taken: 1. Let desc be the result of calling the [[GetProperty]] internal method of O with property name P. 2. If desc is undefined, then return false. 3. Else return true. The [[GetProperty]] internal method is: 8.12.2 [[GetProperty]] (P) When the [[GetProperty]] internal method of O is called with property name P, the following steps are taken: 1. Let prop be the result of calling the [[GetOwnProperty]] internal method of O with property name P. 2. If prop is not undefined, return prop. 3. Let proto be the value of the [[Prototype]] internal property of O. 4. If proto is null, return undefined. 5. Return the result of calling the [[GetProperty]] internal method of proto with argument P. Notice the tail call at step 5 to walk the prototype chain. > Sorry for leaving you out in the cold on this one. Whether it's easy for any engine to put attributes along with methods defined by an implemented WebIDL interface on the relevant prototype, instead of directly on the global, may still be "work" but shouldn't break var combined with object-detection where the var has the same name as the attribute. /be
Received on Friday, 10 August 2012 14:00:21 UTC