16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * NASHORN-109 : line number in stack trace is incorrect in exceptions from scripts loaded via load() 26 * 27 * @test 28 * @run 29 */ 30 31 try { 32 if (typeof foo == 'undefined') { 33 throw new Error("error"); 34 } 35 } catch (e) { 36 for (i in e.stack) { 37 print(e.stack[i].methodName + ' ' + e.stack[i].lineNumber); 38 } 39 } 40 41 // just some code at the end.. original test involved 42 // line numer of the last line always. Just to check the same.. 43 print("done"); | 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * NASHORN-109 : line number in stack trace is incorrect in exceptions from scripts loaded via load() 26 * 27 * @test 28 * @run 29 */ 30 31 try { 32 if (typeof foo == 'undefined') { 33 throw new Error("error"); 34 } 35 } catch (e) { 36 var frames = e.getStackTrace(); 37 for (i in frames) { 38 print(frames[i].methodName + ' ' + frames[i].lineNumber); 39 } 40 } 41 42 // just some code at the end.. original test involved 43 // line numer of the last line always. Just to check the same.. 44 print("done"); |