mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add a little headroom to the stack when converting an exception JS -> C++
Summary: This was causing an exception cascade leading to production errors. Added a test which repros the problem and passes with the fix. Changelog: [Internal] Reviewed By: tmikov Differential Revision: D20408858 fbshipit-source-id: 3fa9b8669bf3bf7617bfc05ef8f23d52bc969b4e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6a6590fbdf
commit
05c17c76da
@@ -1029,6 +1029,30 @@ TEST_P(JSITest, JSErrorDoesNotInfinitelyRecurse) {
|
||||
rt.global().setProperty(rt, "Error", globalError);
|
||||
}
|
||||
|
||||
TEST_P(JSITest, JSErrorStackOverflowHandling) {
|
||||
rt.global().setProperty(
|
||||
rt,
|
||||
"callSomething",
|
||||
Function::createFromHostFunction(
|
||||
rt,
|
||||
PropNameID::forAscii(rt, "callSomething"),
|
||||
0,
|
||||
[this](
|
||||
Runtime& rt2,
|
||||
const Value& thisVal,
|
||||
const Value* args,
|
||||
size_t count) {
|
||||
EXPECT_EQ(&rt, &rt2);
|
||||
return function("function() { return 0; }").call(rt);
|
||||
}));
|
||||
try {
|
||||
eval("(function f() { callSomething(); f.apply(); })()");
|
||||
FAIL();
|
||||
} catch (const JSError& ex) {
|
||||
EXPECT_NE(std::string(ex.what()).find("exceeded"), std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(JSITest, ScopeDoesNotCrashTest) {
|
||||
Scope scope(rt);
|
||||
Object o(rt);
|
||||
|
||||
Reference in New Issue
Block a user