Files
shaka-player/lib/polyfill
Joey Parrish 6cb12ad174 Fix stack overflow in tests on IE
In our tests, we can load the library many times.  Each time, the
polyfills get installed, so each polyfill must be able to handle being
installed twice, and avoid any bad behavior.

The InputEvent polyfill, which is used on IE only to get correct UI
behavior on input elements, was only able to handle being installed
twice if each call was on the same copy of the library.  In our tests,
this is not the case.  If we load the library 20 times, we get the
polyfill installed 20 times.

Since it was comparing addEventListener with the polyfilled version,
this check would fail when the library was reloaded.  Each "shaka"
namespace was distinct.  So on 20 hypothetical library loads, each
polyfill would delegate to its predecessor, creating a stack some 40
functions deep.  This would trigger a stack overflow when testing on
IE.

Instead, we can store the original addEventListener in some global
place, such as on HTMLInputElement.prototype.originalAddEventListener.
If that exists, the polyfill (or some version of it) was installed, so
we don't install another.

Found in Jasmine upgrade process (issue #1949)

Change-Id: I714631c9b3ac5c59cf82a5cf7501cb544d1cb5cb
2019-06-05 09:08:37 -07:00
..
2019-05-29 23:39:08 +00:00
2019-06-03 18:40:50 +00:00
2019-05-29 23:39:08 +00:00