1
0
Fork 0

Fixed __self assignment for FF

This little experience was rather frustrating. Indeed, it would imply that
the static implementation (at least, accessing protected and private static
members) was always broken in FF. I should be a bit more diligent in my testing.
Or perhaps it broke in a more recent version of FF, which is more likely. The
problem seems to be that we used defineSecureProp() for an assignment to the
actual class, then later properly assigned it to class.___$$svis$$.
Of course, defineSecureProp() makes it read-only, so this failed, causing
an improper assignment for __self, breaking the implementation. As such,
this probably broke in newer versions of FF and worked properly in older versions.

More concerningly is that the implementations clearly differ between Chromium
and Firefox. It may be that Firefox checks the prototype chain, whereas Chromium
(v8, specifically) will simply write to that object, ignoring that the property
further down the prototype chain is read-only.
closure/master
Mike Gerwitz 2011-12-04 00:32:16 -05:00
parent f2e0bbc2f6
commit 446aa8d413
1 changed files with 1 additions and 4 deletions

View File

@ -402,7 +402,7 @@ exports.prototype.build = function extend()
// chain, it takes much more time to define the property in this manner. // chain, it takes much more time to define the property in this manner.
// Therefore, we can save a substantial amount of time by defining it on the // Therefore, we can save a substantial amount of time by defining it on the
// prototype rather than on each new instance via __initProps(). // prototype rather than on each new instance via __initProps().
util.defineSecureProp( prototype, '__self', new_class ); util.defineSecureProp( prototype, '__self', new_class.___$$svis$$ );
// create internal metadata for the new class // create internal metadata for the new class
var meta = createMeta( new_class, base ); var meta = createMeta( new_class, base );
@ -775,9 +775,6 @@ exports.prototype._attachPropInit = function(
inst_props, properties, members inst_props, properties, members
); );
// give internal methods access to protected/private static members
vis.__self = ctor.___$$svis$$;
// provide a means to access the actual instance (rather than the // provide a means to access the actual instance (rather than the
// property/visibility object) internally (this will translate to // property/visibility object) internally (this will translate to
// this.__inst from within a method), but only if we're on our final // this.__inst from within a method), but only if we're on our final