{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-realms/issues/71","repository_url":"https://api.github.com/repos/tc39/proposal-realms","labels_url":"https://api.github.com/repos/tc39/proposal-realms/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-realms/issues/71/comments","events_url":"https://api.github.com/repos/tc39/proposal-realms/issues/71/events","html_url":"https://github.com/tc39/proposal-realms/issues/71","id":257714339,"number":71,"title":"Suggestion: Realm.prototype.importScript","user":{"login":"brn","id":449243,"avatar_url":"https://avatars1.githubusercontent.com/u/449243?v=4","gravatar_id":"","url":"https://api.github.com/users/brn","html_url":"https://github.com/brn","followers_url":"https://api.github.com/users/brn/followers","following_url":"https://api.github.com/users/brn/following{/other_user}","gists_url":"https://api.github.com/users/brn/gists{/gist_id}","starred_url":"https://api.github.com/users/brn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brn/subscriptions","organizations_url":"https://api.github.com/users/brn/orgs","repos_url":"https://api.github.com/users/brn/repos","events_url":"https://api.github.com/users/brn/events{/privacy}","received_events_url":"https://api.github.com/users/brn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-14T13:11:58Z","updated_at":"2017-11-15T16:18:18Z","closed_at":null,"author_association":"NONE","body":"Hey.\r\nI'm now working at advertise tag management tools.\r\nIn modern tag-management tool, document.write and document.writeln are rewritten as async script insertion.\r\nThis rewritings are almost succeeded, but if external script use document.write or document.writeln, we can't replace document.writle safely.\r\nSo I want to use Realms in that case. But Realms only allow direct eval and we can't get 3rd party script source code, so I want to suggest importScript function.\r\n\r\n#### overview\r\n```javascript\r\nRealm.prototype.importScript = function(scriptSrc) {}\r\n```\r\n\r\n#### Expected behavior\r\nLoad external script and directly eval in sandbox."},"comment":{"url":"https://api.github.com/repos/tc39/proposal-realms/issues/comments/344644455","html_url":"https://github.com/tc39/proposal-realms/issues/71#issuecomment-344644455","issue_url":"https://api.github.com/repos/tc39/proposal-realms/issues/71","id":344644455,"user":{"login":"caridy","id":38969,"avatar_url":"https://avatars1.githubusercontent.com/u/38969?v=4","gravatar_id":"","url":"https://api.github.com/users/caridy","html_url":"https://github.com/caridy","followers_url":"https://api.github.com/users/caridy/followers","following_url":"https://api.github.com/users/caridy/following{/other_user}","gists_url":"https://api.github.com/users/caridy/gists{/gist_id}","starred_url":"https://api.github.com/users/caridy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caridy/subscriptions","organizations_url":"https://api.github.com/users/caridy/orgs","repos_url":"https://api.github.com/users/caridy/repos","events_url":"https://api.github.com/users/caridy/events{/privacy}","received_events_url":"https://api.github.com/users/caridy/received_events","type":"User","site_admin":false},"created_at":"2017-11-15T16:18:18Z","updated_at":"2017-11-15T16:18:18Z","author_association":"COLLABORATOR","body":"It seems that this functionality can be implemented in user-land:\r\n\r\n```js\r\nconst source = await loadMyScriptSomehow(scriptSrc);\r\nMyRealm.eval(source);\r\n```\r\n\r\nIf that's not sufficient, and you want to have more control, you can always do the same people do today in regular pages, by reaching into the global object of the realm, and using the global `eval` to do direct, or indirect eval as you please."}}
{"actor":{"display_login":"caridy"}}