#962 bug

Ajax.Request.isSameOrigin bug?

Reported by jochen | December 10th, 2009 @ 10:23 AM

In Ajax.Request.isSameOrigin there is this piece of code:

return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
      protocol: location.protocol,
      domain: document.domain,
      port: location.port ? ':' + location.port : ''

But we set our document.domain manually to the base-domain, so if we try ajax requests with X-JSON the

  return json.evalJSON(this.request.options.sanitizeJSON ||

fails in IE because m[0] does not equal the '#{protocol}//#{domain}#{port}'.interpolate....

So our fix was to change the domain: document.domain to domain: window.location.host which will return true in isSameOrigin.

Does anyone know if this is a good fix or if we did something wrong?

Comments and changes to this ticket

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