{"action":"created","issue":{"url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/521","repository_url":"https://api.github.com/repos/Tampermonkey/tampermonkey","labels_url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/521/comments","events_url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/521/events","html_url":"https://github.com/Tampermonkey/tampermonkey/issues/521","id":305434713,"number":521,"title":"Execute script @ the unsafe context","user":{"login":"sethfri","id":452308,"avatar_url":"https://avatars3.githubusercontent.com/u/452308?v=4","gravatar_id":"","url":"https://api.github.com/users/sethfri","html_url":"https://github.com/sethfri","followers_url":"https://api.github.com/users/sethfri/followers","following_url":"https://api.github.com/users/sethfri/following{/other_user}","gists_url":"https://api.github.com/users/sethfri/gists{/gist_id}","starred_url":"https://api.github.com/users/sethfri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethfri/subscriptions","organizations_url":"https://api.github.com/users/sethfri/orgs","repos_url":"https://api.github.com/users/sethfri/repos","events_url":"https://api.github.com/users/sethfri/events{/privacy}","received_events_url":"https://api.github.com/users/sethfri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-15T06:53:24Z","updated_at":"2018-03-16T20:04:43Z","closed_at":null,"author_association":"NONE","body":"I have a few Tampermonkey scripts in Safari 11.0.3, macOS 10.12.6. A few of them work great, but one of them only seems to run about 20-30% of the time. When I turn on the debug setting, I see that, for the scripts that work, they all emit this line:\r\n\r\n```\r\n[Debug] env: execute script [script name] @ the safe context now!\r\n```\r\n\r\nHowever, for the script that *doesn't* work, it emits the following line:\r\n\r\n```\r\n[Debug] env: execute script [script name] @ the unsafe context now!\r\n```\r\n\r\nIt emits this line even when it does work.\r\n\r\nWhat are the safe context and the unsafe context? How can I make the script that isn't working run in the safe context? That seems to be the only difference between the scripts that work and the one that doesn't work."},"comment":{"url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/comments/373829708","html_url":"https://github.com/Tampermonkey/tampermonkey/issues/521#issuecomment-373829708","issue_url":"https://api.github.com/repos/Tampermonkey/tampermonkey/issues/521","id":373829708,"user":{"login":"derjanb","id":767504,"avatar_url":"https://avatars2.githubusercontent.com/u/767504?v=4","gravatar_id":"","url":"https://api.github.com/users/derjanb","html_url":"https://github.com/derjanb","followers_url":"https://api.github.com/users/derjanb/followers","following_url":"https://api.github.com/users/derjanb/following{/other_user}","gists_url":"https://api.github.com/users/derjanb/gists{/gist_id}","starred_url":"https://api.github.com/users/derjanb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derjanb/subscriptions","organizations_url":"https://api.github.com/users/derjanb/orgs","repos_url":"https://api.github.com/users/derjanb/repos","events_url":"https://api.github.com/users/derjanb/events{/privacy}","received_events_url":"https://api.github.com/users/derjanb/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T20:04:43Z","updated_at":"2018-03-16T20:04:43Z","author_association":"COLLABORATOR","body":"If your script uses ```// @grant none``` then it will run at the \"unsafe\" context. If it uses any other value then \"none\" (i.e. ```// @grant GM_addStyle``` -> safe context) and including no ```@grant``` statement was given at all, then it will run at the \"safe\" context.\r\n\r\nHowever, this shouldn't make a difference in timming. What ```@run-at``` values do these scripts have?\r\n\r\nYou may try to add ```// @run-at document-end``` to some scripts.\r\n"}}
{"actor":{"display_login":"derjanb"}}