This repository has been archived by the owner on Jul 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-electron
- Loading branch information
Showing
12 changed files
with
253 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,10 +108,108 @@ BEGIN_TEST(testSavedStacks_RangeBasedForLoops) | |
} | ||
CHECK(rf == nullptr); | ||
|
||
// Stack string | ||
const char* SpiderMonkeyStack = "[email protected]:4:14\n" | ||
"[email protected]:3:22\n" | ||
"[email protected]:2:20\n" | ||
"@filename.js:1:11\n"; | ||
const char* V8Stack = " at three (filename.js:4:14)\n" | ||
" at two (filename.js:3:22)\n" | ||
" at one (filename.js:2:20)\n" | ||
" at filename.js:1:11"; | ||
struct { | ||
js::StackFormat format; | ||
const char* expected; | ||
} expectations[] = { | ||
{js::StackFormat::Default, SpiderMonkeyStack}, | ||
{js::StackFormat::SpiderMonkey, SpiderMonkeyStack}, | ||
{js::StackFormat::V8, V8Stack} | ||
}; | ||
auto CheckStacks = [&]() { | ||
for (auto& expectation : expectations) { | ||
JS::RootedString str(cx); | ||
CHECK(JS::BuildStackString(cx, savedFrame, &str, 0, expectation.format)); | ||
JSLinearString* lin = str->ensureLinear(cx); | ||
CHECK(lin); | ||
CHECK(js::StringEqualsAscii(lin, expectation.expected)); | ||
} | ||
return true; | ||
}; | ||
|
||
CHECK(CheckStacks()); | ||
|
||
js::SetStackFormat(cx, js::StackFormat::V8); | ||
expectations[0].expected = V8Stack; | ||
|
||
CHECK(CheckStacks()); | ||
|
||
return true; | ||
} | ||
END_TEST(testSavedStacks_RangeBasedForLoops) | ||
|
||
BEGIN_TEST(testSavedStacks_ErrorStackSpiderMonkey) | ||
{ | ||
JS::RootedValue val(cx); | ||
CHECK(evaluate("(function one() { \n" // 1 | ||
" return (function two() { \n" // 2 | ||
" return (function three() { \n" // 3 | ||
" return new Error('foo'); \n" // 4 | ||
" }()); \n" // 5 | ||
" }()); \n" // 6 | ||
"}()).stack \n", // 7 | ||
"filename.js", | ||
1, | ||
&val)); | ||
|
||
CHECK(val.isString()); | ||
JS::RootedString stack(cx, val.toString()); | ||
|
||
// Stack string | ||
const char* SpiderMonkeyStack = "[email protected]:4:14\n" | ||
"[email protected]:3:22\n" | ||
"[email protected]:2:20\n" | ||
"@filename.js:1:11\n"; | ||
JSLinearString* lin = stack->ensureLinear(cx); | ||
CHECK(lin); | ||
CHECK(js::StringEqualsAscii(lin, SpiderMonkeyStack)); | ||
|
||
return true; | ||
} | ||
END_TEST(testSavedStacks_ErrorStackSpiderMonkey) | ||
|
||
BEGIN_TEST(testSavedStacks_ErrorStackV8) | ||
{ | ||
js::SetStackFormat(cx, js::StackFormat::V8); | ||
|
||
JS::RootedValue val(cx); | ||
CHECK(evaluate("(function one() { \n" // 1 | ||
" return (function two() { \n" // 2 | ||
" return (function three() { \n" // 3 | ||
" return new Error('foo'); \n" // 4 | ||
" }()); \n" // 5 | ||
" }()); \n" // 6 | ||
"}()).stack \n", // 7 | ||
"filename.js", | ||
1, | ||
&val)); | ||
|
||
CHECK(val.isString()); | ||
JS::RootedString stack(cx, val.toString()); | ||
|
||
// Stack string | ||
const char* V8Stack = "Error: foo\n" | ||
" at three (filename.js:4:14)\n" | ||
" at two (filename.js:3:22)\n" | ||
" at one (filename.js:2:20)\n" | ||
" at filename.js:1:11"; | ||
JSLinearString* lin = stack->ensureLinear(cx); | ||
CHECK(lin); | ||
CHECK(js::StringEqualsAscii(lin, V8Stack)); | ||
|
||
return true; | ||
} | ||
END_TEST(testSavedStacks_ErrorStackV8) | ||
|
||
BEGIN_TEST(testSavedStacks_selfHostedFrames) | ||
{ | ||
CHECK(js::DefineTestingFunctions(cx, global, false, false)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule spidernode
updated
20 files