mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Fix test triggering PhantomJS crash.
Closes #163. Something in driver_spec.rb was causing PhantomJS to crash. This was reproducible on Ubuntu but not on Fedora. I tried quite hard to track down the cause but was unable to get a stack trace that came even remotely close to being useful. Compiling PhantomJS in debug mode made it go away. Therefore I suspect it was some sort of issue with the JIT compiler in WebKit, and can only hope this will be solved by WebKit upgrades in the future. Fortunately, resetting the driver after each test in driver_spec.rb makes it go away. This is something we should have been doing anyway, and adding that actually brought to light a false positive test for a feature that was in fact broken. So I have fixed that too.
This commit is contained in:
parent
8abc10a9cc
commit
1ca23145f6
4 changed files with 19 additions and 2 deletions
|
@ -220,6 +220,11 @@ makes debugging easier). Running `rake autocompile` will watch the
|
|||
|
||||
* Don't strip newlines in `Node#text`. [Issue #128]
|
||||
|
||||
* Fix status code support when a response redirects to another URL.
|
||||
This was previously tested to ensure it would return the status code
|
||||
of the redirected URL, but the test was falsely broken and the
|
||||
implementation was also broken.
|
||||
|
||||
### 0.7.0 ###
|
||||
|
||||
#### Features ####
|
||||
|
|
|
@ -107,6 +107,10 @@ Poltergeist.WebPage = (function() {
|
|||
|
||||
WebPage.prototype.onResourceRequestedNative = function(request) {
|
||||
this.lastRequestId = request.id;
|
||||
if (request.url === this.redirectURL) {
|
||||
this.redirectURL = null;
|
||||
this.requestId = request.id;
|
||||
}
|
||||
return this._networkTraffic[request.id] = {
|
||||
request: request,
|
||||
responseParts: []
|
||||
|
@ -117,7 +121,7 @@ Poltergeist.WebPage = (function() {
|
|||
this._networkTraffic[response.id].responseParts.push(response);
|
||||
if (this.requestId === response.id) {
|
||||
if (response.redirectURL) {
|
||||
return this.requestId = response.id;
|
||||
return this.redirectURL = response.redirectURL;
|
||||
} else {
|
||||
return this._statusCode = response.status;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,10 @@ class Poltergeist.WebPage
|
|||
onResourceRequestedNative: (request) ->
|
||||
@lastRequestId = request.id
|
||||
|
||||
if request.url == @redirectURL
|
||||
@redirectURL = null
|
||||
@requestId = request.id
|
||||
|
||||
@_networkTraffic[request.id] = {
|
||||
request: request,
|
||||
responseParts: []
|
||||
|
@ -77,7 +81,7 @@ class Poltergeist.WebPage
|
|||
|
||||
if @requestId == response.id
|
||||
if response.redirectURL
|
||||
@requestId = response.id
|
||||
@redirectURL = response.redirectURL
|
||||
else
|
||||
@_statusCode = response.status
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@ module Capybara::Poltergeist
|
|||
@driver = TestSessions::Poltergeist.driver
|
||||
end
|
||||
|
||||
after do
|
||||
@driver.reset!
|
||||
end
|
||||
|
||||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver with frame support"
|
||||
|
|
Loading…
Add table
Reference in a new issue