break and continue statements are causing finally block execution in Nashorn

I’m puzzled why finally is getting executed after break/continue (Version: Java 8 update 5)

testTryFinally();

function testTryFinally()
{
  try
  {
    print("Try 1");
    for(var i = 0; i < 2; i++)
    {
      break;
    }  
    print("Try 2");
  }
  finally
  {
    print("Finally executed");
  }
}

Execution:
.../tmp>jjs test.js

  • Infinite Fibonacci Sequence with Memoized in Java 8
  • (De)referencing method variant in Java Nashorn
  • Nashorn bug when calling overloaded method with varargs parameter
  • Why does Java 8 Nashorn (JavaScript) modulo returns 0.0 (double) instead of 0 (integer)?
  • How to set java-8 Nashorn javascript engine options for a single engine instance
  • Why Java Nashorn __DIR__, __LINE__ and __FILE__ are null?
  • Output with break:

    Try 1
    Finally executed
    Try 2
    Finally executed
    

    Output with continue in place of break

    Try 1
    Finally executed
    Finally executed
    Try 2
    Finally executed
    

    I have tried executing the same code in browser (replacing print() with console.log()

    Output is as expected in Firebug

    Try 1
    Try 2
    Finally executed
    

  • Nashorn bug when calling overloaded method with varargs parameter
  • Troubleshooting Nashorn “Method code too large!” exception
  • Nan comparison in Javascript with javax.scriptEngine on JDK8
  • Enable scripting mode for nashorn in java
  • What are the exact difference between Java 8 Lambda constructs and JavaScript?
  • Java 8 Nashorn whitespace issue
  • 2 Solutions collect form web for “break and continue statements are causing finally block execution in Nashorn”

    I found the relevant statement here:

    . . . While it’s true finally will always be executed if defined, certain statements inside try such as continue, break, return, or when an error has occurred and there is no catch clause will all cause finally to be executed immediately thereafter . . .

    But i don’t see this is happening in Firefox (probably for a good reason)