Partially revert I4e395394a, keeping only JavaScript part

Change-Id: Ia1a6df88f613b302c060279e8d90e0166443034e