Sha256: f5ab2cfdee4e9ca784c6b549532773c15f6bc069afd8d50e692fee05b26e0fd6

Contents?: true

Size: 1.21 KB

Versions: 7

Compression:

Stored size: 1.21 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;
    if (!this._response_sent) {
      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 {
        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

7 entries across 6 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/poltergeist-1.18.1/lib/capybara/poltergeist/client/compiled/cmd.js
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/poltergeist-1.18.1/lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.18.1 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.18.0 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.17.0 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.16.0 lib/capybara/poltergeist/client/compiled/cmd.js
poltergeist-1.15.0 lib/capybara/poltergeist/client/compiled/cmd.js