Re: [Prototype-core] Re: Native JSON breakage
Hi Bob, I'm sure there are a few things Google could do: Bob Aman boba...@google.com wrote: [...] my issue here is that while we're waiting for a newer version of Prototype, more sites are deploying the current version, and every time they do, that's one more site that's now incompatible with some of our APIs. Plus, there's not exactly an auto-update feature for JavaScript libraries. Sure there is (and Google provides it): Prototype hosted on Google's servers http://tinyurl.com/google-hosted-prototype I guess the left hand doesn't always know what the right hand is doing in an organization as large as Google :-) For every user that contacts our support team (and hopefully, gets correctly diagnosed and given a fix) there are ten more that give up before even talking to support. Of those ten users, most will assume the problem is Google's fault, because the visible breakage happens in our code even though the bug is Prototype's. Why not enhance (and future-proof!) the Google Friend Connect code, right where it fails, to simply check the (by now, already loaded) Prototype.Version number, and if it's the version with the bug, throw an error which says something helpful like: Detected Prototype 1.6.1: This version of Prototype is not compatible with Google Friend Connect. To resolve this issue: A. Upgrade to the a newer release of Prototype B. Run out patched version of Prototype 1.6 hosted at http://ajax.googleapis.com/prototype/1.6-patched/prototype.js C. See our http://support.url for more info, and other ways to work-around the bug, and resolve this issue. I'm happy to contribute patches or do whatever you guys need to make this fix happen. Mailing Tobie and Andrew bags of cash, or giving them great-paying no-show jobs at Google probably couldn't hurt either :-) -dave -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
Re: [Prototype-core] Re: Native JSON breakage
On Dec 2, 2009, at 8:36 AM, Richard Quadling wrote: 2009/12/2 David Kaufman da...@gigawatt.com: Mailing Tobie and Andrew bags of cash, or giving them great-paying no-show jobs at Google probably couldn't hurt either :-) I wouldn't mind one of those great-paying jobs. I'll turn up! I'll even wear the t-shirt. -- - Richard Quadling I'm sorry, but by volunteering to show up for a no-show job, you've violated the terms of employment, and are thus no-longer eligible for this position. I, on the other hand, promise to not show up. =) TAG -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
Re: [Prototype-core] Re: Native JSON breakage
Sure there is (and Google provides it): Prototype hosted on Google's servers http://tinyurl.com/google-hosted-prototype I guess the left hand doesn't always know what the right hand is doing in an organization as large as Google :-) You misunderstand. I'm well aware of this service, but the vast majority of the people I've seen with this problem are hosting the file themselves. And in most cases, that means we still have to diagnose the problem and ask them to upgrade once there's an upgrade available. For every user that contacts our support team (and hopefully, gets correctly diagnosed and given a fix) there are ten more that give up before even talking to support. Of those ten users, most will assume the problem is Google's fault, because the visible breakage happens in our code even though the bug is Prototype's. Why not enhance (and future-proof!) the Google Friend Connect code, right where it fails, to simply check the (by now, already loaded) Prototype.Version number, and if it's the version with the bug, throw an error which says something helpful like: Detected Prototype 1.6.1: This version of Prototype is not compatible with Google Friend Connect. To resolve this issue: A. Upgrade to the a newer release of Prototype B. Run out patched version of Prototype 1.6 hosted at http://ajax.googleapis.com/prototype/1.6-patched/prototype.js C. See our http://support.url for more info, and other ways to work-around the bug, and resolve this issue. Hmm, that's actually a good point. It's a lot less likely to be brittle and has the desired effect. I'm happy to contribute patches or do whatever you guys need to make this fix happen. Mailing Tobie and Andrew bags of cash, or giving them great-paying no-show jobs at Google probably couldn't hurt either :-) We're hiring, they're more than welcome to apply. :-) -Bob Aman -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
[Prototype-core] Re: Native JSON breakage
Add this code after prototype.js =). Also this code replaces FF 3.5 Native JSON.stringify with ES compatible... It breaks compatibility! delete String.prototype.toJSON; //! deleting this properties required to save FF 3.5 Native JSON.stringify delete Array.prototype.toJSON; //! delete Number.prototype.toJSON; Hash.prototype.toJSON = function() { return this.toObject(); }; Date.prototype.toISOString = function() { return this.getUTCFullYear() + '-' + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + this.getUTCDate().toPaddedString(2) + 'T' + this.getUTCHours().toPaddedString(2) + ':' + this.getUTCMinutes().toPaddedString(2) + ':' + this.getUTCSeconds().toPaddedString(2) + '.' + this.getUTCMilliseconds().toPaddedString(3) + 'Z'; }; Date.prototype.toJSON = function(key) { return (Object.isNumber(this) !isFinite(this) ? null : this.toISOString()); }; Object.isBoolean = function(object) { return Object.prototype.toString.call(object) === [object Boolean]; }; Object.toJSON = (function() { var stack, gap, propertyList, replacerFunction; function quote(string) { return String(string).inspect(true); } function str(key, holder, indent) { var value = holder[key]; if (value !== null (typeof value === 'object' || typeof value === 'function') Object.isFunction(value.toJSON)) { value = value.toJSON(key); } if (Object.isElement(value)) { return; } value = replacerFunction.call(holder, key, value); if (value === null || Object.isBoolean(value)) { return String(value); } if (Object.isString(value)) { return quote(value); } if (Object.isNumber(value)) { return (isFinite(value) ? String(value) : 'null'); } if (typeof value === 'object') { if (stack.indexOf(value) !== -1) { throw new TypeError(); } stack.push(value); var partial = [], braces = ['{', '}'], i, strP, length, k; if (Object.isArray(value)) { braces = ['[', ']']; for(i = 0, length = value.length; i length; i++) { strP = str(i, value, indent + gap); partial.push(Object.isUndefined(strP) ? 'null' : strP); } } else { k = propertyList || Object.keys(value); for(i = 0, length = k.length; i length; i++) { strP = str(k[i], value, indent + gap); if (!Object.isUndefined(strP)) { partial.push(quote(k[i]) + (gap ? ': ' : ':') + strP); } } } stack.pop(); return braces[0] + (partial.length gap ? '\n' + indent + gap + partial.join(',\n' + indent + gap) + '\n' + indent : partial.join (',')) + braces[1]; } } return function(value /*, replacer, space */) { var replacer = arguments[1], space= arguments[2] || ''; stack = []; replacerFunction = (Object.isFunction(replacer) ? replacer : function(k, v) { return v; }); if (Object.isArray(replacer)) { var hash = {}; propertyList = replacer.inject([], function(array, v) { if ((Object.isString(v) || Object.isNumber(v)) ! hash.hasOwnProperty(' ' + v)) { hash[' ' + v] = 1; array.push(String(v)); } return array; }); } else { propertyList = null; } if (Object.isNumber(space)) { space = Math.min(Math.floor(+space) || 0, 10); gap = ' '.times(space); } else if (Object.isString(space)) { gap = space.substr(0, 10); } else { gap = ''; } return str('', {'': value}, ''); }; }()); (window.JSON = window.JSON || {}).stringify = Object.toJSON;// FF 3.5 uses diff. implementation -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
Re: [Prototype-core] Re: Native JSON breakage
Add this code after prototype.js =) Thus far, this is the technique we've already been advocating, though in considerably shorter form. It's a stop-gap measure at best, and brittle at worst. However, my issue here is that while we're waiting for a newer version of Prototype, more sites are deploying the current version, and every time they do, that's one more site that's now incompatible with some of our APIs. Plus, there's not exactly an auto-update feature for JavaScript libraries. For every user that contacts our support team (and hopefully, gets correctly diagnosed and given a fix) there are ten more that give up before even talking to support. Of those ten users, most will assume the problem is Google's fault, because the visible breakage happens in our code even though the bug is Prototype's. I'm happy to contribute patches or do whatever you guys need to make this fix happen. -Bob Aman -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
[Prototype-core] Re: Native JSON breakage
Hi, Bob. Thanks for your post. We'll be including fixes for native JSON in Prototype 1.7, a prerelease of which is just around the corner. I understand your frustration with this issue. It's on our top priority list. Best, Tobie -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en
Re: [Prototype-core] Re: Native JSON breakage
We'll be including fixes for native JSON in Prototype 1.7, a prerelease of which is just around the corner. Just around the corner means different things on different projects. Are we talking weeks, months? I'm trying to determine if Google should be spending some engineering time on detecting and auto-resolving the issue on our end or if it's better to wait for 1.7's release or a 1.6 point release and just ask users to upgrade to resolve. -Bob Aman -- You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en