{"action":"created","issue":{"url":"https://api.github.com/repos/sdesalas/trifleJS/issues/50","labels_url":"https://api.github.com/repos/sdesalas/trifleJS/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/sdesalas/trifleJS/issues/50/comments","events_url":"https://api.github.com/repos/sdesalas/trifleJS/issues/50/events","html_url":"https://github.com/sdesalas/trifleJS/issues/50","id":58552093,"number":50,"title":"window.callPhantom and unhandled error logging are not available until onload event fires.","user":{"login":"tejacques","id":1389520,"avatar_url":"https://avatars.githubusercontent.com/u/1389520?v=3","gravatar_id":"","url":"https://api.github.com/users/tejacques","html_url":"https://github.com/tejacques","followers_url":"https://api.github.com/users/tejacques/followers","following_url":"https://api.github.com/users/tejacques/following{/other_user}","gists_url":"https://api.github.com/users/tejacques/gists{/gist_id}","starred_url":"https://api.github.com/users/tejacques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejacques/subscriptions","organizations_url":"https://api.github.com/users/tejacques/orgs","repos_url":"https://api.github.com/users/tejacques/repos","events_url":"https://api.github.com/users/tejacques/events{/privacy}","received_events_url":"https://api.github.com/users/tejacques/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sdesalas/trifleJS/labels/acknowledged","name":"acknowledged","color":"d4c5f9"},{"url":"https://api.github.com/repos/sdesalas/trifleJS/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/sdesalas/trifleJS/milestones/1","html_url":"https://github.com/sdesalas/trifleJS/milestones/Core%20API","labels_url":"https://api.github.com/repos/sdesalas/trifleJS/milestones/1/labels","id":884782,"number":1,"title":"Core API","description":"","creator":{"login":"sdesalas","id":534414,"avatar_url":"https://avatars.githubusercontent.com/u/534414?v=3","gravatar_id":"","url":"https://api.github.com/users/sdesalas","html_url":"https://github.com/sdesalas","followers_url":"https://api.github.com/users/sdesalas/followers","following_url":"https://api.github.com/users/sdesalas/following{/other_user}","gists_url":"https://api.github.com/users/sdesalas/gists{/gist_id}","starred_url":"https://api.github.com/users/sdesalas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdesalas/subscriptions","organizations_url":"https://api.github.com/users/sdesalas/orgs","repos_url":"https://api.github.com/users/sdesalas/repos","events_url":"https://api.github.com/users/sdesalas/events{/privacy}","received_events_url":"https://api.github.com/users/sdesalas/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":10,"state":"open","created_at":"2014-11-30T12:47:05Z","updated_at":"2015-03-08T03:06:14Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-02-23T07:42:07Z","updated_at":"2015-03-09T01:37:37Z","closed_at":null,"body":"### Bug\r\n\r\nSince these are set up on `DocumentCompleted`, the page has already run it's JavaScript and they are not available until the `onload` event has fired.\r\n\r\n#### Steps to reproduce\r\n\r\ntest_callPhantom.js\r\n```.js\r\nvar page = require('webpage').create();\r\npage.onCallback = function(data) {\r\n  console.log('CALLBACK: ' + JSON.stringify(data));\r\n  // Prints 'CALLBACK: { \"hello\": \"world\" }'\r\n};\r\npage.open('http://path/to/below/file', function(status) {\r\n  phantom.exit();\r\n});\r\n```\r\n\r\n```.html\r\n<!DOCTYPE html>\r\n<html>\r\n  <head>\r\n    <script>\r\n      // This should log as an unhandled error with:\r\n      //    IE:http://path/to/file/below(13): 'nonexistentVariable' is undefined\r\n      nonexistentVariable.shouldFail();\r\n    </script>\r\n    <script>\r\n      // This should callPhantom successfully and print\r\n      //    'CALLBACK { \"hello\": \"world\" }'\r\n      window.callPhantom({hello: \"world\"});\r\n    </script>\r\n  </head>\r\n  <body>\r\n  </body>\r\n</html>\r\n```\r\n\r\n#### Expected Output\r\n```\r\nIE:http://path/to/file/below(13): 'nonexistentVariable' is undefined\r\nCALLBACK { \"hello\": \"world\" }\r\n```\r\n\r\n#### Actual Output\r\n```\r\n```"},"comment":{"url":"https://api.github.com/repos/sdesalas/trifleJS/issues/comments/77788316","html_url":"https://github.com/sdesalas/trifleJS/issues/50#issuecomment-77788316","issue_url":"https://api.github.com/repos/sdesalas/trifleJS/issues/50","id":77788316,"user":{"login":"sdesalas","id":534414,"avatar_url":"https://avatars.githubusercontent.com/u/534414?v=3","gravatar_id":"","url":"https://api.github.com/users/sdesalas","html_url":"https://github.com/sdesalas","followers_url":"https://api.github.com/users/sdesalas/followers","following_url":"https://api.github.com/users/sdesalas/following{/other_user}","gists_url":"https://api.github.com/users/sdesalas/gists{/gist_id}","starred_url":"https://api.github.com/users/sdesalas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdesalas/subscriptions","organizations_url":"https://api.github.com/users/sdesalas/orgs","repos_url":"https://api.github.com/users/sdesalas/repos","events_url":"https://api.github.com/users/sdesalas/events{/privacy}","received_events_url":"https://api.github.com/users/sdesalas/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T01:37:37Z","updated_at":"2015-03-09T01:37:37Z","body":"I've integrated this functionality into 'Naviged' event as you suggested, thanks for picking this up.\n\nJust need to add a couple of unit tests for page.onError."}}