Prabindh egl1

Creating pull request for patch, for BUG ID #2517 in emscripten, and as discussed in pull request #2442. Creating a squashed set of patches for final review, posted to incoming. Kindly review.