- From: Brendan Eich <brendan@mozilla.com>
- Date: Sun, 12 Aug 2012 10:49:50 -0700
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: Cameron McCormack <cam@mcc.id.au>, public-script-coord@w3.org, es-discuss@mozilla.org
Boris Zbarsky wrote:
> On 8/12/12 1:31 PM, Brendan Eich wrote:
>> There's still a problem for getter-less attributes including
>> indexedDB, so
[setter-less]
>> something *still* has to change there!
>
> I'm not sure I follow this. If indexedDB is on the global as an own
> property, what issue remains with it?
A var indexedDB in global scope where the global object has such a
get-only accessor will not clobber the existing property, but the
var+obj-detection pattern initializes the variable:
var indexedDb = ... || window.indexedDB;
and that will fail in strict mode (thanks, you point that out below):
js> void Object.defineProperty(this, 'foo', {get: function(){return 42}})
js> foo
42
js> var foo = 42
js> "use strict"; var foo = 43
typein:4: TypeError: setting a property that has only a getter
>> The global needs to be a flat object (only
>> implementation-specific magic protos along a chain ending in
>> Object.prototype).
>
> The magic from the global scope polluter isn't even impl-specific.
Right, HTML5 -- thanks to old IE :-|.
>> And we still need to be careful about writability (get-only indexedDB
>> point above).
>
> Ah, you meant setter-less above?
D'oh, yes.
> Only a problem in strict mode, right?
Right.
/be
Received on Sunday, 12 August 2012 17:50:21 UTC