fixes #644 - better handling of deleted page objects
Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -938,9 +938,16 @@ Casper.prototype.getPageContent = function getPageContent() { | ... | @@ -938,9 +938,16 @@ Casper.prototype.getPageContent = function getPageContent() { |
938 | Casper.prototype.getCurrentUrl = function getCurrentUrl() { | 938 | Casper.prototype.getCurrentUrl = function getCurrentUrl() { |
939 | "use strict"; | 939 | "use strict"; |
940 | this.checkStarted(); | 940 | this.checkStarted(); |
941 | return utils.decodeUrl(this.evaluate(function _evaluate() { | 941 | try { |
942 | return document.location.href; | 942 | return utils.decodeUrl(this.evaluate(function _evaluate() { |
943 | })); | 943 | return document.location.href; |
944 | })); | ||
945 | } catch (e) { | ||
946 | // most likely the current page object has been "deleted" (think closed popup) | ||
947 | if (/deleted QObject/.test(e.message)) | ||
948 | return ""; | ||
949 | throw e; | ||
950 | } | ||
944 | }; | 951 | }; |
945 | 952 | ||
946 | /** | 953 | /** | ... | ... |
-
Please register or sign in to post a comment