lib/capybara/poltergeist/client/browser.coffee in poltergeist-1.13.0 vs lib/capybara/poltergeist/client/browser.coffee in poltergeist-1.14.0
- old
+ new
@@ -73,12 +73,14 @@
setModalMessage: (msg) ->
@processed_modal_messages.push(msg)
return
add_extension: (extension) ->
- @currentPage.injectExtension extension
- @current_command.sendResponse 'success'
+ if @currentPage.injectExtension extension
+ @current_command.sendResponse 'success'
+ else
+ @current_command.sendError(new Poltergeist.BrowserError("Unable to load extension: #{extension}"))
node: (page_id, id) ->
if @currentPage.id == page_id
@currentPage.get(id)
else
@@ -415,12 +417,12 @@
resize: (width, height) ->
@currentPage.setViewportSize(width: width, height: height)
@current_command.sendResponse(true)
- network_traffic: ->
- @current_command.sendResponse(@currentPage.networkTraffic())
+ network_traffic: (type) ->
+ @current_command.sendResponse(@currentPage.networkTraffic(type))
clear_network_traffic: ->
@currentPage.clearNetworkTraffic()
@current_command.sendResponse(true)
@@ -441,11 +443,13 @@
allHeaders = @currentPage.getCustomHeaders()
for name, value of headers
allHeaders[name] = value
this.set_headers(allHeaders)
- add_header: (header, permanent) ->
- @currentPage.addTempHeader(header) unless permanent
+ add_header: (header, { permanent = true }) ->
+ unless permanent == true
+ @currentPage.addTempHeader(header)
+ @currentPage.addTempHeaderToRemoveOnRedirect(header) if permanent == "no_redirect"
this.add_headers(header)
response_headers: ->
@current_command.sendResponse(@currentPage.responseHeaders())