@Override
  public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
    ServletContext ctx = httpSessionEvent.getSession().getServletContext();

    List<Object> jsListeners =
        (List<Object>) ctx.getAttribute(JaggeryCoreConstants.JS_DESTROYED_LISTENERS);
    JaggeryContext clonedContext = WebAppManager.clonedJaggeryContext(ctx);

    RhinoEngine engine = clonedContext.getEngine();
    Context cx = engine.enterContext();

    ScriptableObject clonedScope = clonedContext.getScope();

    JavaScriptProperty session = new JavaScriptProperty("session");
    session.setValue(
        cx.newObject(clonedScope, "Session", new Object[] {httpSessionEvent.getSession()}));
    session.setAttribute(ScriptableObject.READONLY);
    RhinoEngine.defineProperty(clonedScope, session);

    if (jsListeners != null) {
      for (Object jsListener : jsListeners) {
        CommonManager.getCallstack(clonedContext).push((String) jsListener);
        try {
          ScriptReader sr =
              new ScriptReader(ctx.getResourceAsStream((String) jsListener)) {
                @Override
                protected void build() throws IOException {
                  try {
                    sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                  } catch (ScriptException e) {
                    throw new IOException(e);
                  }
                }
              };
          engine.exec(sr, clonedScope, null);
        } catch (ScriptException e) {
          log.error(e.getMessage(), e);
        }
      }
    }
  }