Major Ajax revisions
Reported by Mark Caudill | August 27th, 2008 @ 09:13 PM | in 1.6.1
- resolves isSameOrigin issues (:80 vs '')
- added hasHttpStatus (for non-HTTP pages)
- added a clean abort that just calls onReadyStateChange (as it should)
- added the aborted/timedout values to Ajax.Response
- added the timeout and the onTimeout responder/callback
- made it so Ajax.Responders was more custom even driven (?)
- made it so larger responseTexts don't bog down the Ajax.Response
- fixed the IE7 status 1223 error in Ajax.Response
- allow forceMethod (bool) to use other HTTP verbs (doesn't check browser support but available)
I will make a patch for this, but for now I'm just adding the ajax.js file since very few commits are being put in currently. I'm very certain this isn't the best solution to every problem, but this is intended to be a huge jump start in the right direction. I've thought out every fix/check/logic flow, but I want to do some tests later. Thoughts?
Comments and changes to this ticket
-
Mark Caudill August 27th, 2008 @ 09:14 PM
- → Title changed from Major Ajax. to Major Ajax revisions
-
Tobie Langel August 28th, 2008 @ 01:28 AM
- → Milestone changed from to 1.6.1
- → State changed from new to enhancement
- → Assigned user changed from to Tobie Langel
We're very busy with getting 1.6.0.3 out right now. So that's really what we're going to concentrate on over the next couple of weeks. But feel free to work on this as you please.
Please post separate patches for each issue to ease code reviewing and cherry picking.
-
Mark Caudill August 28th, 2008 @ 06:52 AM
@Tobie: Does it matter if I post them all in this ticket (as a series of patches on top of eachother)? (Also, if you need any assistance on 1.6.0.3, just speak up.)
I know you and Andrew are working on Caja/1.6.0.3, I didn't mean to imply you weren't doing commits. It's probably just a lack of active core developers, but I may just not have the full perspective.
I uploaded a new ajax.js that passes testing (3 minor syntax issues before). I'll look over my code some more to see if I missed anything and then create patches for each change (or group of changes).
-
fearphage September 1st, 2008 @ 11:19 AM
While you are revising, I would make a suggestion that you always do things the standards-compliant way first:
getTransport: (function(m) { try { (this[m] = function() { return new XMLHttpRequest() })() } catch(e) { try { (this[m] = function() { return new ActiveXObject('Msxml2.XMLHTTP') })() } catch(e) { try { (this[m] = function() { return new ActiveXObject('Microsoft.XMLHTTP') })() } catch(e) { try { this[m] = function() { return false }}}}} })('getTransport'),instead of
getTransport: (function(m) { try { (this[m] = function() { return new ActiveXObject('Msxml2.XMLHTTP') })() } catch(e) { try { (this[m] = function() { return new ActiveXObject('Microsoft.XMLHTTP')})() } catch(e) { try { (this[m] = function() { return new XMLHttpRequest()})() } catch(e) { try { this[m] = function() { return false }}}}} })('getTransport'),The people doing things correctly should be rewarded with the slightest of performance increases.
-
Tobie Langel September 1st, 2008 @ 03:54 PM
@fearphage: It's unfortunately not as simple: IE7's native XMLHttpRequest doesn't support the file protocol.
Also, before throwing the stone (again) at Microsoft, let's not forget that they came up with the whole idea and implementation originally.
-
fearphage September 1st, 2008 @ 05:05 PM
@Tobie: Innovation doesn't give you the right to disregard agreed on standards. I was not aware of IE7's implementation's shortcomings. My mistake.
-
-
fearphage September 2nd, 2008 @ 01:35 AM
@Tobie: Did Anne singlehandedly make all those decisions about the standard himself? I am sincerely asking as I don't know the answer to that question. I was under the assumption that it was democratically created. Reading the document it doesn't seem like a 1 man show.
In addition, the other 3 browsers have implemented the draft the same way (besides bugs of course). So whether they helped create the draft or not, they have all silently agreed upon it to some extent.
-
Tobie Langel September 2nd, 2008 @ 02:52 AM
@fearphage: The only thing I wanted to say was that, since xhr specs is still a draft, you cannot accuse a particular vendor of not following specs (even if that particular vendor has a known history of failing to do so regularly).
As a matter of fact, the way Prototype names the different states of the request ('Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete') was based on a prior draft of the specs and is now outdated (current draft agrees on: UNSENT, OPENED, HEADERS_RECEIVED, LOADING and DONE).
So technically, we're no longer following specs.
-
Mark Caudill September 6th, 2008 @ 04:35 AM
- no changes were found...
-
fearphage September 6th, 2008 @ 02:31 PM
return !Object.isUndefined(ActiveXObject)will throw in standards-compliant browsers.
return !Object.isUndefined(window.ActiveXObject) -
Juriy Zaytsev September 6th, 2008 @ 07:45 PM
John, no need to
callreally:(function() { var window = this; // prototype gutts })();
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
