Hi

Reviewing some stuff, it was notice that the FacesContext instance is not passed when event processing occur, so every time a system event should be processed, a call to FacesContext.getCurrentInstance() should be done in almost all cases.

Below there are one example based on myfaces code (removed non relevant code):

public class HtmlStylesheetRenderer extends Renderer implements
    ComponentSystemEventListener
{

    public void processEvent(ComponentSystemEvent event)
    {
        UIComponent component = event.getComponent();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        facesContext.getViewRoot().addComponentResource(facesContext,
                    component, "head");
    }
    ......
}

It could be good to pass the current facesContext (note the code in Application.publishEvent receive it as param), to prevent those unnecessary calls and enhance code performance. In theory it is possible to cache facesContext object on listeners suscribed using  UIViewRoot.subscribeToViewEvent() because those listeners are not saved (but maybe not because if the same view is used on portlet....), but that's not possible on ComponentSystemEventListener instances.

I'll open an issue for this one.

regards,

Leonardo Uribe