{"action":"created","issue":{"url":"https://api.github.com/repos/macbre/phantomas/issues/606","repository_url":"https://api.github.com/repos/macbre/phantomas","labels_url":"https://api.github.com/repos/macbre/phantomas/issues/606/labels{/name}","comments_url":"https://api.github.com/repos/macbre/phantomas/issues/606/comments","events_url":"https://api.github.com/repos/macbre/phantomas/issues/606/events","html_url":"https://github.com/macbre/phantomas/issues/606","id":142155901,"number":606,"title":"Init event triggered at the end of the page load","user":{"login":"gmetais","id":498031,"avatar_url":"https://avatars.githubusercontent.com/u/498031?v=3","gravatar_id":"","url":"https://api.github.com/users/gmetais","html_url":"https://github.com/gmetais","followers_url":"https://api.github.com/users/gmetais/followers","following_url":"https://api.github.com/users/gmetais/following{/other_user}","gists_url":"https://api.github.com/users/gmetais/gists{/gist_id}","starred_url":"https://api.github.com/users/gmetais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmetais/subscriptions","organizations_url":"https://api.github.com/users/gmetais/orgs","repos_url":"https://api.github.com/users/gmetais/repos","events_url":"https://api.github.com/users/gmetais/events{/privacy}","received_events_url":"https://api.github.com/users/gmetais/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-20T11:55:13Z","updated_at":"2016-03-20T11:57:17Z","closed_at":null,"body":"I have a module that listens to the the `init` event, and I've got a bug that triggers the event a second time, at the very end of the run, after the \"Done!\" log trace.\r\n\r\nWhen inspecting the `--verbose` logs, here is what I see with Phantomas v1.13 and v1.14:\r\n```\r\n11:29:52.523 Done!\r\n11:29:52.524 Event exit emitted\r\n11:29:52.525 onInit: was already triggered for <http://www.free.fr/freebox/>\r\n11:29:52.526 phantomas scope injected\r\n11:29:52.527 onInit: page object initialized\r\n11:29:52.527 Event init emitted\r\n```\r\n\r\nWith Phantomas v1.12, it looked like this:\r\n```\r\n11:35:56.894 Done!\r\n11:35:56.894 Event exit emitted\r\n11:35:56.902 onInit: was already triggered\r\n11:35:56.903 onInit: was already triggered\r\n```\r\n\r\nThe change that caused the problem is this one: https://github.com/macbre/phantomas/commit/2665dd125d6a25867f9ce8b178c06def8132bf09\r\n\r\nThe last time this `onInitialized` function is called, the page url is `about:blank`. Maybe the problem can be fixed by escaping the function when detecting `about:blank`. Would you like a pull request?"},"comment":{"url":"https://api.github.com/repos/macbre/phantomas/issues/comments/198911248","html_url":"https://github.com/macbre/phantomas/issues/606#issuecomment-198911248","issue_url":"https://api.github.com/repos/macbre/phantomas/issues/606","id":198911248,"user":{"login":"macbre","id":1929317,"avatar_url":"https://avatars.githubusercontent.com/u/1929317?v=3","gravatar_id":"","url":"https://api.github.com/users/macbre","html_url":"https://github.com/macbre","followers_url":"https://api.github.com/users/macbre/followers","following_url":"https://api.github.com/users/macbre/following{/other_user}","gists_url":"https://api.github.com/users/macbre/gists{/gist_id}","starred_url":"https://api.github.com/users/macbre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macbre/subscriptions","organizations_url":"https://api.github.com/users/macbre/orgs","repos_url":"https://api.github.com/users/macbre/repos","events_url":"https://api.github.com/users/macbre/events{/privacy}","received_events_url":"https://api.github.com/users/macbre/received_events","type":"User","site_admin":false},"created_at":"2016-03-20T11:57:17Z","updated_at":"2016-03-20T11:57:17Z","body":">  Would you like a pull request?\r\n\r\nYes, please :) And thanks for reporting the issue."}}