Prototype 1.5.0 and json.js

I updated to Prototype 1.5.0 for a web app I'm developing, and all of a sudden Firefox starts choking on my code.... Exception ``[object Object]'' thrown from function anonymous(value=string:"get") in line 407. Exception ``[object Object]'' thrown from function anonymous(value=string:"get") in line 328. Exception ``[object Object]'' thrown from function anonymous() in line 330. Exception ``[object Object]'' thrown from function anonymous(iterator=function:anonymous) in line 541. Exception ``[object Object]'' thrown from function anonymous(iterator=function:anonymous) in line 326. Exception ``[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://ascend.local/javascript/prototype.1.5.0.js :: anonymous :: line 916" data: no]'' thrown from function anonymous() in line 916. Exception ``[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.setRequestHeader]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://ascend.local/javascript/prototype.1.5.0.js :: anonymous :: line 916" data: no]'' thrown from function anonymous(url=string:"http://ascend.local/remote_fakeout/process.php") in line 862. Well, I'm using the json.js library from Douglas Crockford to parse the json results from the servlet and it sets a toJSONString method on each object. This ticket from Ruby On Rails trac provided the information that had eluded me for going on 28 hours. This: 915: for (var name in headers) 916: if (typeof headers[name] != 'function') 917: }, Needs to become this: 915: for (var name in headers) 916: if (typeof headers[name] != 'function') 917: this.transport.setRequestHeader(name, headers[name]); 918: }, in prototype.js if you want to use the json.js library and not have Firefox throw exceptions like beads during Mardi Gras. I hope to one day understand OOP enough to know how to solve these issues in under a day. Until then I'll seek constant reprieve from the hourly compulsion to end my pain with a sweet gunpowder symphony due to my small brain, lack of raw talent, and inability to comprehend the obvious. Yay. Now I can get back to writing the web application I was supposed to be 30 hours into at this point. I suck.

Posted by jeremy 21/01/2007 at 15h33