sheebz/phantom-proxy — pull request #34 by DelvarWorld (2013-01-11 19:15:05+00:00)
Title: Allow new API for setting a callback method for onConfirm

Phantomjs has an 'onConfirm' event which is the handler for a javascript
confirm dialog. This handler allows you to return true or false which
corresponds to clicking yes / no on the confirm dialog. Without being
able to return, the dialog will block all interaction, including future
page loads. However, by the time userland catches the on('confirm')
event, we are two event loop ticks past the function and are in no place
to return true / false.

This patch allows for a new API function page.set('onConfirmCallback')
which will serialize and deserialize a function into phantom to
pre-register a callback function which will be called on a confirm hit.

It's the simplest way I could think of to achieve this.