{"action":"created","issue":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/13758","labels_url":"https://api.github.com/repos/ariya/phantomjs/issues/13758/labels{/name}","comments_url":"https://api.github.com/repos/ariya/phantomjs/issues/13758/comments","events_url":"https://api.github.com/repos/ariya/phantomjs/issues/13758/events","html_url":"https://github.com/ariya/phantomjs/issues/13758","id":118829864,"number":13758,"title":"'page.onResourceRequested' misses some URLs","user":{"login":"kriegaex","id":1537384,"avatar_url":"https://avatars.githubusercontent.com/u/1537384?v=3","gravatar_id":"","url":"https://api.github.com/users/kriegaex","html_url":"https://github.com/kriegaex","followers_url":"https://api.github.com/users/kriegaex/followers","following_url":"https://api.github.com/users/kriegaex/following{/other_user}","gists_url":"https://api.github.com/users/kriegaex/gists{/gist_id}","starred_url":"https://api.github.com/users/kriegaex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriegaex/subscriptions","organizations_url":"https://api.github.com/users/kriegaex/orgs","repos_url":"https://api.github.com/users/kriegaex/repos","events_url":"https://api.github.com/users/kriegaex/events{/privacy}","received_events_url":"https://api.github.com/users/kriegaex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-25T12:47:56Z","updated_at":"2015-11-26T14:15:51Z","closed_at":null,"body":"I have a problem with PhantomJS 2.0.0 on Windows 7 Pro 64-bit. BTW, I use PJS in connection with Geb integration tests triggered by Maven. The same problem already occurred under PJS 1.9.8 on Windows and even worse (i.e. for more URLs) on Linux, as mentioned in #13745 and on the mailing list. As now I have the problem in the current version, hopefully my ticket will be accepted this time.\r\n\r\nMy script\r\n\r\n```javascript\r\nvar page = this;\r\npage.onResourceRequested = function (requestData, request) {\r\n    if (requestData.url.match(/fonts.googleapis.com|youtube-nocookie.com|api.ahoyrtc.com/)) {\r\n        console.log('Request (#' + requestData.id + '): ' + requestData.url + ' -> abort');\r\n        request.abort();\r\n    }\r\n    else {\r\n        console.log('Request (#' + requestData.id + '): ' + requestData.url + ' -> ' + JSON.stringify(requestData));\r\n    }\r\n}\r\n```\r\n\r\ngets executed for most URLs opened via Geb and Ghostdriver, but for some it does not. Instead, the test stalls and is aborted after a timeout of 30 seconds specified in my `GebConfig.groovy`. What I am doing is\r\n  * deactivate proxy via `--proxy-type=none` CLI parameter,\r\n  * call an internal page accessible without proxy.\r\n  * The page tries to load some resources such as Webfont, CSS and JS files, but my `onResourceRequested` hook is supposed to blacklist them. Somehow it fails to do so on some pages, on others it works. I.e. I see a few `Request ... -> abort` messages, but not all I expect. When it fails, the URLs are not logged either, but page loading just times out.\r\n  * If I add the blacklisted domains to my */etc/hosts* file like `127.0.0.1 api.ahoyrtc.com`, the tests pass, no more timeouts.\r\n\r\nFeel free to ask for more information.\r\n\r\n**Edit:** Just thinking out loud, could this be related to resources being loaded asynchronously in combination with HTTPS? I see in my logs that some HTTPS URLs are intercepted by the hook, though."},"comment":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/comments/159925294","html_url":"https://github.com/ariya/phantomjs/issues/13758#issuecomment-159925294","issue_url":"https://api.github.com/repos/ariya/phantomjs/issues/13758","id":159925294,"user":{"login":"kriegaex","id":1537384,"avatar_url":"https://avatars.githubusercontent.com/u/1537384?v=3","gravatar_id":"","url":"https://api.github.com/users/kriegaex","html_url":"https://github.com/kriegaex","followers_url":"https://api.github.com/users/kriegaex/followers","following_url":"https://api.github.com/users/kriegaex/following{/other_user}","gists_url":"https://api.github.com/users/kriegaex/gists{/gist_id}","starred_url":"https://api.github.com/users/kriegaex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriegaex/subscriptions","organizations_url":"https://api.github.com/users/kriegaex/orgs","repos_url":"https://api.github.com/users/kriegaex/repos","events_url":"https://api.github.com/users/kriegaex/events{/privacy}","received_events_url":"https://api.github.com/users/kriegaex/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T14:15:51Z","updated_at":"2015-11-26T14:15:51Z","body":"I further thought about my problem. Basically the requirement is as follows: I would like to prevent PhantomJS from trying to load certain blacklisted URLs because in our test environment behind a very restrictive firewall they cannot be accessed without a proxy (which we are told not to use in automatic tests). The bad thing is not that external resources cannot be accessed because the pages still work as expected without them, but that PhantomJS tries to load them anyway and times out."}}