Sha256: 6d690bcd3d429657d98b506c348ed0e14fea832cea0c08be0770d0d1a41f71f6

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

Poltergeist.Cmd = (function() {
  function Cmd(owner, id, name, args) {
    this.owner = owner;
    this.id = id;
    this.name = name;
    this.args = args;
    this._response_sent = false;
  }

  Cmd.prototype.sendResponse = function(response) {
    var errors;
    errors = this.browser.currentPage.errors;
    this.browser.currentPage.clearErrors();
    if (errors.length > 0 && this.browser.js_errors) {
      return this.sendError(new Poltergeist.JavascriptError(errors));
    } else {
      if (!this._response_sent) {
        this.owner.sendResponse(this.id, response);
      }
      return this._response_sent = true;
    }
  };

  Cmd.prototype.sendError = function(errors) {
    if (!this._response_sent) {
      this.owner.sendError(this.id, errors);
    }
    return this._response_sent = true;
  };

  Cmd.prototype.run = function(browser) {
    var error;
    this.browser = browser;
    try {
      return this.browser.runCommand(this);
    } catch (error1) {
      error = error1;
      if (error instanceof Poltergeist.Error) {
        return this.sendError(error);
      } else {
        return this.sendError(new Poltergeist.BrowserError(error.toString(), error.stack));
      }
    }
  };

  return Cmd;

})();

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
poltergeist-1.14.0 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.13.0 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.12.0 lib/capybara/poltergeist/client/compiled/cmd.js