Commit Graph

19 Commits

Author SHA1 Message Date
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
michellezhuo 8ad0f48939 export shaka.polyfill
@exportInterface is used by the extern generator, but ignored by the
compiler. @export should be used for shaka.polyfill.

Closes #2549 .

Change-Id: I400db152ec8ca222a45a598ab58ddfbe44552443
2020-05-12 17:27:33 -07:00
Joey Parrish 0ad9aa3fd9 Fix EME polyfill issues
This fixes several inter-related issues:
 1. Catch errors in polyfill installation so that test setup isn't
    interrupted half-way through
 2. Use the compiled polyfill in tests, fixing polyfill installation
    error during tests on IE
 3. Require at least version 1.0.2 of the polyfill, since 1.0.0 had
    bugs in the module export and 1.0.1 had an infinite recursion bug

Change-Id: I38c973152409d9b3168e70e82f20579566663208
2019-12-02 12:28:28 -08:00
Joey Parrish aff3ad78cd Fix shaka.polyfill missing in externs
The generated externs did not include shaka.polyfill because we used
the wrong annotation on the class.  This fixes it.

Raised in PR #1273

Change-Id: I348064a117a7e1878b439ad8bd1ce49df56bfd39
2019-11-22 10:47:39 -08: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 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Theodore Abshire f584c9aab6 Convert remaining polyfills to ES6.
Issue #1157

Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
2019-05-29 23:39:08 +00:00
Jacob Trimble bfb42c69c4 Make EME polyfills independent.
Now each EME polyfill can be removed independently; this allows
someone to remove just the IE11 polyfill while still keeping the
others.

This adds a priority ordering to the polyfills so the nop polyfill
will be run last as a fallback if there are no other polyfills.

Issue #1261

Change-Id: I865e1c0d6a73a079dd91505e96572e215e6f6c6a
2018-03-06 21:34:25 +00:00
Jacob Trimble b512db87dd Convert 'var' to 'let'/'const' (8 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I6a329d28e13a81c9f7136737518c6bb8fa18402e
2018-02-20 11:29:30 -08:00
Joey Parrish b8ccc02320 Fix support test on old browsers
- IE did not get forEach until IE 9, so it can't be used in
   polyfill.installAll().
 - Object.keys, console, and console.log.bind may all be unavailable
   on older browsers, so skip initialization of on-screen logging in
   the demo app if they are missing.  The support test will fail
   anyway.
 - 'catch' is a reserved word on older browsers, so use the two-arg
   version of then() to catch promise failures.

With these fixes, the support test can again be used on old browsers,
and the compiled-mode demo app can report an error back to IE 6.

Change-Id: I3019468f24a510a265ad5b13df4f01cd1bb1f34d
2016-04-07 20:51:24 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Jacob Trimble 47a99253b0 Polyfills now register as plugins.
Change-Id: I498bda84d92f2c733f120e1b1c5a0ccae305ba15
2016-02-02 12:11:49 -08:00
Joey Parrish fff5dd7ee7 Audit exports
This changes namespace exports to the more targetted exportDoc,
adds exports where they are needed and removes them where they are
not.  Exporting of Uint8Array and String utils should be re-evaluated
later.

Change-Id: I9298e73a0a5ef026b6f2b1854488d2c359be10c1
2015-12-01 13:56:37 -08:00
Joey Parrish c55978cc79 Add a Promise polyfill
This will help with porting to IE11.  Chrome, Firefox, Safari, and
Edge all have native Promises.

This polyfill does not support thenables because Shaka does not use
them.  Other than tests related to thenables, this polyfill passes
the A+ test suite.

It is also worth noting that this polyfill is incompatible with
native Promises, so it should not be used to replace a native
implementation or mixed with browser APIs that may use a native
implementation internally.

To safely test in Chrome, force prefixed EME (to avoid native
Promises), set window.Promise to null, then load some content in
the test app.  If using a verison of Chrome after prefixed EME
was dropped, use unencrypted content.

To run the A+ test suite, compile the library, install nodejs and the
module 'promises-aplus-tests', then run ./test_promise_polyfill.js.

Inspired by pull #176

Change-Id: I0d25049f162ff7f3b57bbc795403fcdedf927262
2015-10-21 11:12:18 -07:00
Joey Parrish 4cc4e96dbd Overhaul license comments and file annotations
* Updates all Copyright years to 2015.
* Adds licenses annotations to all JS.
* Makes all licenses identical to avoid repeated appearance in the
  compiled output.
* Drops fileoverview annotations, which do not affect docs output.
* The linter still requires fileoverview on externs.

This patch required a newer closure compiler, since the previous
version we used had a bug regarding license annotations that caused
the license comment block to appear in the output once per file
regardless of uniqueness.

Change-Id: I2e9272db680cba7ecc4613d97f1d3a94ac2244cc
2015-09-08 12:02:34 -07:00
Joey Parrish 4d9177240a Revert "Adding license annotation to js files."
This reverts commit 8cb24652cb, due to
the fact that the new annotations caused our binary size to jump
by 52%.

The compiler preserves all 'unique' licenses, which causes trouble
since the comment blocks with the license annotations are not unique
and contain file overview comments as well.

We can re-examine this once we have restructured the license headers.

Change-Id: I418e407a0e0253630633697f30cf496a7fc2ddfc
2015-09-04 18:36:39 -07:00
Yohann Connell 8cb24652cb Adding license annotation to js files.
Change-Id: Id10592ccaf35608ac4f01844cae2fec4a2030d65
2015-09-04 00:05:17 +00:00
Joey Parrish 9ebd522c15 Add a polyfill for CustomEvent.
Change-Id: I92ac840976794e62c6ffc18a2065d4ebc4dfb33c
2015-04-21 16:11:47 -07:00
Joey Parrish a61c544de0 Make polyfill installation easier.
Change-Id: Ia8ccfae3c56d7146c9a2c65f8788bd5e5044579e
2015-04-21 10:54:34 -07:00