Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6902

Change of PartialPageUpdate order of onAfterResponse and writePriorityEvaluations makes IListener.onAfterResponde ignore prepended javascripts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 9.3.0
    • 10.0.0-M1, 9.5.0
    • wicket-core
    • None

    Description

      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.

      Attachments

        1. prependjs-quickstart.zip
          44 kB
          Tobias Haupt

        Activity

          People

            svenmeier Sven Meier
            tobiashaupt Tobias Haupt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: