Skip to content

Commit

Permalink
Fixed failing to create empty document on HTTP error.
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Jun 5, 2012
1 parent 9be9f79 commit 928c29d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,8 @@ Note that `browser.text` no longer preserves white space.

Fixed JS execution bug that messes with require.js.

Fixed failing to create empty document on HTTP error.


## Version 1.2.0 2012-05-28

Expand Down
3 changes: 2 additions & 1 deletion lib/zombie/history.coffee
Expand Up @@ -97,13 +97,14 @@ class History
# Proceeed to load resource ...
method = (method || "GET").toUpperCase()
@_browser.resources.request method, url, data, headers, (error, response)=>
document = @_createDocument(@_window, response.url)
if error
document = @_createDocument(@_window, url)
document.open()
document.write error.message
document.close()
@_browser.emit "error", error
else
document = @_createDocument(@_window, response.url)
@_browser.response = [response.statusCode, response.headers, response.body]
url = URL.parse(response.url)
@_stack[@_index].update url
Expand Down

0 comments on commit 928c29d

Please sign in to comment.