nashorn/test/script/basic/JDK-8025515.js
changeset 22374 5231ab59e740
parent 20559 9244eb6d195b
child 24719 f726e9d67629
--- a/nashorn/test/script/basic/JDK-8025515.js	Mon Dec 16 23:25:50 2013 +0530
+++ b/nashorn/test/script/basic/JDK-8025515.js	Thu Dec 19 21:53:27 2013 +0530
@@ -30,13 +30,23 @@
 
 // Make sure synthetic names of anonymous functions have correct line numbers
 
+function getFirstScriptFrame(stack) {
+    for (frameNum in stack) {
+        var frame = stack[frameNum];
+        if (frame.className.startsWith("jdk.nashorn.internal.scripts.Script$")) {
+            return frame;
+        }
+    }
+}
+
 function testMethodName(f, expected) {
     try {
         f();
         fail("expected error");
     } catch (e) {
-        var stack = e.getStackTrace();
-        if (stack[0].methodName !== expected) {
+        var stack = e.nashornException.getStackTrace();
+        var name = getFirstScriptFrame(stack).methodName;
+        if (name !== expected) {
             fail("got " + stack[0].methodName + ", expected " + expected);
         }
     }
@@ -44,15 +54,15 @@
 
 testMethodName(function() {
     return a.b.c;
-}, "_L45");
+}, "L:55");
 
-testMethodName(function() { throw new Error() }, "_L49");
+testMethodName(function() { throw new Error() }, "L:59");
 
 var f = (function() {
     return function() { a.b.c; };
 })();
-testMethodName(f, "_L51$_L52");
+testMethodName(f, "L:61$L:62");
 
 testMethodName((function() {
     return function() { return a.b.c; };
-})(), "_L56$_L57");
+})(), "L:66$L:67");