Commit Graph

36 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
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
Theodore Abshire 34e6ea4fba Convert FakeEvent and FakeEventTarget to ES6
Issue #1157

Change-Id: I027a1177fcd098f458b2cc3c3d92f93b43d26447
2019-05-30 17:11:12 +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
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Joey Parrish 1831ce95e2 Loosen the event listener type
This gets us ready for upcoming changes in the Closure Compiler and
its built-in externs.

Change-Id: I1c22a8ea5b99ef39e3cd5b5ed42ef4373ea3007c
2018-11-12 14:37:58 -08:00
Aaron Vaage 40c3f399fa Fake Event Target Readability
When reading through what fake event target, I found there were
a couple comments and minor name changes that would have helped
me understand everything a little sooner.

Change-Id: I56c49e366b9f0b226e289b6504e3890c77dda5c0
2018-07-19 21:40:50 +00:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44: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
Jacob Trimble f70436540c Convert 'var' to 'let'/'const' (3 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: I10f5c38a8b06b5797c6eec7492829084114514c9
2018-02-14 00:47:03 +00:00
theodab 5f612bd1d3 Added an integration test for cast receiver
This adds a single integration test for cast receiver, as well as a
framework for adding more in the future.
This particular test pauses at each stage in Player.load where the
player could theoretically be polled to compose an update message, and
waits for an update message to be polled. This should help catch any
further null exceptions in the cast receiver that prevent update
messages from being sent out.

Issue #1162

Change-Id: If24486dd821275ab674960e559bd6d10776955a7
2017-12-06 13:45:17 -08: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
Joey Parrish 494d6081fc Update Closure Compiler to v20170423
Change-Id: I28361a6c2d50087edc34695596731035a083543d
2017-05-16 17:19:27 +00:00
Joey Parrish 8ba088a38f Generate externs automatically
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.

We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.

This change introduces a new script to generate our externs from
scratch.  It uses a JavaScript parser called 'esprima'.

Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler.  For this, we
introduce a new annotation.  These are the currently-supported export
annotations:

 - @export: truly exported (attached to namespace) by the compiler
 - @expose: truly exposed (not renamed) by the compiler
 - @exportDoc: considered part of the exports in the docs
 - @exportInterface: considered part of the exports in generated externs

These annotations are now documented in docs/design/export.md

Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6
2017-02-01 11:42:16 -08:00
Joey Parrish 1d2929ab00 Add extra exports for the sake of generated externs
An upcoming compiler release will allow us to generate externs from
exports.  Because of that, we are adding some extra exports which are
otherwise not needed at runtime.

 - Export properties which implement an interface
 - Export classes which are referenced in external APIs
 - Export base classes of other exported classes

Change-Id: I78b3a4569b4b82b0a9d8993978faf268c2a791d9
2016-11-04 17:12:16 +00:00
Joey Parrish 0c8f74493c v2 Chromecast support
This introduces Chromecast support directly in the v2 library, as well
as in the demo app.

See the included design doc for details.

Issue #261

Change-Id: I26a707e7fa6bd829c3ebc70e4c9345ec25eed000
2016-07-06 11:47:04 -07:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
Using goog.asserts will work with the compiler.  So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.

This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.

Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
2016-03-11 15:29:20 -08:00
Jacob Trimble 846e7beb48 Unified comment spacing.
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces.  Now this only uses 2 spaces.

Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32
2016-03-10 16:27:45 -08:00
Joey Parrish 9d70cad0ea Simplify FakeEvent and FakeEventTarget
We now avoid tricky things like CustomEvent and setting properties on
native Events.  This gives us better cross-browser compatibility and
less complexity.

Change-Id: Idc9fcc69c33257e4540d956bcbc949de6d992cf0
2016-02-29 17:58:55 +00:00
Joey Parrish 9dbd6e6549 Add messages to all assertions
This makes debugging easier when an assertion fails.

Change-Id: I362e58706c71a12cffcda84dcd0b9ad281c51f30
2015-12-04 02:17:28 +00: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 03df140fb8 https://goo.gl/RvMyq4 2015-11-25 12:14:04 -08:00
Jono Ward c9892f9180 Implementing review comments; code cleanup, mainly code style tweaks and annotation improvements 2015-11-02 12:26:21 +00:00
Jono Ward de36492f5d Add support for IE/Edge/PlayReady 2015-11-02 12:26:20 +00: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
Timothy Drews 8c0d93009c Enable injecting custom IBandwidthEstimator impls.
* Export FakeEventTarget so IBandwidthEstimator implementations
  can use it.
* Expose IBandwidthEstimator methods so they do not get renamed
  in compiled mode.

Change-Id: Ib4c58d2357afdf402482202dc9fb8cf42dbbfad1
2015-04-10 15:29:58 -07:00
Joey Parrish 72046285df Correct FakeEventTarget exception handling.
If an event handler throws an exception, this should not affect the
caller of dispatchEvent.  This corrects FakeEventTarget's behavior to
more closely resemble EventTarget, and makes many of our asynchronous
processes more resilient to errors in application-level handlers.

Change-Id: I41202aa24650ebdba3310f20864568eea32b74ce
2015-04-09 17:09:35 +00:00
Joey Parrish 6bcaa4b568 Fix FakeEvent re-dispatch.
FakeEvents, when dispatched twice, have their targets overwritten.
For this to work, the target property needs to be set to writable.
Set all synthetic properties to writable to avoid exceptions.

Change-Id: I91556501bb857ddda69872d87d368cd3aea266e4
2015-04-03 22:32:34 +00:00
Joey Parrish a2520ec159 Tweak FakeEventTarget for Chrome 43.
This fixes FakeEventTarget and FakeEvent tests for Chrome 43+.

Also improves compatibility with strict mode.

Change-Id: I5ccca6798ff8a5f5b2fa98d6b9e8446378b7fab2
2015-03-31 15:16:46 -07:00
Joey Parrish 0257d7eed8 Make third argument for FakeEventTarget optional.
This makes FakeEventTarget more like EventTarget.

Change-Id: I5c4dd53e7ce665f98ade5909ac3bf5a90dd818e0
2015-03-09 19:10:23 +00:00
Joey Parrish b3d035be9f Shaka Player release v1.0 2014-12-19 14:26:19 -08:00