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
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
Before, we simply converted each byte from an ArrayBuffer into a
character; however, this is only valid for ASCII characters. This
changes it to fully support UTF-8 encoded network responses.
Change-Id: I9c49f29b09960501d345b98aa7af1bb711972abf
This fixes small incompatibilities for IE11:
- XML parser sometimes fails by throwing rather than returning null
- bug in Promise polyfill prevented use of Promise.all([null, p])
- IE11 does not have ArrayBuffer.prototype.slice, used by integration
tests to clone a buffer in StreamGenerator
Change-Id: I9ace6bd17cd60272f85ce388342ca456f14d04c9
We will be transitioning toward a new way of documenting record
typedefs. Each record will be annotated with 'property' for each
field in the record. This results in better output from jsdoc.
This covers all internal record types. External records will be
handled in a separate CL.
Change-Id: I2ab93015bfc9db01b4b6d474b608709c99fd70cd
This also cleans up compiler errors for:
- Things required but not used
- Things used but not required
- Write-only local variables
We are suppressing the 'unnecessaryCasts' error in specific places
where it is, in fact, necessary to convert between unrelated types
for polyfills and work-alikes.
Change-Id: I155c746116f95383ea0a9caf9239fadccd8601af
This will allow support-testing to work on older browsers so that
application developers can still load the library and query for
support to show an appropriate error message.
To accomplish this, we avoid load-time uses of Function.bind, avoid
certain polyfills if modern types are not available, and compile down
to ES3 to avoid errors caused by use of the reserved word "catch" on
Promises.
This has been tested back to IE6, Safari 5.1, iOS 6.0, Firefox 6,
Chrome 15, and Opera 16.
Change-Id: I9deed106a7736758e04452ef85bae40f37c6fe62
Installation of the Promise polyfill was incomplete in compiled mode,
since static methods were not attached to the constructor by the
compiler.
Cherry-picked from v1.6.1.
Change-Id: I304662dfdb88d2fb76fc8c06a23fc6fae2f5b1f1
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
The callback given to the Promise constructor can throw. If it
does, it should reject the promise.
Change-Id: I5e21e408830271e3648bf401fdac73c44ef3cc38
This will help with porting to IE11. Chrome, Firefox, Safari, and
Edge all have native Promises.
This polyfill does not support thenables because Shaka does not use
them. Other than tests related to thenables, this polyfill passes
the A+ test suite.
It is also worth noting that this polyfill is incompatible with
native Promises, so it should not be used to replace a native
implementation or mixed with browser APIs that may use a native
implementation internally.
To safely test in Chrome, force prefixed EME (to avoid native
Promises), set window.Promise to null, then load some content in
the test app. If using a verison of Chrome after prefixed EME
was dropped, use unencrypted content.
To run the A+ test suite, compile the library, install nodejs and the
module 'promises-aplus-tests', then run ./test_promise_polyfill.js.
Inspired by pull #176
Change-Id: I0d25049f162ff7f3b57bbc795403fcdedf927262
* 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
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