[#311] Fixed the console errors raised while editing content. - #314
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
Comment |
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #314 +/- ##
===========================================
+ Coverage 84.51% 86.56% +2.04%
===========================================
Files 26 28 +2
Lines 562 655 +93
===========================================
+ Hits 475 567 +92
- Misses 87 88 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code coverage (threshold: 80%) Per-class coverage |
Closes #311
Checklist before requesting a review
[#123] Verb in past tense.#123added to descriptionChangedsectionChanged
internal.drupal.ckeditor5.stylesheetslibrary inLibraryInfoAlterHook.civictheme/dist/civictheme.editor.cssopens with two@import url("https://fonts.googleapis.com/...")statements, which the content security policy blocks because this site self-hosts Lexend and Rubik. The sub-theme'sdist/styles.editor.cssis its own build of the same partials, carrying self-hosted@font-facerules instead, and contributes every selector the base theme's copy did: comparing the two built files gives 115 selectors in the base theme's, all present among the sub-theme's 117.civictheme.variables.cssgoes with it for the same reason the theme already redirects the other three CivicTheme stylesheets throughlibraries-override: the sub-theme ships the replacement. The hook runs withOrderAfter(modules: ['ckeditor5']), since CKEditor 5 assembles that library in its ownhook_library_info_alter()and would otherwise overwrite the filtered list.NavigationScriptHash, which derives the policy hash for the inline script core's navigation toolbar renders. That script carries no nonce, and the policy carries a nonce and nounsafe-inline, so it was blocked and editors saw the sidebar flash from collapsed to expanded on every admin page. The service readscore/modules/navigation/layouts/navigation.html.twig, hashes each inline script it holds and caches the result, so no digest is recorded in this repository and a core release that edits the script cannot leave a stale value behind.do_basechannel naming the path and the consequence, and returns no hash. The empty result is cached too, so an unreadable template logs once per cache lifetime instead of on every request.hook_page_attachments()out ofdo_base.moduleintoPageAttachmentsHook, alongside the four concerns it already carried. The hook now takes the route match, entity type manager, module handler and hash service by injection, which replaces the\Drupal::routeMatch()andImageStyle::load()static calls, and swaps theclass_exists(Csp::class)guard formoduleExists('csp').BANNER_ROUTES, plus any route carrying the_preview_link_routeoption, which is how the neighbouring preview-link tag already recognises a preview page. The edit form, the delete confirmation and the revision list all carry a node parameter and resolve the same background without ever drawing it, so each was fetching a full-width derivative and discarding it.NavigationScriptHashTest(11 cases) over the derivation, running against fixture templates undertests/fixtures/so every shape core could ship is reachable: one script, several scripts, no script, a Twig-built script, an unreadable template, an absent module, and the caching behaviour in both directions. AddedLibraryInfoAlterHookTest(13 cases) over the stylesheet filtering, including the leading-slash path shape CKEditor 5 actually produces and paths outside the base theme's own files.PageAttachmentsTest(14 cases), which resolves the hook from the container so its wiring is asserted alongside its behaviour, and drives it with the route match set per case: the nonce, the hash, the preload on each route that draws a banner and each route that does not, and a site without the policy module.testAllowedHashMatchesTheTemplate()compares the attached hash against one it computes from the template core currently ships, so a core release that restructures that file fails continuous integration rather than only logging a warning.docs/csp.md, including what each warning means and what to do about it, and the editor stylesheet exclusion and the preload's route gate indocs/performance.md, next to the existing claim that nothing is fetched fromfonts.googleapis.com, which the editing area did not hold to until now.Screenshots
Before / After
The issue reports five console messages from one page. They come from three causes, and the two font messages plus the Ajax failure are all one of them: both
@importstatements live in the same file, and a stylesheet whose@importis blocked fireserrorrather thanload, so core'sadd_csscommand reports the whole aggregate as unloadable, rejects, and abandons every command queued behind it.Where the hash comes from. Nothing digest-like is committed, and a template this cannot account for says so in the log instead of silently dropping the source: