Permalink
Browse files

[Fixes #87] Fixes URL resolution in XHR requests with no port.

  • Loading branch information...
1 parent ab6f5ff commit 2c5ef676e1b753c645a989c57bac3193a95a3942 @assaf committed Feb 18, 2011
Showing with 4 additions and 2 deletions.
  1. +3 −1 CHANGELOG.md
  2. +1 −1 src/zombie/xhr.coffee
View
@@ -9,11 +9,13 @@ speaking, each window gets it's own context/global scope that is shared
by all scripts loaded for that page, but isolated from all other
windows.
-Fixed error handling on timeout/XHR scripts, these now generate an
+Fixes error handling on timeout/XHR scripts, these now generate an
`onerror` event.
Eventloop is now associated with window instead of browser.
+Fixes URL resolution in XHR requests when there's no port.
+
293 Tests
3.4 sec to complete
View
@@ -43,7 +43,7 @@ XMLHttpRequest = (window)->
throw new core.DOMException(core.SYNTAX_ERR, "Unsupported HTTP method") unless /^(DELETE|GET|HEAD|OPTIONS|POST|PUT)$/.test(method)
url = URL.parse(URL.resolve(window.location.href, url))
url.hostname ||= window.location.hostname
- url.host = "#{url.hostname}:#{url.port}"
+ url.host = if url.port then "#{url.hostname}:#{url.port}" else url.hostname
url.hash = null
throw new core.DOMException(core.SECURITY_ERR, "Cannot make request to different domain") unless url.host == window.location.host
throw new core.DOMException(core.NOT_SUPPORTED_ERR, "Only HTTP protocol supported") unless url.protocol == "http:"

0 comments on commit 2c5ef67

Please sign in to comment.