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: I225f5c7e54adf4cca8512cddae082ba50ed82e4e
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: I2bfa4d531a8fcdcf9578e9c181c4534ad7443b7a
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
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
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
A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11. Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill. Applications that wish to support IE11 must now load this
additional polyfill.
We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.
One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes. To get this ability back, we are now
using the "promise-mock" module in our tests.
Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.
Closes#1260
Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict. This also fixes the
following errors:
- array-callback-return
- no-catch-shadow
- no-multi-spaces
- no-new
- no-throw-literal
- no-useless-call
- no-useless-concat
- no-useless-return
Several checks have been organized into a group of checks we should
use, but need more time to implement and fix. Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.
Issue #1157
Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.
In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).
We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.
This commit also fixes several types of eslint errors that were easy:
- no-useless-escape (unneccessary escape characters in Regexp)
- no-constant-condition (using true/false/0/1/etc in if/while)
- no-fallthrough (caught an actual bug in one EME polyfill)
- no-irregular-whitespace (we had a UTF-8 nbsp in externs)
- no-cond-assign (using an assignment inside a conditional)
To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests. We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us. But we will not use require there
because there is no deps management for test code.
Issue #1157
Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
This change enables an additional conformance check in the compiler
which prevents us from committing code where the compiler fails to
infer what "this" means.
None of these changes constituted actual bugs, just inference failures
in the compiler.
Issue #1130
Change-Id: If9b18203768e197258042a9b4339530f371ed831
SourceBuffer.remove, when told to remove exactly up to a keyframe,
will also remove that keyframe and all of the content till the next
keyframe. This results in far too much content being deleted, and is
breaking our tests on Safari 11.
Patching this by offseting the end of the removal range by 1ms seems
to be a viable workaround.
Closes#1048
Change-Id: I062b2dc2617f1372f885f4ccbc906d77c65412d7
Because Safari's support for TS via MSE is broken, reject all TS
content in Safari. Transmuxing (#887) will compensate.
https://bugs.webkit.org/show_bug.cgi?id=165342Closes#743
Change-Id: Iff8a6a7c159e48a4f388d99396915752e649c6ac
There are several issues with isTypeSupported on Chromecast that
require workarounds in JavaScript:
- Dolby Vision strings must be removed from the codecs parameter,
even though the content is supported by the platform
- HDR must be guessed at from the codecs parameter and an additional
parameter must be added to query HDR support
- Queries must be made through a non-standard interface
Change-Id: I4c8c70e70cf9c26283913783f5f62f7d6470c2f1
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
Two EME polyfills currently assume persistent storage support: one
for old Tizen TVs and other older embedded Chromium devices, and one
for IE11.
This backfires when an application is trying to detect support for
encrypted offline content.
By removing this assumption, we do not convey support for EME features
that are not known to be available on these devices.
Change-Id: If427eeda1cde60341a2b57f76744c2adfdb34beb
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
There were two instances of tests not cleaning up correctly. The
Dash Live tests didn't uninstall the Promise polyfill, which breaks
Promise.resolve for tests that don't expect it. Also, in the
CastReceiver tests, it defines a property on window. It needs to be
configurable, otherwise it cannot be set twice. Somehow the resulting
exception is not being caught by jasmine.
Change-Id: I0691a7bcddf14fd455f034d63e12fc8046044750
The Chromecast reports supporting IndexedDB but whenever an insert
command was performed, the operation would hang indefinitely.
This change introduces a pollyfill for the Chromecast that will
remove the indexed db reference which will have DBEngine's
"is supported" behavior to report no support.
Alone this change would not stop the tests from running, so the
DBEngine tests had to be updated to first check that the DEngine
is supported on the active platform.
Bug: 34927282
Change-Id: I8d4797f0981b014fb42db1c237c85704888bea7f
Now, when you pass a rejected or pending promise into Promise.resolve(),
it won't count as resolved.
Change-Id: Ib2ee6e12625753436bfeb0b418dd824df4bb422a
Safari 10 has some new MediaSource implementation bugs that need to
be worked around. This updates and refactors the polyfills for Safari
10.
Bugs filed:
https://goo.gl/qCeTZrhttps://goo.gl/rC3CLjCloses#615
Change-Id: Id694798cd083878f337c0ba6e017fcdaac3c69be
The MediaKeys polyfill for EME v0.1b may throw an exception in
webkitCancelKeyRequest. Reported by LG.
Change-Id: I87edec4868977ddaee5946c64b80724c4ed2f18e
If we use @export in the Promise polyfill, those methods will end up
attached to the polyfill namespace in the compiled code, and will also
end up in the generated externs (coming soon).
By exporting then() and catch() manually, we avoid this.
Change-Id: Ib12b4d9319452ceed802c8fdc8c47d9c09dd24a5
The interfaces for these polyfill types were not fully implemented
because we do not use every part of the interface in the library.
A newer version of the compiler is stricter about this.
Change-Id: I5164717159544a62640b14aca1a2c7b2d44a33ba
Forcing the use of the Promise polyfill allows us to remove the hacky
parts of fakeEventLoop and gives a huge boost in speed for the tests
that use it, particularly on Edge where the delays were large. Many
fakeEventLoop tests can now run synchronously.
Time to run tests in our lab before this change:
- Edge: 21 minutes
- Safari: 6 minutes
- Chrome, Firefox, Opera, IE: 6-7 minutes
Time to run tests in our lab after this change:
- All browsers: 5-6 minutes
This also reduces the incidence of Safari failures in our lab, but
that issue does not reproduce on other machines. It looks
increasingly likely that our lab machine is faulty and needs to be
replaced.
Change-Id: I7bdcc6830c8fdf298538ce6538b1ca8e1b92cab2
This adds a polyfill for a Safari 9 MediaSource bug where calling
abort() on SourceBuffer causes the decoder to fail.
The reason we call abort() at all is to reset the decoder and smooth
segment transitions on Chrome, Firefox, and Opera. Safari does not
seem to have this problem in the first place, so it is fine to
completely stub out abort().
Issue #446
Change-Id: Icbaaa3e9ce5372efdee937ddc4cf94a27dce6a47
Newer closure compilers do not seem to recognize the MediaKeys
polyfill classes namespaces because they don't follow normal
conventions. This leads to errors about missing requires.
This renames the classes as follows:
PatchedMediaKeys.nop => PatchedMediaKeysNop
PatchedMediaKeys.v01b => PatchedMediaKeysWebkit
PatchedMediaKeys.v20140218 => PatchedMediaKeysMs
The new names follow normal conventions and refer to the polyfills by
the prefix of the old API rather than by the version number.
This should help us upgrade to a newer compiler.
Closes#456
Change-Id: I5491ecb9a61e2b456ba8fa81a6adb6c110c96817
The EME spec has updated and clarified forEach such that we need to
swap the argument order again.
Change-Id: Ida18195fcccc79d4b32a0def0ff82dfad8b88856
- 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
This fixes DrmEngine integration tests on IE 11 by:
- fixing key status for persistent policies in the IE 11 polyfill
- fixing test flow for persistent policies
Key status is still broken on Edge 13
Change-Id: If1a1abf53f24cdb31260569603bb5b2886fade43
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
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
Fixes the following issues:
=====
lib/player.js:106: ERROR - Property id never defined on TextTrack
lib/util/xml_utils.js:42: ERROR - inconsistent return type
found : (Node|null)
required: (Element|null)
lib/dash/content_protection.js:256: ERROR - Parameter must have JSDoc.
function(element) {
lib/dash/content_protection.js:284: ERROR - Parameter must have JSDoc.
function(elem) {
lib/media/drm_engine.js:47: ERROR - Private property configuration_ is never read
lib/polyfill/patchedmediakeys_20140218.js:269: ERROR - Private property keySystem_ is never read
lib/polyfill/patchedmediakeys_20140218.js:389: ERROR - Private property type_ is never read
lib/util/language_utils.js:84: ERROR - The value 0.0 is duplicated in this enum.
MIN: 0, MAX: 2
lib/util/language_utils.js:84: ERROR - The value 2.0 is duplicated in this enum.
MIN: 0, MAX: 2
demo/assets.js:171: ERROR - Value assigned to local variable headers is never read
lib/dash/content_protection.js:188: ERROR - Value assigned to local variable repUnknown is never read
lib/dash/dash_parser.js:400: ERROR - Value assigned to local variable suggestedDelay is never read
lib/dash/segment_base.js:41: ERROR - Value assigned to local variable SegmentBase is never read
lib/dash/segment_template.js:291: ERROR - Value assigned to local variable periodStart is never read
lib/media/drm_engine.js:172: ERROR - Value assigned to local variable onEncrypted is never read
test/dash_parser_live_unit.js:358: ERROR - Value assigned to local variable manifest is never read
test/drm_engine_unit.js:383: ERROR - Value assigned to local variable cert1 is never read
test/drm_engine_unit.js:384: ERROR - Value assigned to local variable cert2 is never read
test/media_source_engine_unit.js:24: ERROR - Value assigned to local variable dummyData is never read
test/media_source_engine_unit.js:504: ERROR - Value assigned to local variable p2 is never read
test/media_source_engine_unit.js:505: ERROR - Value assigned to local variable p3 is never read
test/media_source_engine_unit.js:506: ERROR - Value assigned to local variable p4 is never read
test/media_source_engine_unit.js:535: ERROR - Value assigned to local variable p2 is never read
test/media_source_engine_unit.js:601: ERROR - Value assigned to local variable p2 is never read
test/media_source_engine_unit.js:602: ERROR - Value assigned to local variable p3 is never read
test/media_source_engine_unit.js:603: ERROR - Value assigned to local variable p4 is never read
test/media_source_engine_unit.js:632: ERROR - Value assigned to local variable p2 is never read
test/mpd_utils_unit.js:20: ERROR - Value assigned to local variable HUGE_NUMBER_STRING is never read
test/streaming_engine_integration.js:55: ERROR - Value assigned to local variable onSeek is never read
test/streaming_engine_unit.js:1263: ERROR - Value assigned to local variable reportedContentType is never read
test/streaming_engine_unit.js:1264: ERROR - Value assigned to local variable reportedPeriodIndex is never read
test/streaming_engine_unit.js:1540: ERROR - Value assigned to local variable size is never read
test/util/dash_parser_util.js:77: ERROR - Value assigned to local variable retry is never read
test/util/dash_parser_util.js💯 ERROR - Value assigned to local variable retry is never read
test/vtt_text_parser_unit.js:272: ERROR - Value assigned to local variable result is never read
Change-Id: I707700250541e04ccbfe81d7298b3f0c5a82dcdc
This broke in 9d70cad0 when we simplified FakeEvent and
FakeEventTarget. Now that FakeEvents are no longer based on real
Events, we cannot dispatch a FakeEvent from a real EventTarget on
IE.
Change-Id: I81635ef40ac627cf757a87c12b3a5a94068a0ad8