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
Google style guide requires adding curly braces to all block statements
even if it is only has one line. This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.
Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
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: Ib137fbfde50f1330c74c040fc062aa8e2c6d1e57
When DBEngine aborts because of an upgrade, include a list of the
original uris for all downloaded content.
This will allow apps to re-download the content if they choose to.
Change-Id: Ic2029d935dd8da60c0d502cd0cdbb08b38bbbe76
This removed all of DBUpgrade (lib and test) as it was not accomplishing
its requirements.
Now instead, if DBEngine detects that there needs to be an upgrade, it will
abort the upgrade and message the app with |UNSUPPORTED_UPGRADE_REQUEST|.
Change-Id: If65bc013b0482c9b0c6e71e644e9132584984414
Edge does not like it when we delete the old stores in the
database when upgrading. Since this can't seem to be worked
around, instead of delete the store, just clear it.
This will leave two empty stores in the database, but since
they will be empty, they should not waste any space.
Change-Id: I11d5b8b105b34277d92e9c1f7f83b36fc6171960
Added a DB Upgrade path for converting content from version 1
to the version 2 format.
Issue #1047
Change-Id: Id8dc626d8289b08ca300c40b137173c0c6ec9d35
externs/shaka/offline.js now represents the data types for Shaka Player
Offline V2. All offline shaka player code uses the new version and all
V1 and transitional code has been removed.
Issue #1047
Change-Id: Ia43f8d8d11426e823629e5fcd27c4e1e0ce400d3
Changed our stores in IndexedDB to use auto increment for the keys
so that we no longer need to track current ids anymore.
Issue #1047
Change-Id: I765ba19810fce03ec8e4d968cbf8cf383355be6d
Create the pattern for how to handle database upgrades. As of this
change the only upgrade supported is from version 0 (no database).
Issue #1047
Change-Id: I9f889a9e39a190e926cf06f0720a5371bc3c59af
Removed the reserve id from storage engine. Now adding an item to a
storage engine will return a promise that resolves with the id it
was stored under.
Change-Id: Id4d2c4c51a359593f1308aeb5fe580ab460ebeb8
Before we added variants, there was no variant ids field on
StreamDB. To support legacy downloads, we created variants
for streams with no variantIds.
This change moves that conversion into DBEngine so that outside
DBEngine, streams will always have variantIds.
Change-Id: I85d050dac0b5f82fe00947380587dd7af4401dee
Changed the Storage Engine interface to know about the types that it
is expected to store. This allow the implementation to do more internally
as the scope of the object has been limited.
Change-Id: I388e2bde5e7e3f99e8b28bd16e08a8f6d5fc6453
This is part of adding a new conformance rule to add additional type
safety. This will disallow using properties of unknown types or using
unknown properties.
The first parts will be fixing errors caused by the new rule. These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.
Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
After looking into the speeds for removing data from IndexedDB, it was
found that using a cursor was slower than the other methods. This change
takes the remove logic and changes it to remove each key as part of
one transaction.
Closes#756
Change-Id: Iec3916650d8a4fe2b6353b604c070d8a0af7426c
On android the quota for offline content is much smaller than on
desktop. It was observed that when this quote was exceeded that
downloading offline content would stall but not throw and error.
It was found that instead of an error, IndexDB called onabort for
the transaction.
To fix this we now route onabort through the same code path as
onerror so that the abort will be treated and communicated as an
error back to the application.
Closes#747
Change-Id: I10d536a4edc29d51790f0588f6163a5d83eccf33
This adds a severity field to Error objects. This can be used to
detect whether an error is recoverable. All the same errors are still
reported so the field can be ignored.
There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
load() again
Closes#564
Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
This implements the workaround for a race in IndexedDB on IE/Edge.
If we don't get an 'upgradeneeded' event when we expect it, we will
close the connection and retry.
b/35993864
Change-Id: I78d1c18e4798c098167a1a6a184623780002a34f
On IE/Edge, it is possible for the IndexedDB database to not be deleted
when the success callback is fired. If we immediately create a new
connection to that database, it will connect to the old database. Once
the database is deleted, the connection will no longer have the data.
This adds some assertions that we get an upgrade event. This also adds
the framework for the workaround, but doesn't add it so we can give
this revision in the bug report. This deliberately increases the
failure rates on IE/Edge.
b/35993864
Change-Id: I3d142bdee6386fbe63f1b2def462a0e039723a38
To better support alternate storage mechanisms, this change abstracts
shaka.offline.DBEngine into an interface called
shaka.offline.IStorageEngine.
DBEngine has been changed to implement this interface, and allows the
addition of implementations that do not use IndexedDB.
Change-Id: I6a94067001ee53049df11cb68604bb57912300bb
This is part of the v2 equivalent of the ContentDatabase. This only
manages low-level interactions with the IndexedDB and wraps all
actions in Promises.
This also adds an in-memory version that is used for testing.
Issue #343
Change-Id: I0d296639e74c1d4cab232ce7248b03a353b38b3c