This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function apply() {
10
10
// Note: EventTarget is not available in all browsers,
11
11
// if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
12
12
} else {
13
- var apis = [
13
+ var apis = [
14
14
'ApplicationCache' ,
15
15
'EventSource' ,
16
16
'FileReader' ,
@@ -25,24 +25,29 @@ function apply() {
25
25
'TextTrackCue' ,
26
26
'TextTrackList' ,
27
27
'WebKitNamedFlow' ,
28
- 'Window' ,
29
28
'Worker' ,
30
29
'WorkerGlobalScope' ,
31
30
'XMLHttpRequest' ,
32
31
'XMLHttpRequestEventTarget' ,
33
32
'XMLHttpRequestUpload'
34
33
] ;
35
34
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 ;
38
37
39
38
// Some browsers e.g. Android 4.3's don't actually implement
40
39
// 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 ) ;
44
43
}
45
44
} ) ;
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
+ }
46
51
}
47
52
}
48
53
You can’t perform that action at this time.
0 commit comments