68c14892cb
Reason for revert:
Breaks layout tests:
https://build.chromium.org/p/tryserver.v8/builders/v8_linux_blink_rel/builds/18499
Changes:
https://storage.googleapis.com/chromium-layout-test-archives/v8_linux_blink_rel/18499/layout-test-results/results.html
See:
https://github.com/v8/v8/wiki/Blink-layout-tests
Original issue's description:
> [typedarrays] Check detached buffer at start of typed array methods
>
> - Throw TypeError in ValidateTypedArray, matching JSC, SpiderMonkey
> and ChakraCore.
> - Validate typed arrays at start of each typed array prototype
> methods in src/js/typedarrays.js
> - Add tests to check detached buffers
> - Remove an unnecessary parameter of TypedArraySpeciesCreate
> in src/js/typedarrays.js
> - Standardize TypedArray.prototype.subarray
> - Update test262.status to pass detached buffer tests
>
> BUG=v8:4648,v8:4665,v8:4953
>
> Review-Url: https://codereview.chromium.org/2778623003
> Cr-Commit-Position: refs/heads/master@{#44357}
> Committed: 238d5b4453
TBR=cbruni@chromium.org,adamk@chromium.org,bmeurer@chromium.org,littledan@chromium.org,petermarshall@chromium.org,cwhan.tunz@gmail.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4648,v8:4665,v8:4953
Review-Url: https://codereview.chromium.org/2793233003
Cr-Commit-Position: refs/heads/master@{#44362}
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
var buffer1 = new ArrayBuffer(100 * 1024);
|
|
|
|
var array1 = new Uint8Array(buffer1, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer1);
|
|
return 0;
|
|
}});
|
|
|
|
assertEquals(0, array1.length);
|
|
|
|
var buffer2 = new ArrayBuffer(100 * 1024);
|
|
|
|
assertThrows(function() {
|
|
var array2 = new Uint8Array(buffer2, 0, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer2);
|
|
return 100 * 1024;
|
|
}});
|
|
}, RangeError);
|
|
|
|
|
|
var buffer3 = new ArrayBuffer(100 * 1024 * 1024);
|
|
var dataView1 = new DataView(buffer3, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer3);
|
|
return 0;
|
|
}});
|
|
|
|
assertEquals(0, dataView1.byteLength);
|
|
|
|
var buffer4 = new ArrayBuffer(100 * 1024);
|
|
assertThrows(function() {
|
|
var dataView2 = new DataView(buffer4, 0, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer4);
|
|
return 100 * 1024 * 1024;
|
|
}});
|
|
}, RangeError);
|
|
|
|
|
|
var buffer5 = new ArrayBuffer(100 * 1024);
|
|
assertThrows(function() {
|
|
buffer5.slice({valueOf : function() {
|
|
%ArrayBufferNeuter(buffer5);
|
|
return 0;
|
|
}}, 100 * 1024 * 1024);
|
|
}, TypeError);
|
|
|
|
|
|
var buffer7 = new ArrayBuffer(100 * 1024 * 1024);
|
|
assertThrows(function() {
|
|
buffer7.slice(0, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer7);
|
|
return 100 * 1024 * 1024;
|
|
}});
|
|
}, TypeError);
|
|
|
|
var buffer9 = new ArrayBuffer(1024);
|
|
var array9 = new Uint8Array(buffer9);
|
|
var array10 = array9.subarray({valueOf : function() {
|
|
%ArrayBufferNeuter(buffer9);
|
|
return 0;
|
|
}}, 1024);
|
|
assertEquals(0, array9.length);
|
|
assertEquals(0, array10.length);
|
|
|
|
var buffer11 = new ArrayBuffer(1024);
|
|
var array11 = new Uint8Array(buffer11);
|
|
var array12 = array11.subarray(0, {valueOf : function() {
|
|
%ArrayBufferNeuter(buffer11);
|
|
return 1024;
|
|
}});
|
|
assertEquals(0, array11.length);
|
|
assertEquals(0, array12.length);
|