Commit ccf9afaa ccf9afaad969a6aa9b039f278df66a4d367e89e9 by Nicolas Perriault

better handling of clientscripts injection

1 parent 1cf3d9bc
......@@ -1407,18 +1407,20 @@ function createPage(casper) {
}
}
if (casper.options.clientScripts) {
if (utils.isString(casper.options.clientScripts)) {
casper.options.clientScripts = [casper.options.clientScripts];
}
if (!utils.isArray(casper.options.clientScripts)) {
throw new CasperError("The clientScripts option must be an array");
} else {
}
casper.options.clientScripts.forEach(function _forEach(script) {
if (casper.page.injectJs(script)) {
casper.log(f('Automatically injected %s client side', script), "debug");
} else {
casper.log(f('Failed injecting %s client side', script), "warning");
casper.warn('Failed injecting %s client side', script);
}
});
}
}
// Client-side utils injection
casper.injectClientUtils();
// history
......