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) { ...@@ -52,7 +52,13 @@ function betterTypeOf(input) {
52 return 'null'; 52 return 'null';
53 default: 53 default:
54 try { 54 try {
55 return Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); 55 var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase();
56 if (type == 'object'
57 && phantom.casperEngine != "phantomjs"
58 && '__type' in input) {
59 type = input.__type;
60 }
61 return type;
56 } catch (e) { 62 } catch (e) {
57 return typeof input; 63 return typeof input;
58 } 64 }
......