Skip to content

Commit 1ef3b53

Browse files
committed
fix DataView on node 0.10
1 parent 5abeabe commit 1ef3b53

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

support/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function isDataViewToString(value) {
309309
isDataViewToString.working = (
310310
typeof ArrayBuffer !== 'undefined' &&
311311
typeof DataView !== 'undefined' &&
312-
isDataViewToString(new DataView(new ArrayBuffer()))
312+
isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
313313
);
314314
function isDataView(value) {
315315
if (typeof DataView === 'undefined') {

test/node/types.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ for (var _i = 0, _arr = [
8282
value: 'foo'
8383
});
8484
}, 'isUint8Array'],
85-
[function () { return new DataView(new ArrayBuffer(1)); }, 'isDataView'],
85+
[function () { return new DataView(new ArrayBuffer(1), 0, 1); }, 'isDataView'],
8686
[function () { return new SharedArrayBuffer(); }, 'isSharedArrayBuffer'],
8787
// [ new Proxy({}, {}), 'isProxy' ],
8888
[function () { return new WebAssembly.Module(wasmBuffer); }, 'isWebAssemblyCompiledModule']
@@ -170,7 +170,7 @@ if (SymbolToStringTagSupported) {
170170
var arrayBuffer = function arrayBuffer() { return new ArrayBuffer(1); };
171171

172172
var buffer = function buffer() { return Buffer.from(arrayBuffer()); };
173-
var dataView = function dataView() { return new DataView(arrayBuffer()); };
173+
var dataView = function dataView() { return new DataView(arrayBuffer(), 0, 1); };
174174
var uint8Array = function uint8Array() { return new Uint8Array(arrayBuffer()); };
175175
var uint8ClampedArray = function uint8ClampedArray() { return new Uint8ClampedArray(arrayBuffer()); };
176176
var uint16Array = function uint16Array() { return new Uint16Array(arrayBuffer()); };
@@ -208,7 +208,7 @@ if (SymbolToStringTagSupported) {
208208
var fakeBigUint64Array = function fakeBigUint64Array() { return Object.create(BigUint64Array.prototype); };
209209

210210
var stealthyDataView = function stealthyDataView() {
211-
return Object.setPrototypeOf(new DataView(arrayBuffer()), Uint8Array.prototype);
211+
return Object.setPrototypeOf(new DataView(arrayBuffer(), 0, 1), Uint8Array.prototype);
212212
};
213213
var stealthyUint8Array = function stealthyUint8Array() {
214214
return Object.setPrototypeOf(new Uint8Array(arrayBuffer()), ArrayBuffer.prototype);

0 commit comments

Comments
 (0)