0
0
mirror of https://github.com/puppeteer/puppeteer synced 2024-06-14 14:02:48 +00:00
puppeteer/third_party/phantomjs/test/module/webpage/evaluate-broken-json.js
2017-05-11 00:06:41 -07:00

15 lines
428 B
JavaScript

test(function () {
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 });
assert_equals(result, 16);
}, "page script should not interfere with page.evaluate");