diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index 6104b0a..8391c4a 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -277,8 +277,7 @@ protected function processAssetLibraries(array $attached, array $placeholders) { // Take Ajax page state into account, to allow for something like Turbolinks // to be implemented without altering core. // @see https://github.com/rails/turbolinks/ - // @todo https://www.drupal.org/node/2497115 - Below line is broken due to ->request. - $ajax_page_state = $this->requestStack->getCurrentRequest()->request->get('ajax_page_state'); + $ajax_page_state = \Drupal::request()->get('ajax_page_state'); $assets->setAlreadyLoadedLibraries(isset($ajax_page_state) ? explode(',', $ajax_page_state['libraries']) : []); $variables = []; diff --git a/core/modules/system/src/Tests/Render/AjaxPageStateTest.php b/core/modules/system/src/Tests/Render/AjaxPageStateTest.php index db771a8..0acd207 100644 --- a/core/modules/system/src/Tests/Render/AjaxPageStateTest.php +++ b/core/modules/system/src/Tests/Render/AjaxPageStateTest.php @@ -32,7 +32,7 @@ protected function setUp() { ->getPermissions())); // Login so there are more libraries to test with otherwise only html5shiv - // is the only one in the source we can easly test for. + // is the only one in the source we can easily test for. $this->drupalLogin($this->adminUser); } @@ -43,8 +43,7 @@ protected function setUp() { * and available in code as scripts. Do this as the base test. */ public function testLibrariesAvailable() { - $url = '/'; - $this->drupalGet($url, array()); + $this->drupalGet('node', array()); $this->assertRaw( '/core/assets/vendor/html5shiv/html5shiv.min.js', 'The html5shiv library from core should be loaded.' @@ -64,8 +63,7 @@ public function testLibrariesAvailable() { * */ public function testHtml5ShivIsNotLoaded() { - $url = 'node'; - $this->drupalGet($url, + $this->drupalGet('node', array( "query" => array( @@ -82,7 +80,7 @@ public function testHtml5ShivIsNotLoaded() { $this->assertRaw( '/core/misc/drupalSettingsLoader.js', - 'The Dupalsetings library from core should be loaded.' + 'The Dupalsettings library from core should be loaded.' ); } @@ -94,8 +92,7 @@ public function testHtml5ShivIsNotLoaded() { * */ public function testMultipleLibrariesAreNotLoaded() { - $url = '/'; - $this->drupalGet($url, + $this->drupalGet('node', array( "query" => array( @@ -112,7 +109,7 @@ public function testMultipleLibrariesAreNotLoaded() { $this->assertNoRaw( '/core/misc/drupalSettingsLoader.js', - 'The Dupalsetings library from core should be excluded from loading.' + 'The Dupalsettings library from core should be excluded from loading.' ); } }