title: Protractor: Polyfill Function.prototype.bind in PhantomJS. Can't make it work, is it even possible?
body: <p>I've spent the afternoon on this and am making no progress, I'm really starting to wonder if it's even possible.</p>
  
  <p>I'm using Angular with Headroom to handle a menu disappearing when scrolling down. My testing is done with Protractor, using PhantomJS, and this is where the fun begins.</p>
  
  <p>PhantomJS does not support <code>.bind()</code> and Headroom uses it all over the place, which means I need to polyfill it. It should be no problem, but I can't make it work.</p>
  
  <p>I think my problem is that no matter where I run the polyfill function, PhantomJS and the tested page are already loaded, so it's already too late, Headroom will have failed to load due to <code>.bind()</code> not being available.</p>
  
  <p>Is there any way to run those methods before the page is loaded? I know I could add them to my application via a script tag in the head, but I'd rather not add something to the whole app that will only be used by the testing framework.</p>