#308 enhancement
Mark Caudill

Major Ajax revisions

Reported by Mark Caudill | August 27th, 2008 @ 09:13 PM | in 1.7

  • 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

    Mark Caudill August 27th, 2008 @ 09:14 PM

    • Title changed from “Major Ajax.” to “Major Ajax revisions”
  • Tobie Langel

    Tobie Langel August 28th, 2008 @ 01:28 AM

    • Milestone set to 1.7
    • State changed from “new” to “enhancement”
    • Assigned user set 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

    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).

  • Phred

    Phred 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

    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.

  • Phred

    Phred 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.

  • Tobie Langel

    Tobie Langel September 1st, 2008 @ 06:48 PM

    @fearphage: afaik, xhr standards are still a draft.

  • Phred

    Phred 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

    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
  • Phred

    Phred September 6th, 2008 @ 02:31 PM

    
    return !Object.isUndefined(ActiveXObject)
    

    will throw in standards-compliant browsers.

    
    return !Object.isUndefined(window.ActiveXObject)
    
  • Juriy Zaytsev

    Juriy Zaytsev September 6th, 2008 @ 07:45 PM

    John, no need to call really:

    
    (function() {
      var window = this;
      // prototype gutts
    })();
    
  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 01:54 AM

    • Tag changed from ajax, has_code, needs_patch, needs_tests to needs_patch, needs_tests, section:ajax

    [not-tagged:"ajax" tagged:"section:ajax" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:26 AM

    • Tag changed from needs_patch, needs_tests, section:ajax to missing:tests, needs_patch, section:ajax

    [not-tagged:"needs_tests" tagged:"missing:tests" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:28 AM

    • Tag changed from missing:tests, needs_patch, section:ajax to missing:patch, missing:tests, section:ajax

    [not-tagged:"needs_patch" tagged:"missing:patch" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:36 AM

    • Tag changed from missing:patch, missing:tests, section:ajax to missing:patch, needs:tests, section:ajax

    [not-tagged:"missing:tests" tagged:"needs:tests" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 03:37 AM

    • Tag changed from missing:patch, needs:tests, section:ajax to needs:patch, needs:tests, section:ajax

    [not-tagged:"missing:patch" tagged:"needs:patch" bulk edit command]

  • T.J. Crowder

    T.J. Crowder November 16th, 2009 @ 04:50 PM

    • Assigned user cleared.

    [responsible:none bulk edit command]

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

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.

Shared Ticket Bins

Attachments

Referenced by

Pages