summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/array-out-of-memory.html
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:41 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:41 -0800
commit648161bb0edfc3d43db63caed5cc5213bc6cb78f (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /WebCore/manual-tests/array-out-of-memory.html
parenta65af38181ac7d34544586bdb5cd004de93897ad (diff)
downloadexternal_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.zip
external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.gz
external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/manual-tests/array-out-of-memory.html')
-rw-r--r--WebCore/manual-tests/array-out-of-memory.html42
1 files changed, 0 insertions, 42 deletions
diff --git a/WebCore/manual-tests/array-out-of-memory.html b/WebCore/manual-tests/array-out-of-memory.html
deleted file mode 100644
index 486e200..0000000
--- a/WebCore/manual-tests/array-out-of-memory.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script>
-
-function runArrayOOMTest() {
- document.write("<p>Starting test...</p>");
-
- // The index 'target' is the location in the array we expect to fault on access, should the size calculation of the realloc of the vector be allowed
- // to overflow. The vector needs to be ((target + 1) * sizeof(JSValue*)) bytes long to hold 'target', or approximately 2/3 UINT32_MAX. Upon growing
- // the array an additional 50% capacity will be allocated, plus the storage object header, taking the size of the allocation over UINT32_MAX.
- var target = Math.floor(0xFFFFFFFF / 6);
- // In order to force arr[target] to be stored in the vector, rather than the sparse map, we need ensure the vector is sufficiently densely populated.
- var populate = Math.floor(target / 8 + 1);
-
- try {
- var arr = new Array();
- for (i=0; i < populate; ++i)
- arr[i] = 0;
- arr[target] = 0;
- } catch(e) {
- var expect_name = "Error";
- var expect_message = "Out of memory";
- if ((e.name == expect_name) && (e.message == expect_message))
- document.write("<p>SUCCESS</p>");
- else
- document.write("<p>FAIL - Expected \"" + expect_name + "/" + expect_message + "\", got \"" + e.name + "/" + e.message + "\".</p>");
-
- return;
- }
-
- document.write("<p>FAIL - Expected exception.</p>");
-}
-
-</script>
-</head>
-<body>
-<p>This test checks that Array objects fail gracefully (throw exception) when array length grows large.</p>
-<p>This test may run for over 20 seconds on a fast machine, and will consume hundereds of MB of memory.</p>
-<input type="button" onclick="runArrayOOMTest()" value="Start">
-</body>
-</html>