rework handling of multiple js messages in getPixmap response

Addresses #240 (which also contains information on how to test).

See the comment at the beginning of getPixmap for an explanation of what's going on.

@iwehrman Apologies for missing this when reviewing #237.