lib/capybara/poltergeist/client/compiled/main.js in poltergeist-1.7.0 vs lib/capybara/poltergeist/client/compiled/main.js in poltergeist-1.8.0

- old
+ new

@@ -1,44 +1,47 @@ -var Poltergeist, system, _ref, _ref1, _ref2, - __hasProp = {}.hasOwnProperty, - __extends = 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; }; +var Poltergeist, system, + 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(this, width, height); + 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; } Poltergeist.prototype.runCommand = function(command) { - var error; + var error, error1; this.running = true; + command = new Poltergeist.Cmd(this, command.id, command.name, command.args); try { - return this.browser.runCommand(command.name, command.args); - } catch (_error) { - error = _error; + return command.run(this.browser); + } catch (error1) { + error = error1; if (error instanceof Poltergeist.Error) { - return this.sendError(error); + return this.sendError(command.id, error); } else { - return this.sendError(new Poltergeist.BrowserError(error.toString(), error.stack)); + return this.sendError(command.id, new Poltergeist.BrowserError(error.toString(), error.stack)); } } }; - Poltergeist.prototype.sendResponse = function(response) { + Poltergeist.prototype.sendResponse = function(command_id, response) { return this.send({ + command_id: command_id, response: response }); }; - Poltergeist.prototype.sendError = function(error) { + Poltergeist.prototype.sendError = function(command_id, error) { return this.send({ + command_id: command_id, error: { name: error.name || 'Generic', args: error.args && error.args() || [error.toString()] } }); @@ -62,16 +65,15 @@ return Error; })(); -Poltergeist.ObsoleteNode = (function(_super) { - __extends(ObsoleteNode, _super); +Poltergeist.ObsoleteNode = (function(superClass) { + extend(ObsoleteNode, superClass); function ObsoleteNode() { - _ref = ObsoleteNode.__super__.constructor.apply(this, arguments); - return _ref; + return ObsoleteNode.__super__.constructor.apply(this, arguments); } ObsoleteNode.prototype.name = "Poltergeist.ObsoleteNode"; ObsoleteNode.prototype.args = function() { @@ -84,12 +86,12 @@ return ObsoleteNode; })(Poltergeist.Error); -Poltergeist.InvalidSelector = (function(_super) { - __extends(InvalidSelector, _super); +Poltergeist.InvalidSelector = (function(superClass) { + extend(InvalidSelector, superClass); function InvalidSelector(method, selector) { this.method = method; this.selector = selector; } @@ -102,12 +104,12 @@ return InvalidSelector; })(Poltergeist.Error); -Poltergeist.FrameNotFound = (function(_super) { - __extends(FrameNotFound, _super); +Poltergeist.FrameNotFound = (function(superClass) { + extend(FrameNotFound, superClass); function FrameNotFound(frameName) { this.frameName = frameName; } @@ -119,12 +121,12 @@ return FrameNotFound; })(Poltergeist.Error); -Poltergeist.MouseEventFailed = (function(_super) { - __extends(MouseEventFailed, _super); +Poltergeist.MouseEventFailed = (function(superClass) { + extend(MouseEventFailed, superClass); function MouseEventFailed(eventName, selector, position) { this.eventName = eventName; this.selector = selector; this.position = position; @@ -138,12 +140,12 @@ return MouseEventFailed; })(Poltergeist.Error); -Poltergeist.JavascriptError = (function(_super) { - __extends(JavascriptError, _super); +Poltergeist.JavascriptError = (function(superClass) { + extend(JavascriptError, superClass); function JavascriptError(errors) { this.errors = errors; } @@ -155,16 +157,16 @@ return JavascriptError; })(Poltergeist.Error); -Poltergeist.BrowserError = (function(_super) { - __extends(BrowserError, _super); +Poltergeist.BrowserError = (function(superClass) { + extend(BrowserError, superClass); - function BrowserError(message, stack) { - this.message = message; - this.stack = stack; + function BrowserError(message1, stack1) { + this.message = message1; + this.stack = stack1; } BrowserError.prototype.name = "Poltergeist.BrowserError"; BrowserError.prototype.args = function() { @@ -173,34 +175,32 @@ return BrowserError; })(Poltergeist.Error); -Poltergeist.StatusFailError = (function(_super) { - __extends(StatusFailError, _super); +Poltergeist.StatusFailError = (function(superClass) { + extend(StatusFailError, superClass); - function StatusFailError() { - _ref1 = StatusFailError.__super__.constructor.apply(this, arguments); - return _ref1; + function StatusFailError(url) { + this.url = url; } StatusFailError.prototype.name = "Poltergeist.StatusFailError"; StatusFailError.prototype.args = function() { - return []; + return [this.url]; }; return StatusFailError; })(Poltergeist.Error); -Poltergeist.NoSuchWindowError = (function(_super) { - __extends(NoSuchWindowError, _super); +Poltergeist.NoSuchWindowError = (function(superClass) { + extend(NoSuchWindowError, superClass); function NoSuchWindowError() { - _ref2 = NoSuchWindowError.__super__.constructor.apply(this, arguments); - return _ref2; + return NoSuchWindowError.__super__.constructor.apply(this, arguments); } NoSuchWindowError.prototype.name = "Poltergeist.NoSuchWindowError"; NoSuchWindowError.prototype.args = function() { @@ -209,16 +209,18 @@ return NoSuchWindowError; })(Poltergeist.Error); -phantom.injectJs("" + phantom.libraryPath + "/web_page.js"); +phantom.injectJs(phantom.libraryPath + "/web_page.js"); -phantom.injectJs("" + phantom.libraryPath + "/node.js"); +phantom.injectJs(phantom.libraryPath + "/node.js"); -phantom.injectJs("" + phantom.libraryPath + "/connection.js"); +phantom.injectJs(phantom.libraryPath + "/connection.js"); -phantom.injectJs("" + phantom.libraryPath + "/browser.js"); +phantom.injectJs(phantom.libraryPath + "/cmd.js"); + +phantom.injectJs(phantom.libraryPath + "/browser.js"); system = require('system'); new Poltergeist(system.args[1], system.args[2], system.args[3]);