diff --git a/core/includes/common.inc b/core/includes/common.inc
index aea8529..412c809 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4719,7 +4719,7 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
 function drupal_build_js_cache($files) {
   $contents = '';
   $uri = '';
-  $map = variable_get('drupal_js_cache_files', array());
+  $map = state()->get('drupal_js_cache_files') ?: array();
   // Create a new array so that only the file names are used to create the hash.
   // This prevents new aggregates from being created unnecessarily.
   $js_data = array();
@@ -4764,7 +4764,7 @@ function drupal_build_js_cache($files) {
       }
     }
     $map[$key] = $uri;
-    variable_set('drupal_js_cache_files', $map);
+    state()->set('drupal_js_cache_files', $map);
   }
   return $uri;
 }
@@ -4774,7 +4774,7 @@ function drupal_build_js_cache($files) {
  */
 function drupal_clear_js_cache() {
   variable_del('javascript_parsed');
-  variable_del('drupal_js_cache_files');
+  state()->delete('drupal_js_cache_files');
   file_scan_directory('public://js', '/.*/', array('callback' => 'drupal_delete_file_if_stale'));
 }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
index 9507e3b..fda0915 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
@@ -344,11 +344,11 @@ class JavaScriptTest extends WebTestBase {
     ));
 
     // Store the expected key for the first item in the cache.
-    $cache = array_keys(variable_get('drupal_js_cache_files', array()));
+    $cache = array_keys(state()->get('drupal_js_cache_files') ?: array());
     $expected_key = $cache[0];
 
     // Reset variables and add a file in a different scope first.
-    variable_del('drupal_js_cache_files');
+    state()->delete('drupal_js_cache_files');
     drupal_static_reset('drupal_add_js');
     drupal_add_library('system', 'drupal');
     drupal_add_js('some/custom/javascript_file.js', array('scope' => 'footer'));
@@ -363,7 +363,7 @@ class JavaScriptTest extends WebTestBase {
     ));
 
     // Compare the expected key for the first file to the current one.
-    $cache = array_keys(variable_get('drupal_js_cache_files', array()));
+    $cache = array_keys(state()->get('drupal_js_cache_files') ?: array());
     $key = $cache[0];
     $this->assertEqual($key, $expected_key, 'JavaScript aggregation is not affected by ordering in different scopes.');
   }
