JavaScript<->C++ bridge


#1

Let’s use the new forum!

I’ve been working on fixing this issue: https://github.com/ariya/phantomjs/issues/12973
I fixed it. But during fixing it I encountered the one question.

Take a look here: https://github.com/ariya/phantomjs/blob/master/src/bootstrap.js#L40-L76

Could someone remember why do we need object handlers there? Why we can’t just do something like:

phantom.__defineErrorSignalHandler__ = function (obj, page) {
    // disconnect previous handler
    try {
        page.javaScriptErrorSent.disconnect(obj, obj['onError']);
    } catch (e) { };

    page.javaScriptErrorSent.connect(obj, obj['onError']);
};

Thanks!