Commit Graph

20 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 a65ef9983b Remove partial exports, broken in new compiler
The old compiler would let us export a static method on a class
without exporting the whole class and its constructor.  The new
compiler silently ignores `@export` for any methods of a non-exported
class.

This means that for the latest Closure Compiler, we must export any
class with exported static methods.  In some cases, these are
non-utility classes with constructors we'd rather not export, but the
constructor is implicitly exported by exporting the class itself.

This was initially caught by the integration tests.  The error wasn't
especially helpful, so I added a try/catch to loadShaka that makes the
error more apparent:
  TypeError: Cannot read property 'registerParserByMime' of undefined

To make sure we do not make this mistake again, I've added a check to
the extern generator, which was already able to detect these types of
classes.  I don't know a compiler-based way to do it, since the
compiler silently ignores the export annotations in these cases.

Issue #2528

Change-Id: I797c75a8098b0bb3cf837588569f878253dec2cf
2020-04-30 17:30:36 +00: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
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Joey Parrish 2d9299e513 Fix erasure of the database
In cases of corruption or version mismatch, we must be able to delete
the database without loading anything from it.  This comes up in
testing when you run an older version of Shaka Player after a newer
one has created the database.

Our ability to erase the database in these cases was lost when we
fixed #1277.  This reverts that change and changes the contract of the
storage classes to ensure that we will always be able to erase the
database, no matter what.

Change-Id: Iccfbe1fa2ca880877e4743e5ca6bd42cba44abe0
2018-11-09 11:18:14 -08:00
Jacob Trimble 65e9c36f6c Add database for storing session IDs.
This new database will store EME session IDs that need to be removed
at a later time.  For example, this can happen if we fail to remove
the session when deleting content.

Issue #1326

Change-Id: I808103535d93c9070e13e30b8cd939fea757cafe
2018-09-27 17:49:27 +00:00
Aaron Vaage 85b61a3a78 Remove Use of MapUtils.values in shaka/offline
Went through all the class in shaka/offline and removed all uses
of |MapUtils.values|. This required changing many uses of Object
to Map.

Change-Id: I6bd6d37009e7b32ea38e9cbabd64c2d36ffeabbc
2018-09-14 21:41:45 +00:00
Joey Parrish bb646befca Fix issues found by newer compilers and linters
Some of these issues were found by the Closure Compiler linter,
which we are not currently using here.  I will try to re-enable it
in a follow-up change.

Change-Id: Ie6e75f2b5a1e0f888c3dfbc78ed9cf254d2738bb
2018-08-09 12:22:34 -07: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
Aaron Vaage 8040f78883 Integrate StorageMuxer and Player
This CL replaces the old storage system with the storage muxer system.
In addition to replacing the old system, this CL removes all the
code that was only used by the old system.

As of this change Storage Muxer support shaka player's V1, V2, and V2
indexeddb schemes and exposes a plug-in system for other offline storage
components.

Issue #1248
Change-Id: I1a4914477ad8db29fd0e7ad7de2f149b6497f67e
2018-05-09 18:41:21 +00:00
Aaron Vaage 647a8c6064 Changes To Storage Muxer to Increase Ease-of-Use
While working with integrating storage muxer into the codebase, there
were some painful points in the API. This change addresses those
painful points.

1. Getting cells - many times we know that the cell should be under
                   a specific path. So resolving the path and
                   checking for null got annoying. This adds
                   a call that assume it should find the cell.

2. Get active cell - when getting the active cell, we often need
                     the cell and the path to the cell. So this
                     creates a "Handle" which pairs the cell and
                     path together.

3. Adjusting registry - when testing we need to change what storage
                        cells are actually available. Instead of
                        unregistering and registering cells, this
                        adds methods to add and remove a temporary
                        override.

Issue #1248

Change-Id: Ifd45ee5912f53b1da444476b560cf03669a19b11
2018-04-23 15:52:16 +00:00
Aaron Vaage ef5c92c720 Added GetCell to StorageMuxer
Added a method to get a cell from storage muxer. Unlike resolve path
this will return a rejected promise if the cell can not be found.

Issue #1248

Change-Id: Ia594b7741351d515e564e574321e49ad51073005
2018-04-11 21:09:25 +00:00
Aaron Vaage 21efc65973 Add toString to StorageCellPath
Added a toString method to StorageCellPath so that it will be
easier to read when added to a string.

Issue #1248

Change-Id: Iad7c2e633b6327bd39475d29d23426217f042ee3
2018-04-11 21:09:01 +00:00
Aaron Vaage 68c4445ae9 Change findAll to forEachCell
Changed |findAll| to |forEachCell| as it provides better usability in the
codebase where we would have used |findAll|.

Issue #1248
Change-Id: I6ca993ffb85aa0bf15d6ac250ac85a00e966fcbe
2018-04-11 20:16:11 +00:00
Aaron Vaage 74bf086535 Made Storage Muxer implement IDestroyable
Make storage muxer implement the IDestroyable interface so that
it can be used with |shaka.util.IDestroyable.with|.

Issue #1248
Change-Id: I6e8c71b57e939ea30d5c24c75ede9c2de80026db
2018-04-11 20:15:42 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Aaron Vaage 870a76f146 Change Storage Muxer to Express Paths as Tuple
Instead of merging the mechanism and cell names together
to make the path, use a class to hold them separately. This
will make it easier to work with the OfflineUri.

Change-Id: Ib0065e9d9a8553a90a7b4778e118dd3ca6435f32
2018-03-27 21:19:33 +00:00
Theodore Abshire f58afd21da Typo fixes and rewording in comments, part 5
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: Ibcaf21382bd78b91e589122983dd14e001bfdad5
2018-03-21 17:25:13 +00:00
Aaron Vaage af578ac627 Define Storage Muxer
Storage Muxer is responsible for finding the correct cell for a
given operations. For example, when writing new content, you need
a cell that supports add-operations, the muxer will find one.

Issue: #1248
Change-Id: Ifd9fd32f9487c0b9bc011ae8b004eec4ee75f7c4
2018-03-07 22:33:13 +00:00