Sha256: 5f781c03359d987f863a3985381ab545c915f931a5890d5ad90761db9ee79a64

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

class Poltergeist.Cmd
  constructor: (@owner, @id, @name, @args)->
    @_response_sent = false
  sendResponse: (response) ->
    errors = @browser.currentPage.errors
    @browser.currentPage.clearErrors()

    if errors.length > 0 && @browser.js_errors
      @sendError(new Poltergeist.JavascriptError(errors))
    else
      @owner.sendResponse(@id, response) unless @_response_sent
      @_response_sent = true

  sendError: (errors) ->
    @owner.sendError(@id, errors) unless @_response_sent
    @_response_sent = true

  run: (@browser) ->
    try
      @browser.runCommand(this)
    catch error
      if error instanceof Poltergeist.Error
        @sendError(error)
      else
        @sendError(new Poltergeist.BrowserError(error.toString(), error.stack))

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
poltergeist-1.14.0 lib/capybara/poltergeist/client/cmd.coffee
poltergeist-1.13.0 lib/capybara/poltergeist/client/cmd.coffee
poltergeist-1.12.0 lib/capybara/poltergeist/client/cmd.coffee
poltergeist-1.11.0 lib/capybara/poltergeist/client/cmd.coffee