Merge pull request #13700 from Pike/bug-938052-keyboard-js-errors

bug 938052, better report js errors in keyboard layouts, and fix a few, r=djf, rudyl, yuren(cherry picked from commit 42a20aee4866b67d1adb83a96a826040ed5b2c48)