One of the problems with the current way Jenkins puts JavaScripts is that most everything is in a single file. It doesn't highlight the relationship between those fragments and their corresponding tag files.
So I'm experimenting with moving out these fragments into individual JavaScript files co-located with the tag file. They then get loaded into the page via <st:adjunct>. Each script is served with unique URL such that the browser will not even have to try conditional GET when loading different pages, so this should prevent the performance problem caused by the fact that there are now lots of <script> tags in the page.
If for some reason even this turns out to be a problem, we can always add additional build steps to concatenate them all.
This makes it consistent with other buttons like repeatable-add-button, and use of '-' prevents name collisions with form names, and make all of those UI controls addressible in the same namespace
Previously, the code was "find the nearby element of the expected @name,
then make sure it has gotten the right parent."
So if the structure is like:
{/* outer object */
name: "parent-name", /* A */
child1: {/* inner object */
name: "child-name" /* B */
},
child2: {/* inner object */
name: "child-name" /* C */
}
}
... and if we are looking for "../name", it finds B, and it gets
rejected, so we won't be able to find A, which is what we are supposed
to find.
With this change, we keep trying until we find the right one,
so the above case will correctly return A.
If a resource with 'Set-Cookie' header is cached (either by intermediary
like HTTP proxy and reverse proxy, or by the browser), it'll cause
identity swap / session mix-up as discussed in this ticket.
I suspect this was caused by HttpSessionContextIntegrationFilter2, which
is the only code path that attempts to create a session when a request
to a static resource is made.
So I'm disabling the creation of session in
HttpSessionContextIntegrationFilter2. This in turn requires that we
have sessions already created when the authentication was successful and
people need to login (or else the login will have no effect.)
We already do so in layout.jelly, so any request that renders a Jenkins
page would have a session, but I've also added it in
AuthenticationProcessingFilter2, which ensures that a successful login
does have a session.