Tobias Haupt created WICKET-6902:
------------------------------------
Summary: Change of PartialPageUpdate order of onAfterResponse and
writePriorityEvaluations makes IListener.onAfterResponde ignore prepended
javascripts
Key: WICKET-6902
URL: https://issues.apache.org/jira/browse/WICKET-6902
Project: Wicket
Issue Type: Bug
Components: wicket-core
Affects Versions: 9.3.0
Reporter: Tobias Haupt
Attachments: prependjs-quickstart.zip
In wicket 8 it was possible to call AjaxRequestTarget.prependJavaScript from
within IListener.onAfterRespond.
A change in:
https://github.com/apache/wicket/commit/b7f62a6591ea3e98374079555c877ba70ba30286#diff-d78837c7a0946ee5118aea1054d96c774a7d381d16dc5374ea87e7f018c6be94
was made, that switched the order of writePriorityEvaluations and
onAfterRespond calls.
The javadoc of IListener.onAfterRespond states:
"NOTE: During this stage of processing any calls to target that manipulate the
response (adding components, javascript) will have no effect"
This statement is problematic, because it has not been correct in wicket 8.
There it was possible to prepend and append javascripts to the current
AjaxRequestTarget at that stage. Now it is no longer possible to prepend
javascripts, but still possible to append them.
In AjaxRequestHandler (line 148) there is a comment: "create response that will
be used by listeners to append javascript". This implies, that it should be
possible to add javascripts somehow.
Clarification needed:
- Why has the order been changed in the first place? Was it related to a fix in
WICKET-6703?
- Is the javadoc correct? When why can javascripts still be appended?
- Can the PartialPageUpdate use Freezing to throw Exceptions whenever things
are added too late and are already written? Like in
AjaxRequestHandler.listenersFrozen. The current behavior (simply ignoring
scripts) is error prone and made our application fail silently at runtime.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)