lib/capybara/poltergeist/client/compiled/browser.js in poltergeist-1.2.0 vs lib/capybara/poltergeist/client/compiled/browser.js in poltergeist-1.3.0

- old
+ new

@@ -35,11 +35,11 @@ }; this.page.onLoadFinished = function(status) { if (_this.state === 'loading') { _this.sendResponse({ status: status, - click: _this.last_click + position: _this.last_mouse_event }); return _this.setState('default'); } else if (_this.state === 'awaiting_frame_load') { _this.sendResponse(true); return _this.setState('default'); @@ -60,17 +60,25 @@ }), 0); } }; }; + Browser.prototype.runCommand = function(name, args) { + this.setState("default"); + return this[name].apply(this, args); + }; + Browser.prototype.debug = function(message) { if (this._debug) { return console.log("poltergeist [" + (new Date().getTime()) + "] " + message); } }; Browser.prototype.setState = function(state) { + if (this.state === state) { + return; + } this.debug("state " + this.state + " -> " + state); return this.state = state; }; Browser.prototype.sendResponse = function(response) { @@ -380,9 +388,14 @@ return this.sendResponse(true); }; Browser.prototype.remove_cookie = function(name) { this.page.deleteCookie(name); + return this.sendResponse(true); + }; + + Browser.prototype.cookies_enabled = function(flag) { + phantom.cookiesEnabled = flag; return this.sendResponse(true); }; Browser.prototype.set_js_errors = function(value) { this.js_errors = value;