Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/polyfill/chrome-polyfill.js

Issue 2546853003: Add W3C encrypted-media tests (Closed)
Patch Set: rebase now that content files landed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 (function(){
2 if( navigator.userAgent.toLowerCase().indexOf('edge') === -1
3 && navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
4
5 if ( ( /chrome\/([0-9]*)\./.exec( navigator.userAgent.toLowerCase() )[1] | 0 ) < 54 ) {
6
7 // Work around https://bugs.chromium.org/p/chromium/issues/detail?id =622956
8 // Chrome does not fire the empty keystatuschange event when a sessi on is closed
9 var _mediaKeySessionClose = MediaKeySession.prototype.close;
10 var _mediaKeySessionKeyStatusesGetter = Object.getOwnPropertyDescrip tor( MediaKeySession.prototype, 'keyStatuses' ).get;
11 var _emptyMediaKeyStatusMap = { size: 0,
12 has: function() { return false; } ,
13 get: function() { return undefine d; },
14 entries:function() { return []; }, // this may not be correct, I think it should be some iterator thing
15 keys: function() { return []; },
16 values: function() { return []; },
17 forEach:function() { return; } };
18
19 MediaKeySession.prototype.close = function close()
20 {
21 this.__closed = true;
22
23 setTimeout( function() {
24 this.dispatchEvent( new Event( 'keystatuseschange' ) );
25 }.bind( this ), 0 );
26
27 return _mediaKeySessionClose.call( this );
28 };
29
30 Object.defineProperty( MediaKeySession.prototype, 'keyStatuses', { g et: function() {
31
32 return this.__closed ? _emptyMediaKeyStatusMap : _mediaKeySessio nKeyStatusesGetter.call( this );
33
34 } } );
35 }
36 }
37 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698