diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index b47ff0c..cd796a1 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -142,11 +142,9 @@ public function processAttachments(AttachmentsInterface $response) { // placeholder for it, we can safely avoid processing the render array if // it's not present. if (!empty($placeholders['head'])) { - // 'feed' is a special case of 'html_head_link'. We create an - // 'html_head_link' for the RSS feed and merge it. + // 'feed' is a special case of 'html_head_link'. We process them into + // 'html_head_link' entries and merge them. if (!empty($attached['feed'])) { - // Since mergeBubbleableMetadata() requires a complete render array, we - // have to add the '#attached' key. $attached = BubbleableMetadata::mergeAttachments( $attached, $this->processFeed($attached['feed']) @@ -160,8 +158,7 @@ public function processAttachments(AttachmentsInterface $response) { if (!empty($attached['html_head_link'])) { // Merge the processed 'html_head_link' into $attached so that its // 'html_head' and 'http_header' values are present for further - // processing. The merge requires a full render array, so we have to add - // '#attached' keys. + // processing. $attached = BubbleableMetadata::mergeAttachments( $attached, $this->processHtmlHeadLink($attached['html_head_link']) diff --git a/core/modules/system/src/Tests/Common/RenderTest.php b/core/modules/system/src/Tests/Common/RenderTest.php index 11bb96a..a6aa89e 100644 --- a/core/modules/system/src/Tests/Common/RenderTest.php +++ b/core/modules/system/src/Tests/Common/RenderTest.php @@ -53,14 +53,15 @@ function testDrupalRenderThemePreprocessAttached() { } /** - * Tests drupal_process_attached(). + * Tests whether the render process allows invalid attachment types. */ - public function testDrupalProcessAttached() { + public function testProcessAttached() { // Specify invalid attachments in a render array. $build['#attached']['library'][] = 'core/drupal.states'; $build['#attached']['drupal_process_states'][] = []; + $renderer = $this->container->get('bare_html_page_renderer'); try { - drupal_process_attached($build); + $renderer->renderBarePage($build, '', $this->container->get('theme.manager')->getActiveTheme()->getName()); $this->fail("Invalid #attachment 'drupal_process_states' allowed"); } catch (\Exception $e) {