Skip to content

Commit

Permalink
additional fix for iOS Safari ~ 7.1.2 DataView#{setUint8, setInt8}
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 24, 2015
1 parent df89af8 commit bdc9941
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions library/modules/_typed-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ if(!$typed.ABV){
if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
}
// iOS Safari 7.x bug
var view = new $DataView(new $ArrayBuffer(8))
var view = new $DataView(new $ArrayBuffer(2))
, $setInt8 = $DataView[PROTOTYPE].setInt8;
view.setInt8(0, 2147483649);
view.getInt8(0) || redefineAll($DataView[PROTOTYPE], {
view.setInt8(0, 2147483648);
view.setInt8(1, 2147483649);
if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
setInt8: function setInt8(byteOffset, value){
$setInt8.call(this, byteOffset, value << 24 >> 24);
},
Expand Down
7 changes: 4 additions & 3 deletions modules/_typed-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ if(!$typed.ABV){
if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer;
}
// iOS Safari 7.x bug
var view = new $DataView(new $ArrayBuffer(8))
var view = new $DataView(new $ArrayBuffer(2))
, $setInt8 = $DataView[PROTOTYPE].setInt8;
view.setInt8(0, 2147483649);
view.getInt8(0) || redefineAll($DataView[PROTOTYPE], {
view.setInt8(0, 2147483648);
view.setInt8(1, 2147483649);
if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], {
setInt8: function setInt8(byteOffset, value){
$setInt8.call(this, byteOffset, value << 24 >> 24);
},
Expand Down

0 comments on commit bdc9941

Please sign in to comment.