Commit 00ae83c8 00ae83c8dfe47faa638160cf1c76ef23c46cd762 by Nicolas Perriault

simplified CasopeR.getGlobal()

1 parent c6977c14
...@@ -871,14 +871,13 @@ Casper.prototype.getGlobal = function getGlobal(name) { ...@@ -871,14 +871,13 @@ Casper.prototype.getGlobal = function getGlobal(name) {
871 } 871 }
872 return result; 872 return result;
873 }, name); 873 }, name);
874 if (typeof result !== "object") { 874 if (!utils.isObject(result)) {
875 throw new CasperError(f('Could not retrieve global value for "%s"', name)); 875 throw new CasperError(f('Could not retrieve global value for "%s"', name));
876 } else if ('error' in result) { 876 } else if ('error' in result) {
877 throw new CasperError(result.error); 877 throw new CasperError(result.error);
878 } else if (utils.isString(result.value)) { 878 } else if (utils.isString(result.value)) {
879 return JSON.parse(result.value); 879 return JSON.parse(result.value);
880 } 880 }
881 return undefined;
882 }; 881 };
883 882
884 /** 883 /**
......