Don't rely on JSON.parse() for page.evaluate().

https://github.com/ariya/phantomjs/issues/12615
2.0
Jacek Migdal 2014-12-07 18:56:25 -08:00 committed by Ariya Hidayat
parent 3b8282cb2e
commit 0bf14a3d0c
2 changed files with 2 additions and 3 deletions

View File

@ -371,7 +371,7 @@ function decorateNewPage(opts, page) {
case "object": //< for type "object"
case "array": //< for type "array"
case "date": //< for type "date"
str += "JSON.parse(" + JSON.stringify(JSON.stringify(arg)) + "),"
str += JSON.stringify(arg) + ","
break;
case "string": //< for type "string"
str += quoteString(arg) + ',';

View File

@ -10,5 +10,4 @@ var result = page.evaluate(function(obj) {
return obj.value * obj.value;
}, { value: 4 });
// FAIL
// assert.equal(result, 16);
assert.equal(result, 16);