JSON.parse and JSON.stringify are not necessary here: all browsers that support postMessage support them