Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Must verify:
- HTML placeholder. (Think status messages, comment form, block, et cetera.)
- HTML attribute value placeholder. (Think form action, form token.)
- HTML attribute value subset placeholder. (Think CSRF token in URL.)
- Custom string to be considered as a placeholder that just happens to not be valid HTML. (This is the crazy edge case. But we want BigPipe to always work reliably.)
- … all of the above both in case of the current request having a session and not, and in case of the current request having a BigPipe no-JS cookie or not — in other words, the above must be tested in all four situations
- When a session is present (and hence BigPipe can work), BigPipe is always able to deliver all placeholders, regardless what type of placeholder they are (see points 1–4 above).
- A HTML placeholder that does not use a
#lazy_builder
.
Comment | File | Size | Author |
---|---|---|---|
#16 | 2674334-16.patch | 23.72 KB | Wim Leers |
|
Comments
Comment #2
Wim LeersComment #3
Wim LeersComment #4
Wim LeersThis placeholder makes a ton of sense, and it's legible.
This placeholder on the other hand makes little sense, and is not really legible.
Let's fix that: let's make no-JS BigPipe placeholders also make sense.
Comment #5
Wim Leers#4 let me down a bit of a rabbit hole of inconsistencies.
I refactored the code generating #4.1 into a protected helper method so I can use it also for the no-JS case. No problem.
Then I noticed it was generating a "selector". But it's not really generating a selector, it's generating an identifier. As is evident from the fact that we send these generated selectors to the client side using
drupalSettings.bigPipePlaceholders
, so that the JS has a whitelist to verify against:But note that this JS doesn't call it "selectors" anymore! This is very inconsistent and confusing.
If all this were called "placeholder IDs" instead of "selectors", none of this confusion would arise. So, let's do that renaming first.
Comment #6
Wim LeersAnd here we go, much saner placeholders + placeholder IDs for BigPipe no-JS placeholders, this addresses #4.2.
Comment #7
Wim LeersThose two @todos are technically out of scope here.
But…
These three expectations cement the current implementation in the test expectations: they cement the expectation that these placeholders which live in attribute values can in fact be HTML, which breaks response filters as the
@todo
indicates.Conclusion: I think it makes sense to fix those todos here, to ensure the test expectations actually make sense.
Comment #8
Wim Leers#2674126: BigPipeResponseAttachmentsProcessor test coverage landed in the mean-time, so re-testing #6.
Comment #9
Wim LeersThe refactoring I did in #5 resulted in a new helper method (
generateBigPipePlaceholderId()
), which also made me realize that one test case is still missing: one for a placeholder that does not use#lazy_builder
. See #2469431-173: BigPipe for auth users: first send+render the cheap parts of the page, then the expensive parts.So, first adding test coverage for that.
In doing so, I also noticed that the number of passes did not reflect the number of individual things being tested. So I changed the assertions around a bit: they're now per-placeholder instead of for all placeholders at once. This also greatly simplifies debugging of this test/understanding what exactly is broken.
Comment #10
Wim LeersIS update for #9.
Comment #12
Wim LeersAnd finally, this implements #7.
Comment #14
Wim LeersI worked on #9 while working on #12, I didn't split them up correctly. Hence the failure in #9.
And in #12, I apparently introduced a typo at the very last minute.
Sorry for the confusion.
Comment #15
Wim LeersOops, this leftover file snuck in! It's not being run (so it's a "dead test" effectively), but it's making the patch looking much bigger than it is.
Comment #16
Wim Leers#2670462: Clean up, document & improve big_pipe.js landed, this needed to be rebased.
After a clean rebase, there was one more small change needed, and only that change is visible in this interdiff.
Comment #17
Wim LeersPer #7 and since #12, this fixes all remaining
@todo
s inBigPipeStrategy
, updating title accordingly.Comment #19
Wim LeersI waited 24 hours to allow for reviews to come in. None happened, that's okay. I don't think there was any controversial change here. Just test coverage, clean-up and renaming.
Comment #20
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedRTBC in retrospective
Comment #21
Wim LeersExcellent, thanks!