fixed resources array is now reset adequately
reference discussion: https://groups.google.com/forum/?hl=fr?fromgroups#!topic/casperjs/TCkNzrj1IoA
Showing
1 changed file
with
4 additions
and
3 deletions
... | @@ -746,6 +746,7 @@ Casper.prototype.open = function open(location, settings) { | ... | @@ -746,6 +746,7 @@ Casper.prototype.open = function open(location, settings) { |
746 | operation: settings.method, | 746 | operation: settings.method, |
747 | data: settings.data | 747 | data: settings.data |
748 | }, this.page.settings); | 748 | }, this.page.settings); |
749 | this.resources = []; | ||
749 | return this; | 750 | return this; |
750 | }; | 751 | }; |
751 | 752 | ||
... | @@ -775,17 +776,18 @@ Casper.prototype.resourceExists = function resourceExists(test) { | ... | @@ -775,17 +776,18 @@ Casper.prototype.resourceExists = function resourceExists(test) { |
775 | var testFn; | 776 | var testFn; |
776 | switch (utils.betterTypeOf(test)) { | 777 | switch (utils.betterTypeOf(test)) { |
777 | case "string": | 778 | case "string": |
778 | testFn = function _test(res) { | 779 | testFn = function _testResourceExists_String(res) { |
779 | return res.url.search(test) !== -1; | 780 | return res.url.search(test) !== -1; |
780 | }; | 781 | }; |
781 | break; | 782 | break; |
782 | case "regexp": | 783 | case "regexp": |
783 | testFn = function _test(res) { | 784 | testFn = function _testResourceExists_Regexp(res) { |
784 | return test.test(res.url); | 785 | return test.test(res.url); |
785 | }; | 786 | }; |
786 | break; | 787 | break; |
787 | case "function": | 788 | case "function": |
788 | testFn = test; | 789 | testFn = test; |
790 | testFn.name = "_testResourceExists_Function"; | ||
789 | break; | 791 | break; |
790 | default: | 792 | default: |
791 | throw new CasperError("Invalid type"); | 793 | throw new CasperError("Invalid type"); |
... | @@ -1299,7 +1301,6 @@ function createPage(casper) { | ... | @@ -1299,7 +1301,6 @@ function createPage(casper) { |
1299 | }; | 1301 | }; |
1300 | page.onLoadStarted = function onLoadStarted() { | 1302 | page.onLoadStarted = function onLoadStarted() { |
1301 | casper.loadInProgress = true; | 1303 | casper.loadInProgress = true; |
1302 | casper.resources = []; | ||
1303 | casper.emit('load.started'); | 1304 | casper.emit('load.started'); |
1304 | }; | 1305 | }; |
1305 | page.onLoadFinished = function onLoadFinished(status) { | 1306 | page.onLoadFinished = function onLoadFinished(status) { | ... | ... |
-
Please register or sign in to post a comment