Javascript literal binder fixes (2.3.x backport)

Backports #3508 and #3514 to 2.3.x