Commit 77836645 77836645bbf1925fe0de34222e7fc35cc8d10fd2 by Nicolas Perriault

added type checking for the Casper's clientScripts option

1 parent 8a3996b6
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
60 this.currentHTTPStatus = 200; 60 this.currentHTTPStatus = 200;
61 this.defaultWaitTimeout = 5000; 61 this.defaultWaitTimeout = 5000;
62 this.delayedExecution = false; 62 this.delayedExecution = false;
63 this.history = [];
63 this.loadInProgress = false; 64 this.loadInProgress = false;
64 this.logLevels = ["debug", "info", "warning", "error"]; 65 this.logLevels = ["debug", "info", "warning", "error"];
65 this.logStyles = { 66 this.logStyles = {
...@@ -1577,12 +1578,16 @@ ...@@ -1577,12 +1578,16 @@
1577 } 1578 }
1578 } 1579 }
1579 if (casper.options.clientScripts) { 1580 if (casper.options.clientScripts) {
1581 if (betterTypeOf(casper.options.clientScripts) !== "array") {
1582 casper.log("The clientScripts option must be an array", "error");
1583 } else {
1580 for (var i = 0; i < casper.options.clientScripts.length; i++) { 1584 for (var i = 0; i < casper.options.clientScripts.length; i++) {
1581 var script = casper.options.clientScripts[i]; 1585 var script = casper.options.clientScripts[i];
1582 if (casper.page.injectJs(script)) { 1586 if (casper.page.injectJs(script)) {
1583 casper.log('Automatically injected ' + script + ' client side', "debug"); 1587 casper.log('Automatically injected ' + script + ' client side', "debug");
1584 } else { 1588 } else {
1585 casper.log('Failed injecting ' + script + ' client side', "debug"); 1589 casper.log('Failed injecting ' + script + ' client side', "warning");
1590 }
1586 } 1591 }
1587 } 1592 }
1588 } 1593 }
......