mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Merge backout
This commit is contained in:
commit
26990ffd2e
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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!";
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user