This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function apply() {
1010 // Note: EventTarget is not available in all browsers,
1111 // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
1212 } else {
13- var apis = [
13+ var apis = [
1414 'ApplicationCache' ,
1515 'EventSource' ,
1616 'FileReader' ,
@@ -25,24 +25,29 @@ function apply() {
2525 'TextTrackCue' ,
2626 'TextTrackList' ,
2727 'WebKitNamedFlow' ,
28- 'Window' ,
2928 'Worker' ,
3029 'WorkerGlobalScope' ,
3130 'XMLHttpRequest' ,
3231 'XMLHttpRequestEventTarget' ,
3332 'XMLHttpRequestUpload'
3433 ] ;
3534
36- apis . forEach ( function ( thing ) {
37- var obj = global [ thing ] && global [ thing ] . prototype ;
35+ apis . forEach ( function ( api ) {
36+ var proto = global [ api ] && global [ api ] . prototype ;
3837
3938 // Some browsers e.g. Android 4.3's don't actually implement
4039 // the EventTarget methods for all of these e.g. FileReader.
41- // In this case, there is nothing to patch.
42- if ( obj && obj . addEventListener ) {
43- utils . patchEventTargetMethods ( obj ) ;
40+ // In this case, there is nothing to patch.
41+ if ( proto && proto . addEventListener ) {
42+ utils . patchEventTargetMethods ( proto ) ;
4443 }
4544 } ) ;
45+
46+ // Patch the methods on `window` instead of `Window.prototype`
47+ // `Window` is not accessible on Android 4.3
48+ if ( typeof ( window ) !== 'undefined' ) {
49+ utils . patchEventTargetMethods ( window ) ;
50+ }
4651 }
4752}
4853
You can’t perform that action at this time.
0 commit comments