Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure.html

Issue 1577783004: [v8] don't crash when ArrayBuffer allocation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a little comment explaining the contract Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure.html
diff --git a/third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure.html b/third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure.html
new file mode 100644
index 0000000000000000000000000000000000000000..00e856af3c26f0001607aeccb26396d7e5e38e3a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+
+<script>
+description(
+ "This test checks that TypedArray allocation failures should throw"
+);
+
+function shouldThrowType(_a, _type)
+{
+ var _exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ _exception = e;
+ }
+
+ if (_exception) {
+ if (typeof _e == "undefined" || _exception.name === _type)
+ testPassed(_a + " threw exception " + _exception.name + ".");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _type) + ". Threw exception " + _exception + ".");
+ } else if (typeof _av == "undefined")
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _type) + ". Was undefined.");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _type) + ". Was " + _av + ".");
+}
+
+shouldThrowType("new ArrayBuffer(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Uint8Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Uint8ClampedArray(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Uint16Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Uint32Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Int8Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Int16Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Int32Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Float32Array(7 * 1125899906842624)", "RangeError");
+shouldThrowType("new Float64Array(7 * 1125899906842624)", "RangeError");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/js/typed-array-allocation-failure-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698