{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/node/issues/25774","labels_url":"https://api.github.com/repos/joyent/node/issues/25774/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node/issues/25774/comments","events_url":"https://api.github.com/repos/joyent/node/issues/25774/events","html_url":"https://github.com/joyent/node/issues/25774","id":97691838,"number":25774,"title":"the global cannot be freezed in vm.runInNewContext in node-v0.12.x","user":{"login":"ddnionio","id":7929041,"avatar_url":"https://avatars.githubusercontent.com/u/7929041?v=3","gravatar_id":"","url":"https://api.github.com/users/ddnionio","html_url":"https://github.com/ddnionio","followers_url":"https://api.github.com/users/ddnionio/followers","following_url":"https://api.github.com/users/ddnionio/following{/other_user}","gists_url":"https://api.github.com/users/ddnionio/gists{/gist_id}","starred_url":"https://api.github.com/users/ddnionio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddnionio/subscriptions","organizations_url":"https://api.github.com/users/ddnionio/orgs","repos_url":"https://api.github.com/users/ddnionio/repos","events_url":"https://api.github.com/users/ddnionio/events{/privacy}","received_events_url":"https://api.github.com/users/ddnionio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joyent/node/labels/doc","name":"doc","color":"944008"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-28T12:18:59Z","updated_at":"2015-07-31T22:50:05Z","closed_at":null,"body":"The global cannot be freeze in the vm.runInNewContext in v0.12.x, while it can in v0.10.x\r\n\r\nsee example: a.js\r\n```javascript\r\nvar vm = require(\"vm\");\r\nvar code = \"(function(){Object.freeze(global); new_var = 2; return global; })\"; //the global is freezed, so the new_var should not be added into global\r\n\r\nvar sandbox = {\r\n\toriginal_var:1\r\n};\r\n\r\nsandbox.global = sandbox;\r\nvar f=vm.runInNewContext(code, sandbox);\r\nconsole.log(f());\r\n```\r\n\r\nin 0.12.x\r\nnode a.js\r\n```\r\n{ original_var: 1, global: [Circular], new_var: 2 } \r\n```\r\n\r\nin 0.10.x\r\nnode a.js\r\n```\r\n{ original_var: 1, global: [Circular]}\r\n```"},"comment":{"url":"https://api.github.com/repos/joyent/node/issues/comments/126830085","html_url":"https://github.com/joyent/node/issues/25774#issuecomment-126830085","issue_url":"https://api.github.com/repos/joyent/node/issues/25774","id":126830085,"user":{"login":"ddnionio","id":7929041,"avatar_url":"https://avatars.githubusercontent.com/u/7929041?v=3","gravatar_id":"","url":"https://api.github.com/users/ddnionio","html_url":"https://github.com/ddnionio","followers_url":"https://api.github.com/users/ddnionio/followers","following_url":"https://api.github.com/users/ddnionio/following{/other_user}","gists_url":"https://api.github.com/users/ddnionio/gists{/gist_id}","starred_url":"https://api.github.com/users/ddnionio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddnionio/subscriptions","organizations_url":"https://api.github.com/users/ddnionio/orgs","repos_url":"https://api.github.com/users/ddnionio/repos","events_url":"https://api.github.com/users/ddnionio/events{/privacy}","received_events_url":"https://api.github.com/users/ddnionio/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T22:50:05Z","updated_at":"2015-07-31T22:50:05Z","body":"@domenic I use iojs v2.5.0 for win64\r\nexample b.js\r\n```javascript\r\na=1\r\nObject.freeze(global)\r\nconsole.log(Object.isFrozen(global));\r\nb=2\r\nconsole.log(global.a);\r\nconsole.log(global.b)\r\n```\r\n```\r\n$ iojs b.js\r\ntrue\r\n1\r\nundefined\r\n```\r\nSo it can freeze global in mainmodule. but if i run the a.js in first post, it shows the same result with nodev0.12, the global cannot be frozen in newcontext.\r\n\r\n"}}