2
2
* @param {Object } object
3
3
* @private
4
4
*/
5
- function proxyWebkitMethods ( object ) {
5
+ function proxyWebkitProperties ( object ) {
6
6
var isWebkit = / ^ w e b k i t / ;
7
- Object . getOwnPropertyNames ( object . prototype ) . forEach ( function ( method ) {
8
- if ( isWebkit . test ( method ) ) {
9
- object . prototype [ method [ 6 ] . toLowerCase ( ) + method . slice ( 7 ) ] = object . prototype [ method ] ;
7
+ Object . getOwnPropertyNames ( object . prototype ) . forEach ( function ( property ) {
8
+ if ( isWebkit . test ( property ) ) {
9
+ Object . defineProperty ( object . prototype , property [ 6 ] . toLowerCase ( ) + property . slice ( 7 ) , {
10
+ get : function ( ) { return this [ property ] ; } ,
11
+ set : function ( value ) { this [ property ] = value ; }
12
+ } ) ;
10
13
}
11
14
} ) ;
12
15
}
@@ -21,9 +24,9 @@ function checkFileAPI() {
21
24
window [ 'FileReader' ] = window [ 'FileReader' ] || window [ 'webkitFileReader' ] || undefined ;
22
25
23
26
if ( Blob && File && FileReader ) {
24
- proxyWebkitMethods ( window [ 'Blob' ] ) ;
25
- proxyWebkitMethods ( window [ 'File' ] ) ;
26
- proxyWebkitMethods ( window [ 'FileReader' ] ) ;
27
+ proxyWebkitProperties ( window [ 'Blob' ] ) ;
28
+ proxyWebkitProperties ( window [ 'File' ] ) ;
29
+ proxyWebkitProperties ( window [ 'FileReader' ] ) ;
27
30
28
31
return true ;
29
32
} else {
@@ -39,7 +42,7 @@ function checkDataViewAPI() {
39
42
window [ 'DataView' ] = window [ 'DataView' ] || window [ 'webkitDataView' ] || undefined ;
40
43
41
44
if ( DataView ) {
42
- proxyWebkitMethods ( window [ 'DataView' ] ) ;
45
+ proxyWebkitProperties ( window [ 'DataView' ] ) ;
43
46
44
47
return true ;
45
48
} else {
0 commit comments