Commit a735ca6e a735ca6e4e657ce8c656432633f95c6747beb513 by Laurent Jouanneau

Refs #482: fixes utils.betterTypeOf() for SlimerJS

In SlimerJS, the webpage object has no type 'qtruntimeobject' written
in the string form of the object. But it has a __type property.
The function should check this property when the engine is not PhantomJS.
1 parent 89ac6366
......@@ -52,7 +52,13 @@ function betterTypeOf(input) {
return 'null';
default:
try {
return Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase();
var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase();
if (type == 'object'
&& phantom.casperEngine != "phantomjs"
&& '__type' in input) {
type = input.__type;
}
return type;
} catch (e) {
return typeof input;
}
......