I have just submitted fixes and automated tests to ensure that in future we do not leak any obfuscated properties on non-final classes, ie. MVCObject and OverlayView. These fixes should go out with the next release. However the next scheduled release is 3 weeks away since many people are on vacation, so let's consider workarounds for the meantime.
On Thu, Dec 17, 2009 at 4:20 AM, bratliff <[email protected]> wrote: > > I have added the following to the initialization routine: > > for (i=0;l="ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(i);i++) > { > this[l]=0; > } > > It is still causing security violations. I also tried: > > this.L=null; > > without success. > Yes; when MVCObject calls method .L it expects to find a function rather than 0 or null. The essential problem is that PolyCluster .L and OverlayView .L collide on the shared property namespace. This hasn't been a big deal previously, but I suspect this will become a common problem as minifiers/compilers become more widely used. If you're using a minifier/compiler, a simple workaround is to "extern" the properties of PolyCluster so that they are not minified/obfuscated. This will increase the size of polycluster.js a little, but after gzip compression or property aliasing (if you're using a compiler) I would hope the increase is small. Perhaps this is acceptable for a few weeks; certainly this is the simplest short-term solution. Another solution is to delegate the work from PolyCluster (which extends OverlayView) to another class such as PolyClusterImpl. I can't find polycluster.js to test this code, but the following should work: /** * The original PolyCluster, which does all the work. * This should be hidden from clients. */ function PolyClusterImpl() { ... existing implementation of PolyCluster ... } ... existing implementation of PolyCluster ... /** * Proxy class which extends OverlayView and is intended for clients to use. */ function PolyCluster() { this['delegate'] = new PolyClusterImpl; } PolyCluster.prototype = new OverlayView; /** * Helper function, which takes a method name and returns a method implementation which delegates. * @param {string} property A method name * @return {Function} Delegating method */ function makeDelegateMethod(property) { return function() { return PolyClusterImpl.prototype[property].apply(this['delegate'], arguments); }; } for (var property in PolyClusterImpl.prototype) { // Do not copy obfuscated properties if (property.length < 3) continue; // Copy prototype properties if (typeof PolyClusterImpl.prototype[property] == 'function') { // Delegate method calls PolyCluster.prototype[property] = makeDelegateMethod(property); } else { // Copy non-function properties. This is the best we can do in Internet Explorer as it lacks getter/setter methods. PolyCluster.prototype[property] = PolyClusterImpl.prototype[property]; } } // Copy static properties (optional) for (var property in PolyClusterImpl) { PolyCluster[property] = PolyClusterImpl[property]; } -- > > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-maps-js-api-v3%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
