lib/capybara/poltergeist/client/compiled/main.js in poltergeist-1.10.0 vs lib/capybara/poltergeist/client/compiled/main.js in poltergeist-1.11.0
- old
+ new
@@ -2,34 +2,21 @@
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
Poltergeist = (function() {
function Poltergeist(port, width, height) {
- var that;
this.browser = new Poltergeist.Browser(width, height);
this.connection = new Poltergeist.Connection(this, port);
- that = this;
- phantom.onError = function(message, stack) {
- return that.onError(message, stack);
- };
- this.running = false;
+ phantom.onError = (function(_this) {
+ return function(message, stack) {
+ return _this.onError(message, stack);
+ };
+ })(this);
}
Poltergeist.prototype.runCommand = function(command) {
- var error, error1;
- this.running = true;
- command = new Poltergeist.Cmd(this, command.id, command.name, command.args);
- try {
- return command.run(this.browser);
- } catch (error1) {
- error = error1;
- if (error instanceof Poltergeist.Error) {
- return this.sendError(command.id, error);
- } else {
- return this.sendError(command.id, new Poltergeist.BrowserError(error.toString(), error.stack));
- }
- }
+ return new Poltergeist.Cmd(this, command.id, command.name, command.args).run(this.browser);
};
Poltergeist.prototype.sendResponse = function(command_id, response) {
return this.send({
command_id: command_id,
@@ -46,15 +33,11 @@
}
});
};
Poltergeist.prototype.send = function(data) {
- if (this.running) {
- this.connection.send(data);
- this.running = false;
- return true;
- }
- return false;
+ this.connection.send(data);
+ return true;
};
return Poltergeist;
})();