This changes the eslint rule to enforce a strict pattern for the
argument comments. The comment must appear before the argument and
must be /* foo= */. This still ignores line comments.
Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
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
According to RFC 3986, URL schemes should be case-insensitive. Our
scheme plugin map is registered with exclusively-lowercase scheme
names, so we should convert the input scheme to lowercase before
looking up the plugin.
Closes#2173
Change-Id: I78218c18d3df154aabd101a9ef5fd3156d0c57a8
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer. This also adds some utilities for changing between
views and buffers.
Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views". This audits and fixes the
usages of the "buffer" property to ensure correct usage.
It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.
Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
This allows a request/response filter to determine which EME session
made the request. This also changes the session ID of FairPlay sessions
so they are available too.
Issue #1951
Change-Id: I1a07abae6faf4a87fad7b5d4290a00b25e83da8e
This makes progress callbacks into a required parameter on all network
scheme plugins. This does not mean that every plugin must make use of
the callback, but every caller must supply the callback.
In production, NetworkingEngine already supplies this callback
universally, so our HTTP plugins make use of it whenever progress data
is available.
Our tests, however, did not always supply this callback, leading to
test failures. These failures were more likely to show up in Jasmine
3 than Jasmine 2 for some reason, which caused us to downgrade back to
Jasmine 2 recently.
By making the callback required, we can clean up this inconsistency
between test and production and give the HTTP plugins what they expect
in all cases.
Issue #1949
Change-Id: I8a6e1904e73cf7ca6ae8f3964261c339f404854d
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
The numBytesRemainingObj parameter in |NetworkingEngine.send_| was
optional, but in some circumstances we were assuming that it was set.
This just changes the parameter to be non-optional.
In fact, the parameter now being non-optional revealed an error that
caused the numBytesRemainingObj to be lost on network retry.
Fixes#1930
Change-Id: I74f24309f859f975f51e20455739b806ed3f4ecd
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.
Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
This is an automated change to convert use of "function" functions
to arrow functions. This doesn't change all uses of bind() that
could be converted. This also doesn't remove all "function" functions.
Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
This was caught by a newer compiler release. These were missed in the
last audit we did before releasing v2.5.0.
Change-Id: I4abd29e965c95b56eb83c61294f8a7dbaacae990
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
We get an error from ReadableStream when we abort a request. This
causes uncaught rejection error logs in Chrome. This ignores the
error and stops the logs.
Change-Id: I0f339e73564ac42b28ea8b7d0bf12ffb8c2ec9cc
When the network becomes slow, we check if stopping the current request
and download the content with lower resolution is faster. If so, abort
the current request and start a new one.
Issue #1051
Change-Id: I588e524469432e362361d1cfbde6cd45c2009959
This CL limits the use of |setTimeout| by wrapping it in our own timer
class. The timer class makes it easier to track and cancel time-based
events.
To ensure that|setTimeout| is not used outside of our timer classes, the
conformance rules have been updated to only allow |setTimeout| to be
used by our timer classes.
Since |setTimeout| is very similar to |setInterval|, the conformance
rules for |setInternal| rules were updates to reflect more of the logic
behind why we don't want to use |setTimeout| and |setInterval| directly.
Change-Id: Iff5da32a61b515dd2016837fa74a34c04b6c5fd2
This integrates the deprecation tool with our library and updates
all the deprecated warnings to use our new tool.
As some features needed to be removed in 2.5, this change removes them
since their deprecation checks would make us fail.
Change-Id: I28310bbe9df6839719f4763a96026d5968bdcea6
If we use sets for filters in networking engine we get some
pretty good additions:
1. Someone can't double-register their listener (by accident)
2. We don't need ArrayUtils to remove listeners.
Change-Id: I5115b9488d43f0bcd64fcc1a11133d5a49ad3d3a
On Edge, window.ReadableStream exists, but attempting to call it
results in an error.
This changes the support check for Fetch to try actually creating a
ReadableStream before it OKs using Fetch.
Change-Id: Iab6ea2c459fe536ac51796808cb56c4c54dd4312
In a recent CL, the Http Fetch plugin was modified to make use of
ReadableStream. However, ReadableStream isn't available on every
platform. This change modifies the Fetch plugin to not be used if
ReadableStream isn't defined.
This also adds a basic mock ReadableStream for tests.
Change-Id: I7554298779040ce0cef1b8ad55c3ee113f932954
This is part 1 of conditionally aborting requests when network
downgrading.
1. Add progress event handler for Http XHR Plugin, to get more frequent
updates for network bandwidth estimate and suggest streams based on
that.
2. When the plugin doesn't support progress event, call
onProgressUpdated function after every segment is downloaded.
3. Replace onSegmentDownloaded with onProgressUpdated function in
player.js and network_engine.js.
4. Since XHR Plugin supports progress event while Fetch doesn't, change
the config to prefer XHR over Fetch API.
Issue #1051.
Change-Id: Icf6775dd3520fb2e359b13d29e3b39d3792fe865
There is now a separate server URL for 'individualization-request'
messages; if it isn't given, it will fallback to the license server.
There is also a new field in the Request object so a request filter
can act differently based on the message type.
Closes#1565
Change-Id: I970a8651ef05ec533d9fd41841cb52021e3c0489
This makes NetworkingEngine a FakeEventTarget, and gives it a 'retry'
event which is fired when there is a recoverable error that results in
a retry.
Closes#1529
Change-Id: I0c15ed20f4d6abf971d280263c6d62841daf440e
Previously, HttpFetchPlugin would treat any non-Shaka error as
HTTP_ERROR when there were potentially other circumstances which
could have produced a non-Shaka error.
This change catches errors from fetch sooner, so that there is no
need to do a fuzzy check for error.severity. It also clears the
request timeout regardless of whether fetch throws or not.
Closes#1519
cloneObject used to be part of config_utils.js.
This meant that a number of classes that didn't actually use
config objects required ConfigUtils.
This moves cloneObject into the new ObjectUtils, to clarify that.
Change-Id: I92d630eba8798b3e2671dcce95b61f44282b05e7
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
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
- Translate uncaught Promise rejections into test failures
(Chrome only until the event is more widely implemented)
- Clean up uncaught Promise rejection caused by exceptions thrown
after destroy() in:
- CastProxy
- CastReceiver
- NetworkingEngine
- StreamingEngine
- Clean up uncaught Promise rejection caused by test cases in:
- CancelableChain unit tests
- DrmEngine unit tests
- StreamingEngine unit and integration tests
- Player unit and integration tests
- Speed up rejection in NetworkingEngine when we should not retry
- Add --delay-tests to test.py, to aid in debugging uncaught
Promise rejections and other types of async test pollution
Closes#1323
Change-Id: I5a8f5702a22430929babeb071bf6650c52c5ad17
Catch BAD_HTTP_STATUS error thrown by makeResponse in xhr.onload
Also wrap mock XHR event handlers in try-catch blocks in
http_plugin_unit to avoid regression.
Resolves#1302
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: I475eba0a477d13cd9201c88ad44899d521ad8991
Fetch requests with a method of GET or HEADER cannot have a body, or
else the request will fail. Normally we had no problems with this, but
it turns out that Edge counts a body of 'null' as being defined.
This changes the Fetch scheme plugin so that it will replace null with
undefined for the body in the init data.
This also makes it so that HTTP_ERROR errors emitted by the http
plugin will include the original error, to aid in debugging future
issues.
Change-Id: I0531656dada25f97ef610d4285c225d57d7ef262