Commit Graph

15 Commits

Author SHA1 Message Date
Jacob Trimble dc8b007d56 cleanup: Add missing requires.
This is a port of the internal changes: cr/321495405, cr/321592702,
and cr/321594488.

Change-Id: If6a4c4266ed10a70b01442974dbd19329bb5122e
2020-07-16 10:59:49 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +00:00
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
Theodore Abshire f584c9aab6 Convert remaining polyfills to ES6.
Issue #1157

Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
2019-05-29 23:39:08 +00:00
Jacob Trimble d5780d401b Fix line length issues for indent fix.
Change-Id: I87d75fd88000f8f9bff7b9f1bf5667ba28f6dd60
2019-05-13 22:31:20 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Aaron Vaage 4167b1658b Isolate Platform Checks
To make it easier to know where we are check what platform something is
(normally a sign of a work-around), this change isolates the logic to
make the check into functions.

Now looking for uses of |shaka.util.Platform| should show when we are
using platform-specific logic.

Change-Id: Ief49837c503e951f7138ec08a83355fe1c46db88
2018-12-11 05:43:52 +00:00
Joey Parrish 7091275cbf Replace indexOf with includes, startsWith
This replaces almost every instance of indexOf on both String and
Array.  There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.

Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
2018-09-14 19:10:56 +00:00
Jacob Trimble 759eef9685 Change goo.gl links to bit.ly.
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.

Change-Id: I07a86cba807b67157664893341f648023918d0de
2018-06-22 20:20:00 +00:00
Michelle Zhuo 535de4db84 Refactor: Remove underscore from parameter names
Change-Id: Ie9e6fb59763f454f245175f23c6444f919ba8135
2018-05-08 19:21:51 +00:00
Theodore Abshire d46e8fdf92 Typo fixes and rewording in comments, part 6
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: I2bfa4d531a8fcdcf9578e9c181c4534ad7443b7a
2018-03-21 17:59:42 +00:00
Joey Parrish d1df5dade6 Make it safe to install polyfills twice
Closes #941

Change-Id: I706aadd1bfc2c477d0ac8a0dff13defad74b3bda
2017-07-24 12:25:46 -07:00
Joey Parrish 84a8d1ca18 Polyfill the HTML5 'input' event
The HTML5 'input' event does not work correctly on all input elements
in IE 11.  There are equivalent events that the UI can use on IE.

Instead of remembering this and checking for IE every time the 'input'
event is needed, let the polyfill translate the event type.

Change-Id: I23258a5c6a0bd37e946214380ad07949f3ee7f88
2017-07-12 12:29:14 -07:00