Updating function onResourceRequested for phantomjs 1.9