Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Unified Diff: test/webkit/fast/js/stack-overflow-arrity-catch.js

Issue 20280003: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/webkit/fast/js/stack-overflow-arrity-catch.js
diff --git a/test/webkit/stack-overflow-catch.js b/test/webkit/fast/js/stack-overflow-arrity-catch.js
similarity index 55%
copy from test/webkit/stack-overflow-catch.js
copy to test/webkit/fast/js/stack-overflow-arrity-catch.js
index 440148eb659f0792d0df86620a83630aa3253108..4cbcbbfb6e2592158c2c36ef7de3dc2bac110d13 100644
--- a/test/webkit/stack-overflow-catch.js
+++ b/test/webkit/fast/js/stack-overflow-arrity-catch.js
@@ -21,56 +21,61 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-description('Test that when the stack overflows, the exception goes to the last frame before the overflow');
+description('Test that if an arrity check causes a stack overflow, the exception goes to the right catch');
-var level = 0;
-var stackLevel = 0;
-var gotWrongCatch = false;
-
-function test1()
+function funcWith20Args(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
+ arg9, arg10, arg11, arg12, arg13, arg14, arg15,
+ arg16, arg17, arg18, arg19, arg20)
{
- var myLevel = level;
- var dummy;
+ debug("ERROR: Shouldn't arrive in 20 arg function!");
+}
- try {
- level = level + 1;
- // Dummy code to make this funciton different from test2()
- dummy = level * level + 1;
- if (dummy == 0)
- debug('Should never get here!!!!');
- } catch(err) {
- gotWrongCatch = true;
- }
+var gotRightCatch = false, gotWrongCatch1 = false, gotWrongCatch2 = false;
+function test1()
+{
try {
test2();
- } catch(err) {
- stackLevel = myLevel;
+ } catch (err) {
+ // Should get here because of stack overflow,
+ // now cause a stack overflow exception due to arrity processing
+ try {
+ var dummy = new RegExp('a|b|c');
+ } catch(err) {
+ gotWrongCatch1 = true;
+ }
+
+ try {
+ funcWith20Args(1, 2, 3);
+ } catch (err2) {
+ gotRightCatch = true;
+ }
}
}
function test2()
{
- var myLevel = level;
-
- // Dummy code to make this funciton different from test1()
- if (gotWrongCatch)
- debug('Should never get here!!!!');
-
try {
- level = level + 1;
+ var dummy = new Date();
} catch(err) {
- gotWrongCatch = true;
+ gotWrongCatch2 = true;
}
try {
test1();
- } catch(err) {
- stackLevel = myLevel;
+ } catch (err) {
+ // Should get here because of stack overflow,
+ // now cause a stack overflow exception due to arrity processing
+ try {
+ funcWith20Args(1, 2, 3, 4, 5, 6);
+ } catch (err2) {
+ gotRightCatch = true;
+ }
}
}
test1();
-shouldBeFalse("gotWrongCatch");
-shouldBe("(stackLevel)", "(level - 1)");
+shouldBeTrue("gotRightCatch");
+shouldBeFalse("gotWrongCatch1");
+shouldBeFalse("gotWrongCatch2");
« no previous file with comments | « test/webkit/fast/js/reserved-words-strict-expected.txt ('k') | test/webkit/fast/js/stack-overflow-arrity-catch-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698