Merge backout

This commit is contained in:
Ben Turner 2009-01-13 12:54:57 -08:00
commit 26990ffd2e
3 changed files with 6 additions and 46 deletions

View File

@ -838,25 +838,6 @@ nsDOMThreadService::CreateJSContext()
SetSecurityManagerForJSContext(cx, gWorkerSecurityManager, 0);
NS_ENSURE_SUCCESS(rv, nsnull);
PRUint32 stackDummy;
jsuword stackLimit, currentStackAddr = (jsuword)&stackDummy;
// 256k stack space.
const jsuword kStackSize = 0x40000;
#if JS_STACK_GROWTH_DIRECTION < 0
stackLimit = (currentStackAddr > kStackSize) ?
currentStackAddr - kStackSize :
0;
#else
stackLimit = (currentStackAddr + kStackSize > currentStackAddr) ?
currentStackAddr + kStackSize :
(jsuword) -1;
#endif
JS_SetThreadStackLimit(cx, stackLimit);
JS_SetScriptStackQuota(cx, 100*1024*1024);
return cx.forget();
}

View File

@ -1,28 +1,14 @@
// Pure JS recursion
function recurse() {
recurse();
}
// JS -> C++ -> JS -> C++ recursion
function recurse2() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
xhr.abort();
xhr.open("GET", "nonexistent.file");
}
xhr.open("GET", "nonexistent.file");
}
var count = 0;
onmessage = function(event) {
switch (++count) {
case 1:
switch (event.data) {
case "start":
recurse();
break;
case 2:
recurse2();
throw "Never should have gotten here!";
break;
default:
throw "Bad message: " + event.data;
}
throw "Never should have gotten here!";
}

View File

@ -17,21 +17,14 @@ Tests of DOM Worker Threads
<pre id="test">
<script class="testbody" type="text/javascript">
const testCount = 2;
var worker = new Worker("recursion_worker.js");
var count = 0;
worker.onerror = function(event) {
is(event.message, "too much recursion");
if (++count == testCount) {
SimpleTest.finish();
}
SimpleTest.finish();
}
for (var i = 0; i < testCount; i++) {
worker.postMessage("start");
}
worker.postMessage("start");
SimpleTest.waitForExplicitFinish();