Commit Graph

90 Commits

Author SHA1 Message Date
Joey Parrish 84a8d1ca18 Polyfill the HTML5 'input' event
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
2017-07-12 12:29:14 -07:00
Joey Parrish c69a009960 Do not assume persistent storage support
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
2017-07-12 18:46:08 +00:00
Jacob Trimble adb8da4764 Disallow unknown properties (1/5).
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
2017-06-27 19:43:00 +00:00
Joey Parrish 53220b5acb Polyfill video.play to silence confusing errors
Closes #836

Change-Id: Ie5b42bc707ce7443641e86c04ec116fd732bbbae
2017-06-05 12:34:31 -07:00
iKinnrot f145dffc9e Fix math round when number > 2^52 on IE11 (#832)
Don't use math round on ie11 if number > 2^52.
2017-06-02 14:51:25 -07:00
Joey Parrish 2f5e2dbc5b Fix declaration of unprefixed v0.1b APIs
Change-Id: I0334b08d5e67320f19f6df78fb1271278b9d3078
2017-05-17 16:28:23 +00:00
Joey Parrish afb3a634b6 Update EME polyfills setServerCertificate to spec
The method should return a Promise resolved with false if unsupported.

Change-Id: I304f2566fc2cf6521eb35f963d7c862e3eca1f48
2017-05-08 23:37:08 +00:00
Ross-cz 3831664a22 Fix fullscreen polyfill for MSIE 11 (#777) 2017-05-05 15:35:27 -07:00
Jacob Trimble 67c874c2ca Fix some test contaminations.
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
2017-03-28 12:16:08 -07:00
Theodore Abshire 8ab9188bdb Expanded the fullscreen polyfill.
Now it includes fullscreenEnabled.

Closes #669

Change-Id: I7df3c422ecc72215a48ba72ac57aae2bc9b600d5
2017-02-10 22:05:31 +00:00
Aaron Vaage f0286ae7f8 Fixing DBEngine Failures on Chromecast
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
2017-02-08 00:04:23 +00:00
Jozef Chutka ca299b2822 VTTCue polyfill (#643)
This adds a VTTCue polyfill for IE/Edge (3-arg TextTrackCue) and
Toshiba dTV (6-arg TextTrackCue).

Closes #635
2017-01-17 10:42:54 -08:00
Theodore Abshire 292fd9a0db Fixed a bug with resolve in the promise polyfill.
Now, when you pass a rejected or pending promise into Promise.resolve(),
it won't count as resolved.

Change-Id: Ib2ee6e12625753436bfeb0b418dd824df4bb422a
2017-01-09 21:10:32 +00:00
Jozef Chutka be0d4b56cb Add support for Toshiba dTV (#605)
Toshiba has EME v0.1b, but without the webkit prefix.  This generalizes
the WebKit MediaKeys polyfill to work with or without a prefix.
2016-12-14 09:53:29 -08:00
Joey Parrish 5963e0ddd4 Update MediaSource polyfills for Safari 10
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/qCeTZr
  https://goo.gl/rC3CLj

Closes #615

Change-Id: Id694798cd083878f337c0ba6e017fcdaac3c69be
2016-12-05 19:43:10 +00:00
Joey Parrish 09d221de16 Update the Closure Compiler to v20161024
Change-Id: I6642b1e386667028c1adbcce97ab64b21a9104b9
2016-11-11 22:08:43 +00:00
Joey Parrish 894c56d3c9 Remove suppression of "unnecessaryCasts"
This no longer seems to be needed.

Change-Id: I8f9ed03f97b235d4652930745d4416f6c8f77445
2016-11-04 19:40:55 +00:00
Joey Parrish 2ba7427111 Eat exceptions thrown by webkitCancelKeyRequest
The MediaKeys polyfill for EME v0.1b may throw an exception in
webkitCancelKeyRequest.  Reported by LG.

Change-Id: I87edec4868977ddaee5946c64b80724c4ed2f18e
2016-10-25 23:32:00 +00:00
Joey Parrish 8ec7164878 Do not export any part of the Promise polyfill
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
2016-09-30 16:54:43 +00:00
Joey Parrish ef6a7f9e3a Fill out interfaces in MediaKeys polyfill
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
2016-09-29 16:25:34 -07:00
Joey Parrish 1ba2ebb23e Simplify and speed up fakeEventLoop with polyfill
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
2016-08-18 19:51:48 +00:00
Jacob Trimble 858499f09f Added unit tests for Promise polyfill.
Closes #212

Change-Id: I33e40269c6cd1aeb051ae69e96fbcaf0d0a02ed7
2016-08-15 09:16:04 -07:00
Joey Parrish 8c7c74e950 Polyfill Safari 9 MediaSource bugs
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
2016-07-29 18:42:31 +00:00
Joey Parrish 9576c5b2cb Rename MediaKeys polyfills
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
2016-07-24 16:27:40 -07:00
Joey Parrish b1141d5693 Swap MediaKeyStatusMap.forEach argument order
The EME spec has updated and clarified forEach such that we need to
swap the argument order again.

Change-Id: Ida18195fcccc79d4b32a0def0ff82dfad8b88856
2016-07-01 17:50:53 +00:00
Andy Hochhaus 87a62d717e Add missing goog.require() dependencies 2016-06-25 15:45:15 -07:00
Joey Parrish b8ccc02320 Fix support test on old browsers
- 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
2016-04-07 20:51:24 +00:00
Joey Parrish b214827785 Add partial support for thenables
Fixes test failures on IE11 since test utils now use thenables

Change-Id: I53d81367716839d419ee9ee6d865ce68405a7623
2016-03-29 23:57:01 +00:00
Joey Parrish 428e79a546 Fix DrmEngine integration on IE 11
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
2016-03-16 23:14:48 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
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
2016-03-11 15:29:20 -08:00
Jacob Trimble 846e7beb48 Unified comment spacing.
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
2016-03-10 16:27:45 -08:00
Joey Parrish 78e996d090 Fix issues found by the newest Closure compiler
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
2016-03-03 16:04:58 -08:00
Joey Parrish bdb35f5952 Fix IE EME polyfill WRT event dispatch
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
2016-03-01 11:25:29 -08:00
Joey Parrish 09bb56164a Do not export individual polyfill docs
Also corrects duplicate Promise entry.

Change-Id: I7d675b0e8bbcbcb1dc1508f3c08e0a3811149d63
2016-03-01 17:51:14 +00:00
Joey Parrish 9d70cad0ea Simplify FakeEvent and FakeEventTarget
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
2016-02-29 17:58:55 +00:00
Joey Parrish d0701d525c DrmEngine integration tests and associated fixes
- Update MediaKeyStatusMap definitions
 - Remove MediaKeyStatusMap iterators (not present in Edge)
 - Work around MediaKeyStatusMap interop issues
 - Update MSMediaKeys definitions (stricter on Edge 12 than IE 11)
 - Add onKeyStatus callback from DrmEngine and associated unit tests
 - Unpack PlayReady license requests
 - Byte-swap Edge 13 key IDs
 - Fix nullability of types in NetworkingEngine
 - Skip all DrmEngine integration tests unless either Widevine or
   PlayReady are available.

Change-Id: I49cbcdb5f82afa9a70a127601b195cf0794e1181
2016-02-22 16:23:33 -08:00
Jacob Trimble 49b238b3c9 Fix support for UTF-8 encoded data.
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
2016-02-23 00:12:43 +00:00
Joey Parrish 813b746160 DrmEngine and associated tests
This is mostly complete, but needs additional integration with an
as-yet-unwritten AbrManager.

Change-Id: I3836040c6891fb774be800b53679f49e365c7e1c
2016-02-12 16:06:31 -08:00
Joey Parrish 069e5eda3b Sync Promise polyfill with master branch
Several fixes were made recently for v1.6.3

Change-Id: I20ffc0f647973962839d8b5322bfbf331880aa34
2016-02-12 22:02:49 +00:00
Jacob Trimble 47a99253b0 Polyfills now register as plugins.
Change-Id: I498bda84d92f2c733f120e1b1c5a0ccae305ba15
2016-02-02 12:11:49 -08:00
Joey Parrish 18678f2492 Fix IE11 test failures
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
2016-01-29 09:18:07 -08:00
Joey Parrish 3bb8f06b7d Require assertion messages
This will enforce messages on assertions, which should make console
logs more useful.

Change-Id: I2cff9e20f630d1d4d46192e2ee317b1942cc7188
2016-01-08 13:29:56 -08:00
Joey Parrish e798f060dc Add property docs to internal typedefs
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
2016-01-04 12:36:44 -08:00
Joey Parrish 6876ee08cc Use navigator instead of Navigator.prototype
This fixes support checks on Chrome 26, 27, and 28,
and Opera 15.

Change-Id: Ib33ca28754153679bda41fc3c2f6a37a93ed2c99
2015-12-15 17:37:29 +00:00
Joey Parrish 1d1a0fcb46 Enable all compiler errors
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
2015-12-11 13:30:44 -08:00
Joey Parrish 3e7014db2b Fix library load and polyfill for old browsers
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
2015-12-10 10:49:45 -08:00
Joey Parrish a4b947c9a4 Add @struct to @constructors
Change-Id: I0c4f0468cc0f7632c71ec15e458c9a1d84a2c2af
2015-12-07 18:04:55 +00:00
Joey Parrish 316e4c291f Fix compiled Promise polyfill
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
2015-12-06 22:45:56 +00:00
Joey Parrish fff5dd7ee7 Audit exports
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
2015-12-01 13:56:37 -08:00