зеркало из https://github.com/mozilla/gecko-dev.git
Bugs 423443/419661: crash in MarkSharpObjects due to stack overflow, when over-deep engine-internal recursion is triggered in JS components. r=brendan, a-b5=beltzner
This commit is contained in:
Родитель
30fb12b55d
Коммит
3be7793e57
|
@ -521,8 +521,25 @@ mozJSComponentLoader::ReallyInit()
|
|||
uint32 options = JS_GetOptions(mContext);
|
||||
JS_SetOptions(mContext, options | JSOPTION_XML);
|
||||
|
||||
// Always use the latest js version
|
||||
JS_SetVersion(mContext, JSVERSION_LATEST);
|
||||
// Always use the latest js version
|
||||
JS_SetVersion(mContext, JSVERSION_LATEST);
|
||||
|
||||
// Limit C stack consumption to a reasonable 512K
|
||||
int stackDummy;
|
||||
const jsuword kStackSize = 0x80000;
|
||||
jsuword stackLimit, currentStackAddr = (jsuword)&stackDummy;
|
||||
|
||||
#if JS_STACK_GROWTH_DIRECTION < 0
|
||||
stackLimit = (currentStackAddr > kStackSize)
|
||||
? currentStackAddr - kStackSize
|
||||
: 0;
|
||||
#else
|
||||
stackLimit = (currentStackAddr + kStackSize > currentStackAddr)
|
||||
? currentStackAddr + kStackSize
|
||||
: (jsuword) -1;
|
||||
#endif
|
||||
|
||||
JS_SetThreadStackLimit(mContext, stackLimit);
|
||||
|
||||
#ifndef XPCONNECT_STANDALONE
|
||||
nsCOMPtr<nsIScriptSecurityManager> secman =
|
||||
|
|
Загрузка…
Ссылка в новой задаче