diff -u b/core/modules/color/color.module b/core/modules/color/color.module --- b/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -284,7 +284,7 @@ // Attempt to load preview HTML if the theme provides it. $preview_html_path = \Drupal::root() . '/' . (isset($info['preview_html']) ? drupal_get_path('theme', $theme) . '/' . $info['preview_html'] : drupal_get_path('module', 'color') . '/preview.html'); - $variables['html_preview'] = SafeMarkup::checkAdminXss(file_get_contents($preview_html_path)); + $variables['html_preview']['#markup'] = file_get_contents($preview_html_path); } /** diff -u b/core/modules/color/src/Tests/ColorSafePreviewTest.php b/core/modules/color/src/Tests/ColorSafePreviewTest.php --- b/core/modules/color/src/Tests/ColorSafePreviewTest.php +++ b/core/modules/color/src/Tests/ColorSafePreviewTest.php @@ -45,13 +45,14 @@ * Ensures color preview.html is sanitized. */ function testColorPreview() { - // Install the test theme + // Install the color test theme. \Drupal::service('theme_handler')->install(['color_test_theme']); - - $url_object = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']); - $this->drupalLogin($this->bigUser); - $this->drupalGet($url_object); + + // Markup is being printed from a HTML file located in: + // core/modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html + $url = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']); + $this->drupalGet($url); $this->assertText('TEST COLOR PREVIEW'); $this->assertNoRaw('');