Make Float64Array mock more accurately handle its arg signature.

This commit is contained in:
John-David Dalton
2014-07-22 22:53:38 -07:00
parent dd05e898cc
commit f513effd47
2 changed files with 6 additions and 2 deletions

View File

@@ -146,7 +146,9 @@
if (!window.Float64Array && window.Uint8Array) {
Float64Array = (function() {
function Float64Array(buffer, byteOffset, length) {
return new Uint8Array(buffer, byteOffset || 0, length || buffer.byteLength);
return arguments.length == 1
? new Uint8Array(buffer)
: new Uint8Array(buffer, byteOffset || 0, length || buffer.byteLength);
}
setProperty(Float64Array, 'BYTES_PER_ELEMENT', 8);
setProperty(Float64Array, 'toString', createToString('Float64Array'));

View File

@@ -413,7 +413,9 @@
if (!root.Float64Array) {
setProperty(root, 'Float64Array', (function() {
function Float64Array(buffer, byteOffset, length) {
return new Uint8Array(buffer, byteOffset || 0, length || buffer.byteLength);
return arguments.length == 1
? new Uint8Array(buffer)
: new Uint8Array(buffer, byteOffset || 0, length || buffer.byteLength);
}
setProperty(Float64Array, 'BYTES_PER_ELEMENT', 8);
setProperty(Float64Array, 'toString', createToString('Float64Array'));