This is what I did to solve the problem
setRequestHeaders: function() {
....
// modified foreach iteration
$H(headers).each( function(header) {
this.transport.setRequestHeader(header[0], header[1]);
}.bind(this) );
// for (var name in headers)
// this.transport.setRequestHeader(name, headers[name]);
}
The problem encountered was that the foreach was trying to add the
function 'extend' to the headers, and was causing it to fail with an
exception in the XMLHttpRequest object under FF :
"Component returned failure code: 0x80080057 (NS_ERROR_ILLEGAL_VALUE)
[nsIXMLHttpRequest.setRequestHeader]" (blah blah blah) location: "JS
frame :: http://.../prototype.js :: anonymous :: line 921" data: no"
I didn't do much extensive tests, but with the .each() function hooked
to a hash map of the header object seems to work nicely. ....And since
there's a .each() function, why not use it ? Just a thought.
-Yanick
On 9 fév, 15:20, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> For the benefit of anyone else with this issue...
>
> I ran into this when using rico 1.1.2 with prototype 1.5.0. Same
> issue. I dropped rico off the page and Ajax.Requeststarted working
> again.
>
> On Feb 6, 6:58 am, "Jimbo" <[EMAIL PROTECTED]> wrote:
>
> > Hi Christophe,
>
> > 100% guilty as charged! ;-) ... we're using both json.js &
> > prototype.js and I guess I never thought to look elsewhere because
> > it's something that changed when we moved from 1.4.0 to 1.5.0.
>
> > This seems a bit of a fundamental problem with json.js doesn't it?
>
> > I see what you mean though - and it extends Array and String in this
> > way too ... is there a good json serializer alternative that you know
> > of or should I wait for the pt implementation
>
> > Thanks anyhow,
>
> > ATB,
> > Jim
>
> > On Feb 6, 11:34 am, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
>
> > > Hey Jimbo,
>
> > > This is not a Prototype issue. Besides Prototype, you're using a
> > > JSON-related library that patches Object.prototype to provide it with a
> > > toJSONString method, probablyhttp://www.json.org/json.js. This issue
> > > is widely held against its official implementation...
>
> > > This breaks just about every for...in loop in every piece of JS code
> > > you'll ever run when this lib is loaded (including the one in
> > > setRequestHeaders). Which is why extending Object.prototype is widely
> > > regarded as a malpractice. Actually, earlier versions of Prototype used
> > > to do this, and quickly reverted to a cleaner behavior.
>
> > > Note that Prototype's trunk (current development version) finally adds
> > > JSON-related methods, so in the next point release you'll have them
> > > without the hassle. However, we use a namespaced Object.toJSONString
> > > method for generic objects (and a regular method for specific object
> > > types), to avoid this problem.
>
> > > --
> > > Christophe Porteneuve aka TDD
> > > [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---