Bug 1031152 - Part 2: Define a JSAPI test for the SavedFrame public API; r=jandem

This commit is contained in:
Nick Fitzgerald 2015-02-25 17:07:05 -08:00
parent eb13ff659d
commit 79562d4566

View File

@ -22,3 +22,45 @@ BEGIN_TEST(testSavedStacks_withNoStack)
return true;
}
END_TEST(testSavedStacks_withNoStack)
BEGIN_TEST(testSavedStacks_ApiDefaultValues)
{
js::RootedSavedFrame savedFrame(cx, nullptr);
// Source
JS::RootedString str(cx);
JS::SavedFrameResult result = JS::GetSavedFrameSource(cx, savedFrame, &str);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(str.get() == cx->runtime()->emptyString);
// Line
uint32_t line = 123;
result = JS::GetSavedFrameLine(cx, savedFrame, &line);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(line == 0);
// Column
uint32_t column = 123;
result = JS::GetSavedFrameColumn(cx, savedFrame, &column);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(column == 0);
// Function display name
result = JS::GetSavedFrameFunctionDisplayName(cx, savedFrame, &str);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(str.get() == nullptr);
// Parent
JS::RootedObject parent(cx);
result = JS::GetSavedFrameParent(cx, savedFrame, &parent);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(parent.get() == nullptr);
// Stack string
result = JS::GetSavedFrameSource(cx, savedFrame, &str);
CHECK(result == JS::SavedFrameResult::AccessDenied);
CHECK(str.get() == cx->runtime()->emptyString);
return true;
}
END_TEST(testSavedStacks_ApiDefaultValues)