alexscheelmeyer/node-phantom — pull request #10 by benjie (2012-11-02 16:38:51+00:00)
Title: Fix `onLoadFinished` issues after `page.open`

When calling `page.open` with a callback (as in bridge.js), PhantomJS
overwrites `page.onLoadFinished` and never restores it.

This is the smallest change I could come up with to solve this issue -
it re-registers all event listeners after `page.open` returns, and if
`page.open` was called without a callback then it automatically forwards
the `onLoadFinished` event instead.

NOTE: I've deliberately not triggered `onLoadFinished` for all
`page.open` events so as to mimic PhantomJS's API (where it is one or
the other).