Add a test to demonstrate the problem with JSON-ification.

https://github.com/ariya/phantomjs/issues/12615
2.0
Ariya Hidayat 2014-09-27 13:21:29 -07:00
parent 5768b705a0
commit 7bcb9a8725
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
var assert = require('../../assert');
var webpage = require('webpage');
var page = webpage.create();
// Hijack JSON.parse to something completely useless.
page.content = '<html><script>JSON.parse = function() {}</script></html>';
var result = page.evaluate(function(obj) {
return obj.value * obj.value;
}, { value: 4 });
// FAIL
// assert.equal(result, 16);