Add JavaScript support for updated versions of Wait and WaitMany.

R=hansmuller@chromium.org, viettrungluu@chromium.org
BUG=365436

Review URL: https://codereview.chromium.org/816503002